A set of SPARQL examples for tutorials at SWAT4HCLS
Find genes having Uniprot xrefs in the group 6400at314295, along with their names fetched from Uniprot SPARQL endpoint
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX odbgroup: <http://purl.orthodb.org/odbgroup/>
PREFIX : <http://purl.orthodb.org/>
SELECT *
WHERE {
?gene a :Gene;
:memberOf odbgroup:6400at314295 .
?gene :xref [a :Xref; :xrefResource ?xref] .
?xref a :Uniprot .
SERVICE <https://sparql.uniprot.org/sparql> {
?xref a up:Protein ;
up:recommendedName [up:fullName ?name] .
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?gene"):::projected
v3("?name"):::projected
v2("?xref"):::projected
a1((" "))
a2((" "))
c8([":Uniprot"]):::iri
c5([":Xref"]):::iri
c2([":Gene"]):::iri
c4([":odbgroup/6400at314295"]):::iri
c10(["up:Protein"]):::iri
v1 --"a"--> c2
v1 --":memberOf"--> c4
a1 --"a"--> c5
a1 --":xrefResource"--> v2
v1 --":xref"--> a1
v2 --"a"--> c8
subgraph s1["https://sparql.uniprot.org/sparql"]
style s1 stroke-width:4px;
v2 --"a"--> c10
a2 --"up:fullName"--> v3
v2 --"up:recommendedName"--> a2
end