query-bea7e2d9c17fc49ed880f07147ac77d6
Constraints with violations SELECT ?propLabel ?constraintLabel ?numViolations WHERE { { SELECT DISTINCT ?prop ?constraint (COUNT(?stmt) AS ?numViolations) WHERE { ?stmt wikibase:hasViolationForConstraint ?constraintStmt . ?prop p:P2302 ?constraintStmt . ?constraintStmt ps:P2302 ?constraint . } GROUP BY ?prop ?constraint } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?numViolations)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Constraints with violations
SELECT ?propLabel ?constraintLabel ?numViolations
WHERE {
{
SELECT DISTINCT ?prop ?constraint (COUNT(?stmt) AS ?numViolations)
WHERE
{
?stmt wikibase:hasViolationForConstraint ?constraintStmt .
?prop p:P2302 ?constraintStmt .
?constraintStmt ps:P2302 ?constraint .
}
GROUP BY ?prop ?constraint
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?numViolations)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?constraint")
v3("?constraintStmt")
v6("?numViolations"):::projected
v4("?prop")
v2("?stmt")
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wikibase:hasViolationForConstraint"--> v3
v4 --"p:P2302"--> v3
v3 --"p:statement/P2302"--> v5
bind1[/"count(?stmt)"/]
v2 --o bind1
bind1 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end