sparql-examples

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

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

043

rq turtle/ttl

Chemical aspect: found in matrix np

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/Q2270>

SELECT DISTINCT ?matrix ?matrixLabel ?taxon ?taxonLabel (CONCAT("/taxon/", SUBSTR(STR(?taxon), 32)) AS ?taxonUrl) WHERE {
  VALUES ?chemical { target: }
  ?chemical wdt:P361 ?matrix.
  ?matrix (wdt:P279*/wdt:P1582) ?taxon .
  ?matrix wdt:P527 ?chemical.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} ORDER BY ASC(?taxonLabel)
  LIMIT 250

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?chemical")
  v3("?matrix"):::projected 
  v4("?taxon"):::projected 
  v1("?taxonLabel"):::projected 
  v5("?taxonUrl")
  a1((" "))
  c6([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c8(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  bind0[/VALUES ?chemical/]
  bind0-->v2
  bind00([http://www.wikidata.org/entity/Q2270])
  bind00 --> bind0
  v2 --"p:direct/P361"-->  v3
  v3 --"p:direct/P279"-->  a1
  a1 --"p:direct/P1582"-->  v4
  v3 --"p:direct/P527"-->  v2
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c6 --"wikibase:language"-->  c8
  end
  bind1[/"concat('/taxon/',substring(str(?taxon),'32^^xsd:integer'))"/]
  v4 --o bind1
  bind1 --as--o v5