sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

059

rq turtle/ttl

Retrieves ontology annotations, curation status, and literature references for directed metabolic reactions in human pathways as part of the DSMN workflow. This example uses the default value (Species "Homo sapiens"); the WikiPathways SNORQL UI lets you change it.

Use at

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>

### Part 1: ###
SELECT DISTINCT ?interaction ?sourceDb ?targetDb ?PWOnt ?DiseaseOnt
?curationstatus ?InteractionRef ?PWref ?sourceLit ?targetLit 
WHERE {
?pathway a wp:Pathway ; 
         	wp:organismName "Homo sapiens";
         	dc:title ?titleLit . 
?interaction dcterms:isPartOf ?pathway ; 
   a wp:DirectedInteraction ; 
   wp:source ?source ;
   wp:target ?target . 
?source a wp:Metabolite . 
?source wp:bdbWikidata ?sourceDb . 
?target a wp:Metabolite . 
?target wp:bdbWikidata ?targetDb . 

### Part 2: ###
#OPTIONAL{?pathway wp:pathwayOntologyTag ?PWOnt} . 
#OPTIONAL{?pathway wp:diseaseOntologyTag ?DiseaseOnt} . 

### Part 3: ###
#OPTIONAL{?pathway wp:ontologyTag ?curationstatus} . 

### Part 4: ###
OPTIONAL{?interaction dcterms:bibliographicCitation ?InteractionRef} . 
OPTIONAL{?pathway dcterms:references ?PWref} . 
OPTIONAL{?source dcterms:bibliographicCitation ?sourceLit} . 
OPTIONAL{?target dcterms:bibliographicCitation ?targetLit} . 
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v8("?InteractionRef"):::projected 
  v9("?PWref"):::projected 
  v3("?interaction"):::projected 
  v1("?pathway")
  v4("?source")
  v6("?sourceDb"):::projected 
  v10("?sourceLit"):::projected 
  v5("?target")
  v7("?targetDb"):::projected 
  v11("?targetLit"):::projected 
  v2("?titleLit")
  c7(["wp:DirectedInteraction"]):::iri 
  c4(["Homo sapiens"]):::literal 
  c2(["wp:Pathway"]):::iri 
  c10(["wp:Metabolite"]):::iri 
  v1 --"a"-->  c2
  v1 --"wp:organismName"-->  c4
  v1 --"dc:title"-->  v2
  v3 --"dcterms:isPartOf"-->  v1
  v3 --"a"-->  c7
  v3 --"wp:source"-->  v4
  v3 --"wp:target"-->  v5
  v4 --"a"-->  c10
  v4 --"wp:bdbWikidata"-->  v6
  v5 --"a"-->  c10
  v5 --"wp:bdbWikidata"-->  v7
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."dcterms:bibliographicCitation".->  v8
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."dcterms:references".->  v9
  end
  subgraph optional2["(optional)"]
  style optional2 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."dcterms:bibliographicCitation".->  v10
  end
  subgraph optional3["(optional)"]
  style optional3 fill:#bbf,stroke-dasharray: 5 5;
    v5 -."dcterms:bibliographicCitation".->  v11
  end