check_constraints#

wikibaseintegrator.wbi_helpers.check_constraints(entity_id=None, claim_id=None, status=None, allow_anonymous=True, **kwargs)[source]#

Check the constraint violations of one or more entities or claims, using the target Wikibase instance’s own constraint checker (the wbcheckconstraints API module provided by the WikibaseQualityConstraints extension).

This relies entirely on the constraints configured on the Wikibase instance being queried (e.g. on Wikidata itself), rather than on a hardcoded or Wikidata-specific set of rules, so it works the same way against any Wikibase instance that has the extension installed. If the extension isn’t installed, the underlying API call will fail with a MWApiError.

Parameters:
  • entity_id (str | list[str] | None, default: None) – One or more entity IDs (item, property, lexeme, etc.) whose claims should be checked.

  • claim_id (str | list[str] | None, default: None) – One or more claim GUIDs to check, instead of checking whole entities.

  • status (list[str] | None, default: None) – Only return results with one of these statuses, e.g. ['violation']. By default, the API returns every status.

  • allow_anonymous (bool, default: True) – Allow anonymous interaction with the MediaWiki API. ‘True’ by default since this is a read-only action.

  • kwargs (Any) – Extra parameters for mediawiki_api_call_helper()

Return type:

dict

Returns:

The data returned by the API as a dictionary