A set of SPARQL examples that are used in different TGX resources
Lists all groups and complexes that contain a particular gene or protein (wp:GeneProduct), here gene products whose label contains "CYP".
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
SELECT DISTINCT ?pathway (str(?label) as ?geneProduct)
WHERE {
?gene a wp:GeneProduct .
?gene rdfs:label ?label .
?gene dcterms:isPartOf ?pathway .
FILTER NOT EXISTS { ?pathway a wp:Interaction } .
FILTER NOT EXISTS { ?pathway a wp:Pathway } .
FILTER regex(str(?label), "CYP").
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?gene")
v4("?geneProduct")
v1("?label"):::projected
v2("?pathway"):::projected
c5(["wp:GeneProduct"]):::iri
c4(["wp:Interaction"]):::iri
c3(["wp:Pathway"]):::iri
f0[["regex(str(?label),'CYP')"]]
f0 --> v1
f1[["not "]]
subgraph f1e0["Exists Clause"]
e0v1 --"a"--> e0c2
e0v1("?pathway"):::projected
e0c2(["wp:Pathway"]):::iri
end
f1--EXISTS--> f1e0
f1 --> v2
f1 --> c2
f1 --> c3
v2 --"a"--> c3
f2[["not "]]
subgraph f2e1["Exists Clause"]
e1v1 --"a"--> e1c2
e1v1("?pathway"):::projected
e1c2(["wp:Interaction"]):::iri
end
f2--EXISTS--> f2e1
f2 --> v2
f2 --> c2
f2 --> c4
v2 --"a"--> c4
v3 --"a"--> c5
v3 --"rdfs:label"--> v1
v3 --"dcterms:isPartOf"--> v2
bind3[/"str(?label)"/]
v1 --o bind3
bind3 --as--o v4