A set of SPARQL examples that are used in different SIB resources
Find the orthologous proteins for UniProtKB entry P05067 using the OrthoDB database
PREFIX orthodb: <http://purl.orthodb.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT
?protein
?orthoGroup
?scientificName
?functionComment
?prefferedGeneName
((STRLEN(?value) - ?medianLength) as ?deviationFromMedianLength)
WHERE
{
BIND(uniprotkb:P05067 AS ?protein)
?protein a up:Protein ;
up:organism/up:scientificName ?scientificName ;
up:encodedBy/skos:prefLabel ?prefferedGeneName ;
up:sequence/rdf:value ?value .
# We do not ask the UniProt endpoint for the ?orthoGroup from the
# cross-reference as these can be out of date. We trust the content
# of the orthodb endpoint
OPTIONAL {
?protein up:annotation ?functionAnnotation .
?functionAnnotation a up:Function_Annotation ;
rdfs:comment ?functionComment .
}
SERVICE <https://sparql.orthodb.org/sparql/>{
?orthoGroup orthodb:ogMedianProteinLength ?medianLength .
?orthoGroup orthodb:hasMember ?xref .
?xref orthodb:xref/orthodb:xrefResource ?protein .
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?deviationFromMedianLength")
v5("?functionAnnotation")
v6("?functionComment"):::projected
v8("?medianLength"):::projected
v7("?orthoGroup"):::projected
v3("?prefferedGeneName"):::projected
v1("?protein"):::projected
v2("?scientificName"):::projected
v4("?value"):::projected
v9("?xref")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c10(["up:Function_Annotation"]):::iri
c2(["up:Protein"]):::iri
bind0[/"'uniprotkb:P05067'"/]
bind0 --as--o v1
v1 --"a"--> c2
v1 --"up:organism"--> a1
a1 --"up:scientificName"--> v2
v1 --"up:encodedBy"--> a2
a2 --"skos:prefLabel"--> v3
v1 --"up:sequence"--> a3
a3 --"rdf:value"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."up:annotation".-> v5
v5 --"a"--> c10
v5 --"rdfs:comment"--> v6
end
subgraph s1["https://sparql.orthodb.org/sparql/"]
style s1 stroke-width:4px;
v7 --"orthodb:ogMedianProteinLength"--> v8
v7 --"orthodb:hasMember"--> v9
v9 --"orthodb:xref"--> a4
a4 --"orthodb:xrefResource"--> v1
end
bind1[/"string-length(?value) - ?medianLength"/]
v4 --o bind1
v8 --o bind1
bind1 --as--o v10