Schema type PROPERTY CONSTRAINT SCHEMA

From semantic-mediawiki.org
< Help:Schema‎ | Type
SchemaSchema typesSchema type PROPERTY CONSTRAINT SCHEMA

This is the help page on schema type PROPERTY_CONSTRAINT_SCHEMA.1.

Objective

The PROPERTY_CONSTRAINT_SCHEMA schema type defines constraint definitions that can be assigned to a property 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 PROPERTY_CONSTRAINT_SCHEMA
  • constraints the section that contains constraints definitions
  • tags simple tags to categorize a schema

Example

{
    "type": "PROPERTY_CONSTRAINT_SCHEMA",
    "constraints": {
        ...
    },
    "tags": [
        "property constraint",
        "..."
    ]
}

Constraint properties

  • allowed_namespaces (array) specifies allowed namespaces
  • unique_value_constraint (boolean) specifies that values should be unique across the wiki, that the value is likely to be different (distinct) from all other items
  • single_value_constraint (boolean) specifies that the property expects only a single value per assigned entity
  • custom_constraint (object) specifies non-schema specific custom constraints implementations
  • non_negative_integer (boolean) specifies that values are derived from integer with the minimum inclusive to be 0
  • must_exists (boolean) specifies that the annotated value must exist to be valid

Extending constraints

Validation

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


See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3746