A set of SPARQL examples that are used in different TGX resources
Lists all pathways per instance of a particular gene or protein (wp:GeneProduct), here all 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 .
?pathway a wp:Pathway .
FILTER regex(str(?label), "CYP").
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?gene")
v4("?geneProduct")
v1("?label"):::projected
v3("?pathway"):::projected
c3(["wp:GeneProduct"]):::iri
c6(["wp:Pathway"]):::iri
f0[["regex(str(?label),'CYP')"]]
f0 --> v1
v2 --"a"--> c3
v2 --"rdfs:label"--> v1
v2 --"dcterms:isPartOf"--> v3
v3 --"a"--> c6
bind1[/"str(?label)"/]
v1 --o bind1
bind1 --as--o v4