query-49a850a6f38db092dd958ad1e78cc45c
Non-specific offices, then our queries that populate the "infobox" on the Govdirectory site will return totally wrong results. Therefore, the following query should return zero results, or at least zero results for published countries. If you find other generic offices, add them to the values list in the query. (P2388)office held by head of the organization or (P1313)office held by head of government If an organization is using a generic value for
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 ?countryLabel WHERE {
VALUES ?bad_office {
wd:Q30185 # mayor
}
?item wdt:P2388|wdt:P1313 ?bad_office .
OPTIONAL { ?item wdt:P17 ?country }
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;
v1("?bad_office")
v3("?country")
v2("?item"):::projected
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?bad_office/]
bind0-->v1
bind00(["wd:Q30185"])
bind00 --> bind0
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P1313"--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P2388"--> v1
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P17".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end