query-98fed0b79f6bd7ecf2ad9717b16f11d9
Select all items in a region without Country SELECT ?item ?itemLabel ?itemDescription ?city ?cityLabel ?locatie ?locatieLabel ?country ?countryLabel ?instance ?instanceLabel ?streekLabel ?geolocatie ?layer ?article WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,fr,de,en,es,it,no,se,fi". } ?item wdt:P131 ?city; wikibase:sitelinks ?layer. ?city wdt:P706 wd:Q1882768, ?streek. MINUS { ?item wdt:P17 ?country. } OPTIONAL { ?item wdt:P31 ?instance. } OPTIONAL { ?item wdt:P276 ?locatie. } OPTIONAL { ?item wdt:P625 ?geolocatie. } OPTIONAL { ?article schema:about ?item; schema:inLanguage "nl"; schema:isPartOf https://nl.wikipedia.org/. } } 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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Select all items in a region without Country
SELECT ?item ?itemLabel ?itemDescription ?city ?cityLabel ?locatie ?locatieLabel ?country ?countryLabel ?instance ?instanceLabel ?streekLabel ?geolocatie ?layer ?article WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,fr,de,en,es,it,no,se,fi". }
?item wdt:P131 ?city;
wikibase:sitelinks ?layer.
?city wdt:P706 wd:Q1882768, ?streek.
MINUS { ?item wdt:P17 ?country. }
OPTIONAL { ?item wdt:P31 ?instance. }
OPTIONAL { ?item wdt:P276 ?locatie. }
OPTIONAL { ?item wdt:P625 ?geolocatie. }
OPTIONAL {
?article schema:about ?item;
schema:inLanguage "nl";
schema:isPartOf <https://nl.wikipedia.org/>.
}
}
ORDER BY (?itemLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?article"):::projected
v3("?city"):::projected
v6("?country"):::projected
v9("?geolocatie"):::projected
v7("?instance"):::projected
v2("?item"):::projected
v1("?itemLabel"):::projected
v4("?layer"):::projected
v8("?locatie"):::projected
v5("?streek")
c4(["#91;AUTO_LANGUAGE#93;,nl,fr,de,en,es,it,no,se,fi"]):::literal
c8(["wd:Q1882768"]):::iri
c2(["bd:serviceParam"]):::iri
c17([https://nl.wikipedia.org/]):::iri
c15(["nl"]):::literal
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v2 --"wdt:P131"--> v3
v2 --"wikibase:sitelinks"--> v4
v3 --"wdt:P706"--> c8
v3 --"wdt:P706"--> v5
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P17"--> v6
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P31".-> v7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P276".-> v8
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P625".-> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v10 -."schema:about".-> v2
v10 --"schema:inLanguage"--> c15
v10 --"schema:isPartOf"--> c17
end