Help:Constraint schema

A constraint defines a limitation or restriction of a value that can be assigned to a property or class hereby making it possible to shapeCiteRef::w3c:shacl 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
introduced the CiteRef::gh:smw:3830 class together with some schema types ( CiteRef::gh:smw:3746 and  ) 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:


 * CiteRef::gh:smw:3746 specifies allowed namespaces
 * CiteRef::gh:smw:3981 specifies that values need to exist before it can be used as annotation element for a property (values of Page type only).
 * CiteRef::gh:smw:3970 specifies that values need to be positive (including 0)
 * CiteRef::gh:smw:4069 specifies that a property is expected to have a certain "shape" such as:,   or
 * CiteRef::gh:smw:4010 specifies that a property expects only a single value per entity
 * CiteRef::gh:smw:3908 specifies that values should be unique across the wiki, that the value is likely to be different (distinct) from all other items
 * CiteRef::gh:smw:3966 to be used to specify and implement custom constraints

The declarative CiteRef::gh:smw:3829 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 indicatorCiteRef::gh:smw:3968 is placed on top of an article that lists violations for those errors that were classified as constraint errorsCiteRef::gh:smw:3792CiteRef::gh:smw:3830.