sparql-examples

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

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

107

rq turtle/ttl

Ontology aspect: used by ontologies

Use at

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX target: <http://www.wikidata.org/entity/Q116446479>

SELECT
  (GROUP_CONCAT(?value_; separator=", ") AS ?value)
  (CONCAT("../ontology/", GROUP_CONCAT(?q; separator=",")) AS ?valueUrl)
WHERE {
  ?usedByOntology wdt:P2283 target: .
  BIND(SUBSTR(STR(?usedByOntology), 32) AS ?q)
  ?usedByOntology rdfs:label ?value_string .
  FILTER (LANG(?value_string) = 'en')
  BIND(COALESCE(?value_string, ?q) AS ?value_)
} GROUP BY ?usedByOntology

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?_anon_d5635a4148474aba9b1ec2d6f2e48935763"):::projected 
  v3("?q")
  v2("?usedByOntology")
  v6("?value")
  v7("?valueUrl")
  v4("?value_"):::projected 
  v1("?value_string")
  c3([http://www.wikidata.org/entity/Q116446479]):::iri 
  f0[["?value_string = 'en'"]]
  f0 --> v1
  v2 --"p:direct/P2283"-->  c3
  bind1[/"substring(str(?usedByOntology),'32^^xsd:integer')"/]
  v2 --o bind1
  bind1 --as--o v3
  v2 --"rdfs:label"-->  v1
  bind2[/"?value_string?q"/]
  v1 --o bind2
  v3 --o bind2
  bind2 --as--o v4
  bind5[/"?q"/]
  v3 --o bind5
  bind5 --as--o v5
  bind6[/"?value_"/]
  v4 --o bind6
  bind6 --as--o v6
  bind7[/"concat('../ontology/',)"/]
  null --o bind7
  bind7 --as--o v7