Help:Schema/Type/CLASS CONSTRAINT SCHEMA

From semantic-mediawiki.org
< Help:Schema‎ | Type
SchemaSchema/TypeHelp:Schema/Type/CLASS CONSTRAINT SCHEMA

This is the help page on schema type CLASS_CONSTRAINT_SCHEMA.12.

Objective

The CLASS_CONSTRAINT_SCHEMA schema type defines constraint definitions that can be assigned to a class (aka. category) using the Constraint schema property.

Naming convention

To easily identify pages that contain a constraint schema it is suggested to use smw/schema:Constraint:... as naming convention.

Properties

  • type defines the type and is fixed to CLASS_CONSTRAINT_SCHEMA
  • constraints the section that contains constraints definitions
  • tags simple tags to categorize a schema

Example

{
    "type": "CLASS_CONSTRAINT_SCHEMA",
    "constraints": {
        ...
    },
    "tags": [
        "class constraint",
        "..."
    ]
}

Constraint properties

  • mandatory_properties (array) specifies mandatory properties
  • shape_constraint (array) specifies shapes of properties and dependent characteristics
    • property specifies the related property
    • property_type specifies expected type of the property
    • max_cardinality specifies the maximum number of values a property can contain for the given context
    • min_textlength specifies the minimum length of the characters expected for values assigned to the property
  • custom_constraint (object) specifies non-schema specific custom constraints implementations

Extending constraints

  • General introduction on how to extend a constraint in Semantic MediaWiki
  • How to register a custom constraint using the custom_constraint property

Validation

/data/schema/class-constraint-schema.v1.json


See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:4033
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:4032