query-ffd570b40870a5141be62e0e7a53d81e
Ideally, a lot of this page could be replaced by a query along the lines of:
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?country ?countryLabel ?item ?itemLabel ?level ?expected ?found ?samenumber
WHERE {
{
SELECT ?item ?expected ?country ?level (COUNT(DISTINCT ?place) AS ?found) {
?item wdt:P279* ?acs ; wdt:P17 ?country.
FILTER NOT EXISTS { ?country wdt:P576 [] }
?acs p:P279 [ ps:P279 wd:Q1799794 ; pq:P1545 ?level ] .
OPTIONAL { ?item wdt:P1114 ?expected }
OPTIONAL {
?place p:P31 ?placeStatement .
?placeStatement ps:P31 ?item.
FILTER NOT EXISTS { ?placeStatement wdt:P582 [] }
}
}
GROUP BY ?item ?expected ?country ?level
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
BIND(IF(?expected = ?found, "✓", "✘") AS ?samenumber).
}
ORDER BY ?countryLabel ?level DESC(?expected) ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?acs")
v6("?country"):::projected
v1("?countryLabel"):::projected
v3("?expected"):::projected
v10("?found"):::projected
v7("?item"):::projected
v4("?itemLabel"):::projected
v2("?level"):::projected
v9("?place")
v5("?placeStatement")
v11("?samenumber"):::projected
a2((" "))
a1((" "))
a3((" "))
c13(["bd:serviceParam"]):::iri
c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c6(["wd:Q1799794"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P576"--> e0a1
e0v1("?country"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v6
f0 --> c2
f0 --> a2
v6 --"p:direct/P576"--> a2
v7 --"p:direct/P279"--> v8
v7 --"p:direct/P17"--> v6
a3 --"p:statement/P279"--> c6
a3 --"p:qualifier/P1545"--> v2
v8 --"p:P279"--> a3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P1114".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:P31".-> v5
v5 --"p:statement/P31"--> v7
end
bind2[/"count(?place)"/]
v9 --o bind2
bind2 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
bind3[/"if(?expected = ?found,'✓','✘')"/]
v3 --o bind3
v10 --o bind3
bind3 --as--o v11