<p>Ok, figured it out by looking at the <a href="http://www.uniprot.org/format/uniprot_rdf" rel="nofollow noreferrer">scheme</a> uniprot provides:</p>

<pre><code>PREFIX up:&lt;http://purl.uniprot.org/core/&gt; 

SELECT ?protein ?yeast_id
WHERE
{
    Bind(&lt;http://purl.uniprot.org/uniprot/P00330&gt; as ?protein).
    ?protein up:encodedBy ?gene .
    ?gene up:locusName ?yeast_id    
}
</code></pre>

<p>So one starts at the accession number in the middle and then uses the path to the actual <code>locusName</code>.</p>

<p>Also the path via the database works fine, I just did not use the <code>seeAlso</code> correctly (<code>protein</code> was only bound to <code>db</code> but not to <code>db2</code>, that's why it returned all entries):</p>

<pre><code>PREFIX up:&lt;http://purl.uniprot.org/core/&gt; 
PREFIX rdfs:&lt;http://www.w3.org/2000/01/rdf-schema#&gt; 

SELECT ?protein ?db ?db2
WHERE
{
    Bind(&lt;http://purl.uniprot.org/uniprot/P00330&gt; as ?protein).
    ?protein rdfs:seeAlso ?db .
    ?protein rdfs:seeAlso ?db2 .
    ?db up:database &lt;http://purl.uniprot.org/database/SGD&gt; .
    ?db2 up:database &lt;http://purl.uniprot.org/database/EuPathDB&gt;

}
</code></pre>

<p>This will return the desired output (one would still have to process the <code>db2</code> entry, of course):</p>

<pre><code>protein db  db2
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446  http://purl.uniprot.org/eupathdb/FungiDB:YOL086C
</code></pre>

CC BY-SA 3.0
2018-03-13T13:45:19.657Z
I am really happy to see you found your answer! Could we use this as an example query on the sparql endpoint itself?
Jerven
CC BY-SA 3.0
2018-03-13T14:02:58.110Z
@Jerven: feel free to use it, sure! I just updated my answer to show that also the path via the database works fine; I just used it wrong.
Cleb
CC BY-SA 3.0
2018-03-09T12:59:37.797Z
2018-03-15T07:33:05.427Z
2018-03-15T07:33:05.427Z
Cleb
<p>Let's say I want to retrieve the yeast-specific identifier for a certain protein, in the example below it will be <a href="http://www.uniprot.org/uniprot/P00330" rel="nofollow noreferrer">P00330</a> which I would like to link to <a href="https://www.yeastgenome.org/locus/S000005446" rel="nofollow noreferrer">YOL086C</a>.</p>

<p>When I go to <a href="https://sparql.uniprot.org/sparql" rel="nofollow noreferrer">uniprot's sparql UI</a> and type </p>

<pre><code>PREFIX up:&lt;http://purl.uniprot.org/core/&gt; 
PREFIX rdfs:&lt;http://www.w3.org/2000/01/rdf-schema#&gt; 

SELECT *
WHERE
{
    Bind(&lt;http://purl.uniprot.org/uniprot/P00330&gt; as ?protein).
    ?protein rdfs:seeAlso ?db .
    ?db up:database &lt;http://purl.uniprot.org/database/SGD&gt; .

}
</code></pre>

<p>it returns</p>

<pre><code>protein db
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446
</code></pre>

<p>How would I now go on and find the <code>YOL086C</code>? When I add the line</p>

<pre><code>?db ?p ?o
</code></pre>

<p>to the query above, I don't see anything that would directly lead me to the identifier.</p>

<p>I also tried to access another database</p>

<pre><code>?db2 up:database &lt;http://purl.uniprot.org/database/EuPathDB&gt;
</code></pre>

<p>but this returns all kind of databases while I am interested only in the <code>FungiDB</code>. How could I select this one?</p>

<p>How could I link the two IDs to each other?</p>

<uniprot>
How to retrieve the yeast locus tag from uniprot via sparql?
# How to retrieve the yeast locus tag from uniprot via sparql?

(Asked by: username_0 on 2018-03-09)

Let's say I want to retrieve the yeast-specific identifier for a certain protein, in the example below it will be P00330 which I would like to link to YOL086C.
When I go to uniprot's sparql UI and type 
PREFIX up: 
PREFIX rdfs: 

SELECT *
WHERE
{
    Bind( as ?protein).
    ?protein rdfs:seeAlso ?db .
    ?db up:database  .

}

it returns
protein db
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446

How would I now go on and find the YOL086C? When I add the line
?db ?p ?o

to the query above, I don't see anything that would directly lead me to the identifier.
I also tried to access another database
?db2 up:database 

but this returns all kind of databases while I am interested only in the FungiDB. How could I select this one?
How could I link the two IDs to each other?

**Tags:** uniprot

---

## 1 answers

### Answer by username_0 on 2018-03-09. Score: 4 | Accepted answer

Ok, figured it out by looking at the scheme uniprot provides:
PREFIX up: 

SELECT ?protein ?yeast_id
WHERE
{
    Bind( as ?protein).
    ?protein up:encodedBy ?gene .
    ?gene up:locusName ?yeast_id    
}

So one starts at the accession number in the middle and then uses the path to the actual locusName.
Also the path via the database works fine, I just did not use the seeAlso correctly (protein was only bound to db but not to db2, that's why it returned all entries):
PREFIX up: 
PREFIX rdfs: 

SELECT ?protein ?db ?db2
WHERE
{
    Bind( as ?protein).
    ?protein rdfs:seeAlso ?db .
    ?protein rdfs:seeAlso ?db2 .
    ?db up:database  .
    ?db2 up:database 

}

This will return the desired output (one would still have to process the db2 entry, of course):
protein db  db2
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446  http://purl.uniprot.org/eupathdb/FungiDB:YOL086C

> **Comments:**
> **username_1**: I am really happy to see you found your answer! Could we use this as an example query on the sparql endpoint itself?  
> **username_0**: @Jerven: feel free to use it, sure! I just updated my answer to show that also the path via the database works fine; I just used it wrong.  

---

