< Help:Schema‎ | Type
SchemaSchema/TypeHelp:Schema/Type/CLASS CONSTRAINT SCHEMA

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


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.


  • 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


    "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



See also[edit]


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