query-4365f5a5f6e8cde9f073333cc8faaada
Eliminating items where a property is set to "no value" 13:41, 30 June 2022 (UTC)) talk (Vicarage (P289)vessel class when I ask for frigates operated by Royal Navy without (Q11861579)HMS Newcastle When running a query for items without a property, it still reports those where I've set the property to "no_value" in the GUI editor. How can I eliminate them too? eg for 14:02, 30 June 2022 (UTC) pagetalk / TomT0m author I’m curious about why you would like to put a no value in such a case however ? } minus { ?statement a wdno:P289 . } ?item p:P289 ?statement . minus { … In principle, the solution is to do something like could you handle the sparql query resulting of the query editor ?Vicarage@I've tried
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item WHERE {
?item p:P31 ?statement0.
?statement0 ps:P31 wd:Q161705.
?item p:P137 ?statement1.
?statement1 (ps:P137/(wdt:P279*)) wd:Q172771.
minus {
?item p:P289 ?statement .
minus { ?statement a wdno:P289 . }
}
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v4("?statement")
v2("?statement0")
v3("?statement1")
a1((" "))
c7(["wd:Q161705"]):::iri
c14(["p:novalue/P289"]):::iri
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;"]):::literal
c11(["wd:Q172771"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"p:P31"--> v2
v2 --"p:statement/P31"--> c7
v1 --"p:P137"--> v3
v3 --"p:statement/P137"--> a1
a1 --"p:direct/P279"--> c11
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:P289"--> v4
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v4 --"a"--> c14
end
end