sparql-examples

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

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

034

rq turtle/ttl

Chemical-class aspect: identifiers

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 wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q46995757>

SELECT
  ?IDpred ?IDpredLabel
  ?id ?idUrl
  ?IDpredDescription
{
  target: ?IDdir ?id .
  ?IDpred wikibase:directClaim ?IDdir ;
            wdt:P31 wd:Q19833835 .
  OPTIONAL {
    ?IDpred wdt:P1630 ?formatterurl .
  }
  BIND(IRI(REPLACE(?formatterurl, '\\$1', str(?id))) AS ?idUrl).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY ASC(?IDpredLabel)
LIMIT 500

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?IDdir")
  v4("?IDpred"):::projected 
  v1("?IDpredLabel"):::projected 
  v5("?formatterurl")
  v3("?id"):::projected 
  v6("?idUrl"):::projected 
  c7([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c1(["wd:Q46995757"]):::iri 
  c9(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  c4([http://wikidata.org/entity/Q19833835]):::iri 
  c1 -->v2--> v3
  v4 --"wikibase:directClaim"-->  v2
  v4 --"p:direct/P31"-->  c4
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."p:direct/P1630".->  v5
  end
  bind0[/"replace(?formatterurl,'\$1',str(?id))"/]
  v5 --o bind0
  v3 --o bind0
  bind0 --as--o v6
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c7 --"wikibase:language"-->  c9
  end