Page MenuHomePhabricator

Add API to return violations in TTL (turtle) format
Closed, ResolvedPublic

Description

We should add API which will return RDF (probably TTL) data in the following format:

wds:Q43$66E13CA3-37CB-4B14-9F53-311D9C91D822 wikibase:hasViolationForConstraint wds:P17$a02094d5-46fc-bb86-81d1-21cfea688dfe .
wds:q43$43124bad-4210-425f-5a0f-56e86c922055 wikibase:hasViolationForConstraint wds:P17$f2713cbe-499d-36e8-0a3a-c275a356b659 .

etc. etc. for each constraint violation. The left side is the statement violating the constraint, the right side is the statement on property that defines the constraint.

So far the easiest way seems to be to add action API, e.g.: https://wikidata-constraints.wmflabs.org/index.php/Item:Q5?action=constraintsrdf

Event Timeline

Tricky part here may be that wbcheckconstraints is an API module, and make it return TTL may be non-trivial. We could of course wrap it inside JSON but that looks just wrong. Maybe we should use something like ?action=rdfConstraints instead?

Smalyshev renamed this task from Add wbcheckconstraints parameter to return violations in TTL (turtle) format to Add API to return violations in TTL (turtle) format.May 19 2018, 12:27 PM
Smalyshev updated the task description. (Show Details)

Question: should we have different predicates for different types of violations, like mandatory, warning, etc.?

No, that can be inferred from the constraint statement itself (whether it has a “constraint status: mandatory constraint” or not).

Change 433964 had a related patch set uploaded (by Smalyshev; owner: Smalyshev):
[mediawiki/extensions/WikibaseQualityConstraints@master] [WIP] [DNM] Export constraint check results to RDF

https://gerrit.wikimedia.org/r/433964

The patch has DNM and WIP in it. Is it should stay in "needs review" column of MOM board?

I think the patch is a lot less WIP now – it still has one TODO as far as I recall (select output format), but apart from that I think it could be ready. Good enough to review at least, IMHO, and see what others think.

I'll update it soon, just didn't have time to look into it yet.

Change 433964 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Export constraint check results to RDF

https://gerrit.wikimedia.org/r/433964

This is very cool to find existing constraint violations! A great next step would be a service to test if a not yet existing statement would raise any violations! Is there a ticket for the constraint API to test not yet existing statements?

Lea_Lacroix_WMDE moved this task from Test (Verification) to Done on the Wikidata-Campsite board.
Lea_Lacroix_WMDE subscribed.

Closed on behalf of Lydia

Vvjjkkii renamed this task from Add API to return violations in TTL (turtle) format to 9wcaaaaaaa.Jul 1 2018, 1:10 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Lucas_Werkmeister_WMDE as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from 9wcaaaaaaa to Add API to return violations in TTL (turtle) format.Jul 2 2018, 5:18 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.