query-77af8f8ad2313df8ae7dcaf4b40c1ce5

rq turtle/ttl

ChemID constraint violations: not so bad: (Q19833835)Wikidata property to identify substances Two week ago an extension of the RDF was announced that makes it possible to access constraint violations available via the query service... I played with it and created a query to list all violations of

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?prop ?propLabel ?violation ?violationLabel ?constraint ?class ?classLabel {
   {
  SELECT DISTINCT ?item ?z1 ?s ?y WHERE {
    ?s wikibase:hasViolationForConstraint ?y.
    ?item ?z1 ?s .
  }
}  ?prop wikibase:claim ?z1 ;
        wdt:P31 wd:Q19833835 .
  OPTIONAL { ?y ps:P2302 ?violation }
  OPTIONAL { ?y pq:P1793 ?constraint }     
  OPTIONAL { ?y pq:P2308 ?class }     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?class"):::projected v7("?constraint"):::projected v3("?item"):::projected v5("?prop"):::projected v1("?s") v6("?violation"):::projected v2("?y") v4("?z1") c9(["bd:serviceParam"]):::iri c4(["wd:Q19833835"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wikibase:hasViolationForConstraint"--> v2 v3 -->v4--> v1 v5 --"wikibase:claim"--> v4 v5 --"wdt:P31"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."ps:P2302".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."pq:P1793".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."pq:P2308".-> v8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end