query-10bc8ddecf879e1d4f78a5c8763d0166
: Maybe this is what you are looking for. Wostr@
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.
MINUS {
OPTIONAL { ?statement pq:P877 ?v877 }
FILTER(BOUND(?v877) || EXISTS{?statement a wdno:P877.}) #treat the value "no value" as valid
OPTIONAL { ?statement pq:P993 ?v993 }
FILTER(BOUND(?v993) || EXISTS{?statement a wdno:P993.})
OPTIONAL { ?statement pq:P994 ?v994 }
FILTER(BOUND(?v994) || EXISTS{?statement a wdno:P994.})
OPTIONAL { ?statement pq:P995 ?v995 }
FILTER(BOUND(?v995) || EXISTS{?statement a wdno:P995.})
}
# Out of the above emerges a list of P4952=Q51139288 where there is one or more missing PQs.
# ALSO the filter treats a PQ value of 'no value' as the PRESENCE of a PQ.
# So an item having the 4 PQs, but with one or more of 'no value', will NOT appear in the results.
# Please note that also a PQ of 'unknown value', as e.g. Q331451 and Q21099636 have, is treated as a valid PQ
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;
v1("?item"):::projected
v2("?statement")
v6("?v877")
v5("?v993")
v4("?v994")
v3("?v995")
c8(["p:novalue/P877"]):::iri
c5(["p:novalue/P995"]):::iri
c7(["p:novalue/P993"]):::iri
c6(["p:novalue/P994"]):::iri
c14(["bd:serviceParam"]):::iri
c3(["wd:Q51139288"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"p:P4952"--> v2
v2 --"p:statement/P4952"--> c3
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
f1[["(bound(?v995) || )"]]
subgraph f1e0["Exists Clause"]
e0v1 --"a"--> e0c2
e0v1("?statement"):::projected
e0c2(["p:novalue/P995"]):::iri
end
f1--EXISTS--> f1e0
f1 --> v3
f1 --> v2
f1 --> c4
f1 --> c5
v2 --"a"--> c5
f2[["(bound(?v994) || )"]]
subgraph f2e1["Exists Clause"]
e1v1 --"a"--> e1c2
e1v1("?statement"):::projected
e1c2(["p:novalue/P994"]):::iri
end
f2--EXISTS--> f2e1
f2 --> v4
f2 --> v2
f2 --> c4
f2 --> c6
v2 --"a"--> c6
f3[["(bound(?v993) || )"]]
subgraph f3e2["Exists Clause"]
e2v1 --"a"--> e2c2
e2v1("?statement"):::projected
e2c2(["p:novalue/P993"]):::iri
end
f3--EXISTS--> f3e2
f3 --> v5
f3 --> v2
f3 --> c4
f3 --> c7
v2 --"a"--> c7
f4[["(bound(?v877) || )"]]
subgraph f4e3["Exists Clause"]
e3v1 --"a"--> e3c2
e3v1("?statement"):::projected
e3c2(["p:novalue/P877"]):::iri
end
f4--EXISTS--> f4e3
f4 --> v6
f4 --> v2
f4 --> c4
f4 --> c8
v2 --"a"--> c8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P877".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P993".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P994".-> v4
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P995".-> v3
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end