query-fb584eabff0e1bebac60ec998884de06

rq turtle/ttl

retrieve all "unknowns" and "no value" claims SELECT ?item ?prefix ?valueorstatementnode ?typeOfStatementNode ?customText WHERE { #for selected items VALUES ?item { wd:Q86085 wd:Q4233718 } ?item ?prefix ?valueorstatementnode.

!BOUND(DATATYPE(?valueorstatementnode))

BIND(xsd:integer(IF(fn:starts-with(STR(?prefix), "http://www.wikidata.org/prop/P"), fn:replace(STR(?prefix), "http://www.wikidata.org/prop/P", ""), "???")) as ?pid)
BIND(IRI(CONCAT("http://www.wikidata.org/prop/novalue/P", STR(?pid))) as ?possibleWDNO)


OPTIONAL 
{
?valueorstatementnode rdf:type ?typeOfStatementNode. # information about "no value" stored as type
}
BIND(IF(isBlank(?valueorstatementnode), "unknown value", IF(?typeOfStatementNode = ?possibleWDNO, "no value", ?value)) as ?customText)

SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } ORDER BY DESC(?customText)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#retrieve all "unknowns" and "no value" claims
SELECT ?item ?prefix ?valueorstatementnode ?typeOfStatementNode ?customText
WHERE
{
                                                         #for selected items
    VALUES ?item {
      wd:Q86085
      wd:Q4233718
    }
    ?item  ?prefix ?valueorstatementnode.
#   !BOUND(DATATYPE(?valueorstatementnode))

    BIND(xsd:integer(IF(fn:starts-with(STR(?prefix), "http://www.wikidata.org/prop/P"), fn:replace(STR(?prefix), "http://www.wikidata.org/prop/P", ""), "???")) as ?pid)
    BIND(IRI(CONCAT("http://www.wikidata.org/prop/novalue/P", STR(?pid))) as ?possibleWDNO)


    OPTIONAL 
    {
    ?valueorstatementnode rdf:type ?typeOfStatementNode. # information about "no value" stored as type
    }
    BIND(IF(isBlank(?valueorstatementnode), "unknown value", IF(?typeOfStatementNode = ?possibleWDNO, "no value", ?value)) as ?customText)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?customText)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?customText"):::projected v2("?item"):::projected v5("?pid") v6("?possibleWDNO") v3("?prefix"):::projected v7("?typeOfStatementNode"):::projected v4("?valueorstatementnode"):::projected c3(["bd:serviceParam"]):::iri c5(["en"]):::literal bind0[/VALUES ?item/] bind0-->v2 bind00(["wd:Q86085"]) bind00 --> bind0 bind01(["wd:Q4233718"]) bind01 --> bind0 v2 -->v3--> v4 bind1[/"http://www.w3.org/2001/XMLSchema#integer(if(starts-with(str(?prefix),'http://www.wikidata.org/prop/P'),replace(str(?prefix),'http://www.wikidata.org/prop/P',''),'???'))"/] v3 --o bind1 bind1 --as--o v5 bind2[/"concat('http://www.wikidata.org/prop/novalue/P',str(?pid))"/] v5 --o bind2 bind2 --as--o v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."a".-> v7 end bind3[/"if(isBlank(?valueorstatementnode),'unknown value',if(?typeOfStatementNode = ?possibleWDNO,'no value',?value))"/] v4 --o bind3 v7 --o bind3 v6 --o bind3 null --o bind3 bind3 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c3 --"wikibase:language"--> c5 end