query-21b2ee0c4b579bfde71212b0bdad1434
So, this, maybe, if "no value" is an acceptable record (and thus should be excluded from the report).: - sorry, we're not quite there. I'd leave the constraint you added in place since I think for practical purposes the issue is on the margins given the current state of the data. Wostr @ 00:30, 10 May 2018 (UTC)) talk (TagishsimonAll - the problem is explained in the comments in the report below --
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item
# we are looking for P4952=Q51139288 which are missing any of four PQs
# a PQ of 'no value' is a valid PQ.
WHERE {
?item p:P4952 ?statement.
?statement ps:P4952 wd:Q51139288.
filter not exists {
?statement pq:P877 ?v877.
?statement pq:P993 ?v993.
?statement pq:P994 ?v994.
?statement pq:P995 ?v995.}
# Out of the above emerges a list of P4952=Q51139288 where there is one or more missing PQs.
# However the filter treats a PQ value of 'no value' as the absence of a PQ.
# So an item having the 4 PQs, but with one or more of 'no value', will appear in the results.
# an item having the 4 PQs, but with one or more of 'no value' should not be listed.
# the minus statements below were an attempt to deal with the 'no value' issue
# but they'll exclude an item that has e.g. 3 PQs, one of which is 'no value'
# I don't know how to make use of "a wdno:P877" so as to minus the item only where all four PQs are present.
minus {?statement a wdno:P877.} #deal with value is "no value"
minus {?statement a wdno:P993.}
minus {?statement a wdno:P994.}
minus {?statement a wdno:P995.}
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;
v6("?item"):::projected
v1("?statement")
v2("?v877")
v3("?v993")
v4("?v994")
v5("?v995")
c9(["p:novalue/P877"]):::iri
c12(["p:novalue/P995"]):::iri
c10(["p:novalue/P993"]):::iri
c11(["p:novalue/P994"]):::iri
c14(["bd:serviceParam"]):::iri
c7(["wd:Q51139288"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:qualifier/P877"--> e0v2
e0v1 --"p:qualifier/P993"--> e0v3
e0v1 --"p:qualifier/P994"--> e0v4
e0v1 --"p:qualifier/P995"--> e0v5
e0v1("?statement"):::projected
e0v2("?v877"):::projected
e0v3("?v993"):::projected
e0v4("?v994"):::projected
e0v5("?v995"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v2
f0 --> c2
f0 --> v3
f0 --> c3
f0 --> v4
f0 --> c4
f0 --> v5
v1 --"p:qualifier/P877"--> v2
v1 --"p:qualifier/P993"--> v3
v1 --"p:qualifier/P994"--> v4
v1 --"p:qualifier/P995"--> v5
v6 --"p:P4952"--> v1
v1 --"p:statement/P4952"--> c7
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v1 --"a"--> c9
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v1 --"a"--> c10
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v1 --"a"--> c11
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v1 --"a"--> c12
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end