A set of SPARQL examples that are used in different SIB resources
Proteins belonging to Rett syndrome pathways, and their subcellular locations (GOLD)
PREFIX : <http://nextprot.org/rdf/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?entry (str(?gen) AS ?gene) ?pathwayname (group_concat(distinct str(?loclab); SEPARATOR = ",") as ?locs) WHERE {
SERVICE <https://sparql.wikipathways.org/sparql> {
{?geneProduct a wp:Protein}
union
{?geneProduct a wp:GeneProduct}
?geneProduct rdfs:label ?genraw .
bind (concat( ""^^xsd:string, ?genraw) as ?gen).
filter(!regex(?gen,"[ a-z-]")). # ensures official gene names for subsequent neXtprot matching
?geneProduct dcterms:isPartOf ?pathway .
?pathway a wp:Pathway .
?pathway wp:organism ?organism .
filter(contains(str(?organism),"9606"))
?pathway dcterms:title ?pathwayname .
filter(regex(?pathwayname,"rett","i")).
}
?entry a :Entry .
?entry :gene / :recommendedName / rdfs:label ?gen .
?entry :isoform ?iso.
?iso :cellularComponent ?locannot .
?locannot :term ?locterm .
?locterm rdfs:label ?loclab .
?locannot :evidence ?locev .
?locev :quality :GOLD .
filter not exists {?locannot :negativeEvidence ?locev .}
}
group by ?entry ?gen ?pathwayname
order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?entry"):::projected
v9("?gen"):::projected
v13("?gene")
v7("?geneProduct")
v8("?genraw")
v10("?iso")
v2("?locannot")
v3("?locev")
v12("?loclab"):::projected
v14("?locs")
v11("?locterm")
v5("?organism")
v9("?pathway")
v4("?pathwayname"):::projected
a1((" "))
a2((" "))
c8(["wp:Protein"]):::iri
c12(["wp:Pathway"]):::iri
c9(["wp:GeneProduct"]):::iri
c15([":Entry"]):::iri
c23([":GOLD"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --":negativeEvidence"--> e0v2
e0v1("?locannot"):::projected
e0v2("?locev"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> v3
v2 --":negativeEvidence"--> v3
subgraph s1["https://sparql.wikipathways.org/sparql"]
style s1 stroke-width:4px;
f1[["regex(?pathwayname,'rett','i')"]]
f1 --> v4
f2[["contains(str(?organism),'9606')"]]
f2 --> v5
f3[["not regex(?gen,'#91; a-z-#93;')"]]
f3 --> v9
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v7 --"a"--> c9
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v7 --"a"--> c8
end
union0r <== or ==> union0l
end
v7 --"rdfs:label"--> v8
bind4[/"concat('',?genraw)"/]
v8 --o bind4
bind4 --as--o v9
v7 --"dcterms:isPartOf"--> v9
v9 --"a"--> c12
v9 --"wp:organism"--> v5
v9 --"dcterms:title"--> v4
end
v1 --"a"--> c15
v1 --":gene"--> a1
a1 --":recommendedName"--> a2
a2 --"rdfs:label"--> v9
v1 --":isoform"--> v10
v10 --":cellularComponent"--> v2
v2 --":term"--> v11
v11 --"rdfs:label"--> v12
v2 --":evidence"--> v3
v3 --":quality"--> c23
bind6[/"str(?gen)"/]
v9 --o bind6
bind6 --as--o v13
bind7[/"str(?loclab)"/]
v12 --o bind7
bind7 --as--o v14