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 includedSELECT * WHERE {?x wikibase:hasViolationForConstraint ?y.} LIMIT 10
#Map/timeline/image grid of items that have a statement with a constraint violation#defaultView:MapSELECT 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_ofLabelORDER BY DESC(?count)LIMIT 30
The modules included on the property talk pages, Module:Constraints https://www.wikidata.org/wiki/Module:Constraints, Module:Constraints/SPARQL https://www.wikidata.org/wiki/Module:Constraints/SPARQL etc. has been updated with a new query link (thanks Matěj!)
See also:
- the adding to the ontology https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/449329/1/docs/ontology.owl - the Phabricator ticket https://phabricator.wikimedia.org/T192567, if you have any issue to report
If you have any question, feel free to ping me.
Nice, I put it to use [0,1].
Question, what if the WDQS has a wikisource export format, allowing me to copy/paste output easily as table in a Wikidata page? Is something like that already possible? (Alternatively, maybe the Listeria bot can handle this much better, but I still have to learn how to use that properly...)
Egon
0.https://twitter.com/egonwillighagen/status/1030732574220582912 1.https://twitter.com/egonwillighagen/status/1030737717095788544
On Fri, Aug 3, 2018 at 12:44 PM Léa Lacroix lea.lacroix@wikimedia.de wrote:
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 includedSELECT * WHERE {?x wikibase:hasViolationForConstraint ?y.} LIMIT 10
#Map/timeline/image grid of items that have a statement with a constraint violation#defaultView:MapSELECT 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_ofLabelORDER BY DESC(?count)LIMIT 30
The modules included on the property talk pages, Module:Constraints https://www.wikidata.org/wiki/Module:Constraints, Module:Constraints/SPARQL https://www.wikidata.org/wiki/Module:Constraints/SPARQL etc. has been updated with a new query link (thanks Matěj!)
See also:
- the adding to the ontology
https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Wikibase/+/449329/1/docs/ontology.owl
- the Phabricator ticket https://phabricator.wikimedia.org/T192567,
if you have any issue to report
If you have any question, feel free to ping me.
Léa Lacroix Project Manager Community Communication for Wikidata
Wikimedia Deutschland e.V. Tempelhofer Ufer 23-24 10963 Berlin www.wikimedia.de
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter der Nummer 23855 Nz. Als gemeinnützig anerkannt durch das Finanzamt für Körperschaften I Berlin, Steuernummer 27/029/42207. _______________________________________________ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata