Wikidata talk:WikiProject property constraints

From Wikidata
Jump to navigation Jump to search
On this page, old discussions are archived after 60 days. An overview of all archives can be found at this page's archive index. The current archive is located at Wikidata talk:WikiProject property constraints/Archive 2.

Multiple value type constraint relations?[edit]

At this time we have as possible relations for value type constraints in a property only "instance of", "subclass of" and "instance of or subclass of", so we always have only one "value type constraint" statement in the property. What does happen if we add another relation, and thus another "value type constraint" statement? In the case this could prove useful, the item has to satisfy BOTH constraints or AT LEAST one of the two? --Ogoorcs (talk) 12:13, 21 July 2018 (UTC)

@Ogoorcs: If multiple constraints are defined, they are always checked independently of each other, so if you add multiple value type constraints, violations for either or both of them will be reported independently (there will be constraint violations if at least one of them is not satisfied). There are already a few properties with multiple value type constraints, e. g. office held by head of state (P1906) (query). --Lucas Werkmeister (WMDE) (talk) 11:58, 23 July 2018 (UTC)
I guess that this AND default is the reason we have only three type of constraint: one for P31, one for P279 and one that check for the presence of at least one of the two, so an OR. Are there any plans to add OR constraints for properties different from P31 and P279? There are items that need them in order to correct "potential errors" about their properties, like Tomb of the Diver (Q464384), which needs collection (P195). --Ogoorcs (talk) 22:47, 24 July 2018 (UTC)

Constraint errors[edit]

There is a constraint error at Property talk:P3896 for Commons link constraint (Q21510852). Is there a different constraint which is applicable to geoshape (P3896)? Jc86035 (talk) 15:55, 1 August 2018 (UTC)

format constraint (Q21502404). Matěj Suchánek (talk) 07:02, 2 August 2018 (UTC)
@Matěj Suchánek: That also results in an error. Jc86035 (talk) 20:10, 2 August 2018 (UTC)
It shouldn't anymore. Matěj Suchánek (talk) 07:05, 3 August 2018 (UTC)
Should cCommonsLinkapplicable also contain geo-shape and tabular-data? I think it'd be appropriate since they both generate Commons links. Jc86035 (talk) 09:24, 3 August 2018 (UTC)
This constraint is used on properties like Commons category (P373), Commons Creator page (P1472) etc. which don't include the namespace prefix in the value. But geoshape (P3896), weather history (P4150) etc. do include it. So if this isn't problem, the suggested change can be applied. Matěj Suchánek (talk) 09:29, 3 August 2018 (UTC)

Unrelated, but presently it appears that citation needed constraint (Q54554025) and one-of qualifier value property constraint (Q52712340) are not being accepted as valid constraints for some reason (an error is showing on Property talk:P5523). Jc86035 (talk) 16:12, 1 August 2018 (UTC)

Module:Constraints needs to be updated. Matěj Suchánek (talk) 19:57, 1 August 2018 (UTC)
Added citation needed constraint (Q54554025). The other one is not sufficiently documented. Matěj Suchánek (talk) 07:02, 2 August 2018 (UTC)

You can now query the constraint violations with the Query Service[edit]

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 included
SELECT * WHERE {
?x wikibase:hasViolationForConstraint ?y.
} LIMIT 10

Try it!

#Map/timeline/image grid of items that have a statement with a constraint violation
#defaultView:Map
SELECT 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. }
}

Try it!

#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_ofLabel
ORDER BY DESC(?count)
LIMIT 30

Try it!

The modules included on the property talk pages, Module:Constraints, Module:Constraints/SPARQL etc. has been updated with a new query link (thanks Matěj!)

See also:

If you have any question, feel free to ping me. Lea Lacroix (WMDE) (talk) 10:43, 3 August 2018 (UTC)

Distinct best value constraint?[edit]

@Lucas Werkmeister (WMDE), Ivan A. Krestinin:

As some identifiers get re-assigned, should we create a constraint for this? Within values with best rank, each value should be unique. Items that no longer have a value (old value has an end date), would get "no value" with preferred rank.

It can be compared with Help:Property constraints portal/Single best value created recently.
--- Jura 15:21, 11 August 2018 (UTC)

Single value constraint[edit]

Spotify track ID (P2207) currently has single value constraint (Q19474404). Is it possible to require a part of (P361) qualifier if there is more than one value? Jc86035 (talk) 09:13, 13 August 2018 (UTC)

@Jc86035: would adding part of (P361) as a separator (P4155) achieve what you want? See Help:Property constraints portal/Single value for details. --Lucas Werkmeister (WMDE) (talk) 10:52, 13 August 2018 (UTC)
@Lucas Werkmeister (WMDE): I think so, thanks. Jc86035 (talk) 10:54, 13 August 2018 (UTC)

as main value (Q54828448) and category contains (P4224) or is a list of (P360)[edit]

@Lucas Werkmeister (WMDE), Ivan A. Krestinin, Matěj Suchánek:

A problem with "as main value (Q54828448)" is that most properties could be used as qualifiers for category contains (P4224) or is a list of (P360).

These properties are not necessarily useful as qualifiers elsewhere.

Maybe these could be whitelisted as the use with Wikidata property example (P1855).
--- Jura 22:18, 20 August 2018 (UTC)

@Jura1: the whitelist you mention means that we don’t check any constraints on qualifiers of Wikidata property example (P1855) and related properties, because the “Wikidata property example” properties all twist the data model around in a way where qualifiers don’t really mean what they usually mean… technically, it wouldn’t be a problem to add more properties to that list (Matěj Suchánek just added the two new example properties for senses and forms in gerrit:449017), but I’m not convinced that’s necessary. Is it really true that almost any property can be used as qualifiers for those two properties? Can you perhaps show a few examples? Because I don’t yet see how that would make sense. --Lucas Werkmeister (WMDE) (talk) 12:24, 21 August 2018 (UTC)
  • I don't think all other checks should be de-activated as well. Samples: Q9695035, Q23044622. It does concern mainly item-datatype properties, but not exclusively.
    --- Jura 12:35, 21 August 2018 (UTC)

Better suggestions for constraint values on properties[edit]

Hello all,

Currently, when adding a new value in the constraints section of a property, there is no suggestion to fill the value or the qualifier. We’ve been improving this by a few changes that are going to be deployed this week.

  • When adding a new value in the property constraint statement, a list of suggestions will be displayed and, all the relevant constraint items will be showed first. They will be selected among the list of qualifiers present in the statement “property constraint -> one of constraint” of property constraint (P2302).
  • Of course, you can still type anything you want in the field to find a value. The full text search has been improved (when typing “none constr” you will also see “none of constraint” in the suggester)

In a very near future, we will also make the following happen:

  • Same behavior for qualifiers inside the constraint statements. The suggester will pick up the values from “allowed qualifiers constraint”
  • When clicking on “add value” in the property constraint statement, a suggester menu will directly appear (without having to click on the value field)

The first two changes will appear on wikidata.org on August 30th, the following ones in the next weeks. Feel free to make some tests, and let us know if you find a bug or something that doesn’t behave as expected.

Related tickets: phab:T199672, phab:T201288.

Thanks, Lea Lacroix (WMDE) (talk) 13:03, 28 August 2018 (UTC)