query-7e03048265a20e6ba95ba5346e0da67a
Items with multiple values for a property, having some specified value, but excluding another SELECT ?item ?itemLabel WHERE {?item wdt:P31 ?class . ?item wdt:P17 wd:Q217 . ?item wdt:P131 wd:Q878317 . FILTER EXISTS { ?item wdt:P31 wd:Q532 } . MINUS { ?item wdt:P31 wd:Q4413925 } . SERVICE wikibase:label { bd:serviceParam wikibase:language "ro". } } ORDER BY ?itemLabel
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#>
#Items with multiple values for a property, having some specified value, but excluding another
SELECT ?item ?itemLabel WHERE
{?item wdt:P31 ?class .
?item wdt:P17 wd:Q217 .
?item wdt:P131 wd:Q878317 .
FILTER EXISTS { ?item wdt:P31 wd:Q532 } .
MINUS { ?item wdt:P31 wd:Q4413925 } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "ro". }
}
ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?class")
v2("?item"):::projected
v1("?itemLabel"):::projected
c2(["wd:Q532"]):::iri
c9(["bd:serviceParam"]):::iri
c4(["wd:Q217"]):::iri
c6(["wd:Q878317"]):::iri
c11(["ro"]):::literal
c7(["wd:Q4413925"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?item"):::projected
e0c2(["wd:Q532"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> c2
v2 --"wdt:P31"--> c2
v2 --"wdt:P31"--> v3
v2 --"wdt:P17"--> c4
v2 --"wdt:P131"--> c6
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P31"--> c7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end