query-333aa666a6623a9c5ac6f41ac552dbdf
TODO
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#>
#Bar chart of statements that have a constraint violation, grouped by instance of the regarding item:
#defaultView:BarChart
#TEMPLATE={ "template": { "en": "Bar chart of statements that have a constraint violation grouped by ?property the regarding item" }, "variables": { "?property": { "query":"SELECT ?id WHERE { VALUES ?id { wd:P31 wd:P17 wd:P571 wd:P361 wd:P19 } }" } } }
SELECT ?instance_ofLabel (COUNT(?instance_ofLabel) AS ?count) WHERE {
?s wikibase:hasViolationForConstraint ?y.
?item ?z1 ?s.
BIND(wdt:P31 AS ?property)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?item ?property ?instance_of. }
}
GROUP BY ?instance_ofLabel
ORDER BY DESC(?count)
LIMIT 30
Query found at
- https://www.wikidata.org/wiki/Wikidata:Project_chat/Archive/2018/08
- https://www.wikidata.org/wiki/Wikidata_talk:WikiProject_property_constraints/Archive_2
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?count")
v7("?instance_of")
v8("?instance_ofLabel"):::projected
v4("?item")
v6("?property")
v2("?s")
v3("?y")
v5("?z1")
c3(["bd:serviceParam"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wikibase:hasViolationForConstraint"--> v3
v4 -->v5--> v2
bind0[/"'wdt:P31'"/]
bind0 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -->v6--> v7
end
bind2[/"count(?instance_ofLabel)"/]
v8 --o bind2
bind2 --as--o v9