Help:Constraint schema

From semantic-mediawiki.org
(Redirected from Help:Constraint schema)
Constraint schema
Shows constraint violation using the page indicator

A constraint defines a limitation or restriction of a value that can be assigned to a property or class hereby making it possible to shape1 its characteristics and the nature of the "fact" or claim.

The very first value restriction a user comes in contact is the definition of a datatype for a property to describe what a value literal is expected to represent such as a number, a date, a boolean, a page or a simple text.

Additional declarative properties are available to further restrict and describe characteristics of values including:

Yet, adding more of these properties would make maintenance (technical as well as organizational) difficult therefore a different approach has been introduced with Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x..

Constraint schema[edit]

Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x. introduced the "Constraint" class2 together with some schema types (PROPERTY_CONSTRAINT_SCHEMA schema3 and CLASS_CONSTRAINT_SCHEMA schema4) to codify and describe constraints using a more formalized and structured approach. Each of the mentioned type supports different properties that can be used to devise an individual schema that can shape a property or members of a class.

The more formalized approach is relying on a structured JSON format to define specific constraint characteristics and include things like:

  • allowed_namespaces3 specifies that values need to be a page in one of the allowed namespaces, i.e. values of datatype "Page"Holds names of wiki pages, and displays them as a link only.
  • must_exists5 specifies that values need to exist before it can be used as annotation element for a property, i.e. values of datatype "Page"Holds names of wiki pages, and displays them as a link only.
  • non_negative_integer6 specifies that values need to be positive (including 0)
  • shape_constraint7 specifies that a property is expected to have a certain "shape" such as: max_cardinality, property, property_type or min_textlength
  • single_value_constraint8 specifies that a property expects only a single value per entity
  • unique_value_constraint9 specifies that values should be unique across the wiki, that the value is likely to be different (distinct) from all other items
  • custom_constraint10 to be used to specify and implement custom constraints

The declarative special property "Constraint schema"Holds the name of a constraint schema which is not restricted to single constraint types11 was introduced to declare and assign one or more schemata to an instance of a property or category to describe constraint requirements of values for a specific instance.

To help users effectively identify and eliminate constraint violations, an indicator12 is placed on top of an article that lists violations for those errors that were classified as constraint errors132.

See also[edit]

For users and admins
For developers







References

  1. ^  https://www.w3.org/TR/shacl/
  2. a b  Semantic MediaWiki: GitHub pull request gh:smw:3830
  3. a b  Semantic MediaWiki: GitHub pull request gh:smw:3746
  4. ^  Semantic MediaWiki: GitHub pull request gh:smw:4033
  5. ^  Semantic MediaWiki: GitHub pull request gh:smw:3981
  6. ^  Semantic MediaWiki: GitHub pull request gh:smw:3970
  7. ^  Semantic MediaWiki: GitHub pull request gh:smw:4069
  8. ^  Semantic MediaWiki: GitHub pull request gh:smw:4010
  9. ^  Semantic MediaWiki: GitHub pull request gh:smw:3908
  10. ^  Semantic MediaWiki: GitHub pull request gh:smw:3966
  11. ^  Semantic MediaWiki: GitHub pull request gh:smw:3829
  12. ^  Semantic MediaWiki: GitHub pull request gh:smw:3968
  13. ^  Semantic MediaWiki: GitHub pull request gh:smw:3792