Lucas_Werkmeister_WMDE added a comment.

  In T222861#5173282 <https://phabricator.wikimedia.org/T222861#5173282>, 
@Smalyshev wrote:
  
  > Where constraint violation level is specified? If it's a property of 
constraint itself, there should be a way to query it already. Or is it stored 
outside the constraint statement? I am not completely familiar with this part, 
would appreciate explanations or reference to the docs.
  
  
  🤦 you’re completely right, it’s a property of the constraint (constraint 
status <https://www.wikidata.org/wiki/Property:P2316> qualifier on the 
constraint statement) and therefore can be queried. No idea why I didn’t 
realize that before. @Harmonia_Amanda, I think what you need is this:
  
    SELECT ?property ?propertyLabel ?constraintTypeLabel ?item ?itemLabel WHERE 
{
      ?item ?linksTo wd:Q38108;
            ?p ?statement.
      ?statement wikibase:hasViolationForConstraint ?constraint.
      ?property wikibase:claim ?p;
                p:P2302 ?constraint.
      ?constraint ps:P2302 ?constraintType.
      MINUS { ?constraint pq:P2316 wd:Q62026391. }
      SERVICE wikibase:label { bd:serviceParam wikibase:language 
"[AUTO_LANGUAGE],en". }
    }
    ORDER BY ?property
  
  Try it! 
<https://query.wikidata.org/embed.html#SELECT%20%3Fproperty%20%3FpropertyLabel%20%3FconstraintTypeLabel%20%3Fitem%20%3FitemLabel%20WHERE%20{%0A%20%20%3Fitem%20%3FlinksTo%20wd%3AQ38108%3B%0A%20%20%20%20%20%20%20%20%3Fp%20%3Fstatement.%0A%20%20%3Fstatement%20wikibase%3AhasViolationForConstraint%20%3Fconstraint.%0A%20%20%3Fproperty%20wikibase%3Aclaim%20%3Fp%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20p%3AP2302%20%3Fconstraint.%0A%20%20%3Fconstraint%20ps%3AP2302%20%3FconstraintType.%0A%20%20MINUS%20{%20%3Fconstraint%20pq%3AP2316%20wd%3AQ62026391.%20}%0A%20%20SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22[AUTO_LANGUAGE]%2Cen%22.%20}%0A}%0AORDER%20BY%20%3Fproperty%20>

TASK DETAIL
  https://phabricator.wikimedia.org/T222861

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: abian, Smalyshev, Harmonia_Amanda, Lucas_Werkmeister_WMDE, Aklapper, 
Lea_Lacroix_WMDE, darthmon_wmde, alaa_wmde, Nandana, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Wikidata-bugs, 
aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to