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
- https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/examples/constraint.schema.md "`single_value_constraint`" (boolean) specifies that the property expects only a single value per assigned entity
- https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/examples/register.custom.constraint.md "`custom_constraint`" (object) specifies non-schema specific custom constraints implementations
- https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/examples/constraint.schema.md "`non_negative_integer`" (boolean) specifies that values are derived from integer with the minimum inclusive to be 0
- https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/examples/constraint.schema.md "`must_exists`" (boolean) specifies that the annotated value must exist to be valid
Extending constraints
- General introduction on how to extend a https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/extending.constraint.md "constraint"
- How to register a https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/examples/register.custom.constraint.md "custom constraint" using the
custom_constraint
property
Validation
/data/schema/property-constraint-schema.v1.json