Semantic MediaWiki and related extensions
|
The objective of the SMW_NS_SCHEMA
(aka smw/schema
) namespace provides a structured definition space where different schemata types can be defined and that independently use a type specific interpreter, syntax elements, and possible constraints.
The namespace expects a JSON format (or if available, YAML as superset of JSON) as input format to ensure that content elements are structured and a validation_schema
(see JSON schema) can be assigned to help and enforce requirements and constraints for a specific type.
The following annotation properties are provided to make elements of a schema and its definition discoverable.
_SCHEMA_TYPE
)_SCHEMA_DEF
)_SCHEMA_DESC
)_SCHEMA_TAG
)_SCHEMA_LINK
)Extensibility for new schema types and interpreters is provided by adding a new type to the SchemaTypes::defaultTypes
setting or via the https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/technical/hooks/hook.schema.registerschematypes.md "`SMW::Schema::RegisterSchemaTypes`" hook.
$schemaTypes = [ 'FOO_SCHEMA' => [ 'group' => SMW_SCHEMA_FOO_GROUP, 'validation_schema => __DIR__ . '/data/schema/foo-schema.v1.json', ] ];
In the example above, FOO_SCHEMA
refers to the type name and any attributes assigned to that type will be used when constructing a schema instance. Types can define individual attributes that may be use exclusively by the type.
group
defines types belonging to the same schemata classvalidation_schema
links to the JSON schema expected to be used/src/Schema (SMW) │ ├─ Compartment │ ├─ CompartmentIterator │ ├─ Schema │ ├─ SchemaDefinition │ ├─ SchemaFactory │ ├─ SchemaValidator │ ├─ SchemaFilterFactory │ └─ SchemaFilter │ │ │ /src/Schema/Filters (SMW) │ ├─ CategoryFilter │ ├─ NamespaceFilter │ ├─ PropertyFilter │ /src/MediaWiki (SMW) └─ Content ├─ SchemaContent ├─ SchemaContentFormatter └─ SchemaContentHandler
https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Schema/docs/filter.md "Filter" conditions can be defined as aprt of a type to provide means to create conditional requirements.
As outlined above, the use of a JSON schema is an important part of a provided type to ensure that only specific data in an appropriate format can be stored and is validated against a normed vocabulary.