sparql-examples

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

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

041

rq turtle/ttl

Returns all publication references for interactions in a given pathway, including references attached to both the interaction itself and its participating data nodes. This example uses the default value (Pathway ID "WP5200"); 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#>

SELECT DISTINCT ?pathway ?interaction ?pubmed ?partnerref WHERE {
   ?pathway a wp:Pathway ;
            dc:identifier <https://identifiers.org/wikipathways/WP5200> .
   ?interaction dcterms:isPartOf ?pathway ;
                a wp:Interaction ;
                wp:participants ?partner;
                dcterms:references ?pubmed .
   OPTIONAL{?partner dc:identifier ?partnerID ;
            dcterms:references ?partnerref .}
} LIMIT 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?interaction"):::projected 
  v3("?partner")
  v5("?partnerID")
  v6("?partnerref"):::projected 
  v1("?pathway"):::projected 
  v4("?pubmed"):::projected 
  c4([https://identifiers.org/wikipathways/WP5200]):::iri 
  c6(["wp:Interaction"]):::iri 
  c2(["wp:Pathway"]):::iri 
  v1 --"a"-->  c2
  v1 --"dc:identifier"-->  c4
  v2 --"dcterms:isPartOf"-->  v1
  v2 --"a"-->  c6
  v2 --"wp:participants"-->  v3
  v2 --"dcterms:references"-->  v4
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."dc:identifier".->  v5
    v3 --"dcterms:references"-->  v6
  end