query-95cd4ce35407062edf9638329dd32300
Select all municipalities that are ONLY previous (and dont have the Q70208)
SELECT DISTINCT ?item ?itemLabel
{
{ ?item wdt:P31 wd:Q70208 . } UNION
{ ?item wdt:P31 wd:Q685309 . }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q70208 . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de" }
}
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 all municipalities that are ONLY previous (and dont have the Q70208)
SELECT DISTINCT ?item ?itemLabel
{
{ ?item wdt:P31 wd:Q70208 . } UNION
{ ?item wdt:P31 wd:Q685309 . }
FILTER NOT EXISTS { ?item wdt:P31 wd:Q70208 . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
c3(["wd:Q685309"]):::iri
c5(["bd:serviceParam"]):::iri
c2(["wd:Q70208"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en,de"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?item"):::projected
e0c2(["wd:Q70208"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> c2
v1 --"wdt:P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end