Module talk:Constraints/SPARQL

From Wikidata
Jump to navigation Jump to search

WDQS intergration[edit]

Constraints have just been integrated into WDQS: mw:Wikibase/Indexing/RDF_Dump_Format#Constraints. Matěj Suchánek (talk) 07:11, 31 July 2018 (UTC)[reply]

tweak queries to return offending value not offending statement[edit]

@Lockal, Matěj Suchánek, Tacsipacsi, Pasleim, Zolo, Jura1: (I posted this on Phabricator but the issue was closed as invalid, and I agree it's more appropriate to discuss it here).

  • The SPARQL queries that expose constraint violations return the offending statement.
  • But the statement URL is opaque: it's more useful to return the offending value (eg one can use it to generate a QS script to remove offending values).

Eg for P2088 Distinct Values, I think we should change SPARQL (new) to this:

# Note: before https://phabricator.wikimedia.org/T201150 is fixed, the result will only be partial
SELECT DISTINCT ?item ?itemLabel ?value WHERE {
	?statement wikibase:hasViolationForConstraint wds:P2088-DD4CDCEA-B3F6-4F02-9CFB-4A9E312B73A8 .
	?item p:P2088 ?statement .
	?statement ps:P2088 ?value.
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
Try it!

Do you agree with such change? If so, I can make it at https://www.wikidata.org/wiki/Module:Constraints/SPARQL#L-768

--Vladimir Alexiev (talk) 06:52, 13 September 2021 (UTC)[reply]

It's fine by me. But phab:T274982 is still open. --Matěj Suchánek (talk) 09:55, 13 September 2021 (UTC)[reply]
@Vladimir Alexiev: Ok for me, as far as I'm concerned you can added improvements directly. Help:Property constraints portal/numbers/WQS is still quite low.
Maybe @MusikAnimal: wants to added something, as they seem to prefer that only admins edit it. --- Jura 09:24, 14 September 2021 (UTC)[reply]
I don't recall saying that? Wikidata:Requests for permissions/Bot/MusikBot II has been withdrawn. You can stop harassing me now. Thanks, — MusikAnimal talk 18:45, 14 September 2021 (UTC)[reply]

Type constraint with relation instance or subclass of (Q30208840)[edit]

Please check out this thread. Horcrux (talk) 12:08, 2 February 2024 (UTC)[reply]