Constraint schema

From semantic-mediawiki.org
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 type 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.

Constraint schema[edit]

Semantic MediaWiki 3.1 introduced the Constraint2 class together with some schema types (PROPERTY_CONSTRAINT_SCHEMA3 and CLASS_CONSTRAINT_SCHEMA) 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 allowed namespaces
  • unique_value_constraint4 specifies that values should be unique across the wiki, that the value is likely to be different (distinct) from all other items
  • custom_constraint5 to be used to specify and implement custom constraints
  • non_negative_integer6 specifies that values need to be positive (including 0)

The declarative Constraint schema7 property 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 indicator8 is placed on top of an article that lists violations for those errors that were classified as constraint errors92.

See also[edit]

Extending constraints[edit]

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:3908
  5. ^  Semantic MediaWiki: GitHub pull request gh:smw:3966
  6. ^  Semantic MediaWiki: GitHub pull request gh:smw:3970
  7. ^  Semantic MediaWiki: GitHub pull request gh:smw:3829
  8. ^  Semantic MediaWiki: GitHub pull request gh:smw:3968
  9. ^  Semantic MediaWiki: GitHub pull request gh:smw:3792