Help:Schema

From semantic-mediawiki.org
Help:SchemaSchema/Type

Placeholder12

Objective

The objective of the SMW_NS_SCHEMA (aka Schema) namespace is to allow for a structured definition of different schemata where types define the interpreter, syntax elements, and 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 validator_schema (see JSON schema) may be assigned to a type to help enforce requirements and constraints for a specific type.

The following properties are provided to make elements of a schema definition discoverable.

  • Schema type (_SCHEMA_TYPE )
  • Schema definition (_SCHEMA_DEF)
  • Schema description (_SCHEMA_DESC)
  • Schema tag (_SCHEMA_TAG)
  • Schema link (_SCHEMA_LINK)

Registration

Extensibility for new schema types and interpreters is provided by adding a new type to the $smwgSchemaTypes setting.

$GLOBALS['smwgSchemaTypes'] = [
    'LINK_FORMAT_SCHEMA' => [
        'validator_schema => __DIR__ . '/data/schema/...',
        'group' => SMW_SCHEMA_GROUP_FORMAT,
    ]
];

Available schema types

Technical notes

SMW\Schema
│   │
│   ├─ Schema
│   ├─ SchemaDefinition
│   ├─ SchemaFactory
│   └─ SchemaValidator
│
SMW\MediaWiki
    └─ Content
        ├─ SchemaContent
        ├─ SchemaContentFormatter
        └─ SchemaContentHandler


See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3019
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:3431