sparql-examples

A set of SPARQL examples

View the Project on GitHub Adafede/sparql-examples

wd_maintenance_inchikey_statements

rq turtle/ttl

Statements no longer valid because (none of) the InChIKey(s) of the item does not correspond to the InChIKey matched for the reference.

Use at


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX hint: <http://www.bigdata.com/queryHints#>
#title: Statements no longer valid because (none of) the InChIKey(s) of the item does not correspond to the InChIKey matched for the reference.
SELECT ?item ?statement ?inchikey_item ?inchikey_ref WHERE {
    {
        SELECT ?item ?statement (GROUP_CONCAT(?ii; SEPARATOR = " ") AS ?inchikey_item) ?inchikey_ref WHERE {
            ?statement (prov:wasDerivedFrom/pr:P235) ?inchikey_ref.
            hint:Prior hint:rangeSafe true.
            ?item ?p ?statement.
            hint:Prior hint:rangeSafe true.
            ?item wdt:P235 ?ii.
            hint:Prior hint:rangeSafe true.
        }
        GROUP BY ?item ?statement ?inchikey_ref
    }
    FILTER (?inchikey_item != ?inchikey_ref)
    FILTER (!REGEX(?inchikey_item, ?inchikey_ref))
}

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?ii")
  v7("?inchikey_item"):::projected 
  v2("?inchikey_ref"):::projected 
  v4("?item"):::projected 
  v5("?p")
  v3("?statement"):::projected 
  a1((" "))
  c3([http://www.bigdata.com/queryHints#Prior]):::iri 
  c5(["true^^xsd:boolean"]):::literal 
  f0[["not regex(?inchikey_item,?inchikey_ref)"]]
  f0 --> v7
  f0 --> v2
  f1[["?inchikey_item != ?inchikey_ref"]]
  f1 --> v7
  f1 --> v2
  v3 --"prov:wasDerivedFrom"-->  a1
  a1 --"pr:P235"-->  v2
  c3 --http://www.bigdata.com/queryHints#rangeSafe-->  c5
  v4 -->v5--> v3
  c3 --http://www.bigdata.com/queryHints#rangeSafe-->  c5
  v4 --"wdt:P235"-->  v6
  c3 --http://www.bigdata.com/queryHints#rangeSafe-->  c5
  bind3[/"?ii"/]
  v6 --o bind3
  bind3 --as--o v7