v3.1.0+
| Status: | effective |
| Progress: | 100% |
| Version: | 3.1.0+ |
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
typedefines the type and is fixed toPROPERTY_CONSTRAINT_SCHEMAconstraintsthe section that contains constraints definitionstagssimple tags to categorize a schema
Example
{
"type": "PROPERTY_CONSTRAINT_SCHEMA",
"constraints": {
...
},
"tags": [
"property constraint",
"..."
]
}
Constraint properties
allowed_namespaces(array) specifies allowed namespacesunique_value_constraint(boolean) specifies that values should be unique across the wiki, that the value is likely to be different (distinct) from all other itemssingle_value_constraint(boolean) specifies that the property expects only a single value per assigned entitycustom_constraint(object) specifies non-schema specific custom constraints implementationsnon_negative_integer(boolean) specifies that values are derived from integer with the minimum inclusive to be 0must_exists(boolean) specifies that the annotated value must exist to be valid
Extending constraints
- General introduction on how to extend a constraint
- How to register a custom constraint using the
custom_constraintproperty
Validation
/data/schema/property-constraint-schema.v1.json
See also[edit]
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:3746