query-ef4dd40db59cd1651d82fb6237a84618
I want to exclude items from a query if an 'instance of' claim is included in a VALUES list., which isn't want I'm hoping for. OR condition rather than an AND a biblical figure. Apparently, the FILTER NOT EXISTS treats ?ignorableTypes as an OR(The actual list will come from a subquery, so I'd like to avoid using FILTER with a bunch of hard-coded || operators) Below is my stab at such a query where I'm hoping to omit Jane Austen if she is either a person
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?typeLabel
WHERE {
VALUES ?ignorableType {
wd:Q5
wd:Q20643955
}
VALUES ?item {
wd:Q36322
}
?item wdt:P31 ?type .
FILTER NOT EXISTS {?item wdt:P31 ?ignorableType}
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;
v3("?ignorableType")
v3("?item"):::projected
v3("?type")
c3(["bd:serviceParam"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0v2
e0v2("?ignorableType"):::projected
e0v1("?item"):::projected
end
f0--EXISTS--> f0e0
f0 --> v3
f0 --> c1
f0 --> v3
v3 --"wdt:P31"--> v3
bind1[/VALUES ?ignorableType/]
bind1-->v3
bind10(["wd:Q5"])
bind10 --> bind1
bind11(["wd:Q20643955"])
bind11 --> bind1
bind2[/VALUES ?item/]
bind2-->v3
bind20(["wd:Q36322"])
bind20 --> bind2
v3 --"wdt:P31"--> v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end