sparql-examples

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

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

122

rq turtle/ttl

Pathway aspect: optional data values

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q28031254>

SELECT ?wpid ?organism ?organismLabel ?pathwayDescription
WHERE {
  VALUES ?pathway { target: }
  OPTIONAL {
    target: wdt:P2410 ?wpid ;
    wdt:P703 ?organism .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?organism"):::projected 
  v1("?pathway")
  v2("?wpid"):::projected 
  c1([http://www.wikidata.org/entity/Q28031254]):::iri 
  c5([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c7(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  bind0[/VALUES ?pathway/]
  bind0-->v1
  bind00([http://www.wikidata.org/entity/Q28031254])
  bind00 --> bind0
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    c1 -."p:direct/P2410".->  v2
    c1 --"p:direct/P703"-->  v3
  end
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c5 --"wikibase:language"-->  c7
  end