Hello all,
We started integrating the constraint violations into the Query
Service. That means you can build queries using the constraint
violations, with the predicate wikibase:hasViolationForConstraint
. This will hopefully help you to watch better the quality of Wikidata content.
Please note that this is a first step. Not all constraint violations are exposed yet, only the ones that can be checked fast enough. We're working on having more available in WDQS.
You can base your queries on these few examples:
#10 statements with constraint violations that are currently included
SELECT * WHERE {
?x wikibase:hasViolationForConstraint ?y.
} LIMIT 10
#Map/timeline/image grid of items that have a statement with a constraint violation
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?image ?coordinate_location ?point_in_time ?date_of_birth WHERE {
?s wikibase:hasViolationForConstraint ?y.
?item ?z1 ?s.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?item wdt:P18 ?image. }
OPTIONAL { ?item wdt:P625 ?coordinate_location. }
OPTIONAL { ?item wdt:P585 ?point_in_time. }
OPTIONAL { ?item wdt:P569 ?date_of_birth. }
}
#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
The modules included on the property talk pages, Module:Constraints, Module:Constraints/SPARQL etc. has been updated with a new query link (thanks Matěj!)
See also:
If you have any question, feel free to ping me.
--