Schema type PROPERTY GROUP SCHEMA

From semantic-mediawiki.org
< Help:Schema‎ | Type
SchemaSchema typesSchema type PROPERTY GROUP SCHEMA
Table of Contents


PROPERTY_GROUP_SCHEMA is a schema type1 which allows you to define property groups. Once the schema is set up, each property listed in the group is automatically annotated with the special property "Is property group"Marks a category for holding properties belonging to a property group.

This schema-based method of managing property groups is a simple alternative to the category-based approach. The latter requires that you create a category, add the special property "Is property group"Marks a category for holding properties belonging to a property group to that category and finally, add the category to each relevant property. Note that where a property is accidentally assigned through both methods, the category-based approach takes precedence over any group definition found in PROPERTY_GROUP_SCHEMA.

Objective[edit]

The PROPERTY_GROUP_SCHEMA schema type defines property groups that help structure the browsing interface of a page.

Structure[edit]

The structure of this schema is defined by the following properties:

  • type – defindes the schema type
  • manifest_version – sets the version of the schema type
  • description – describes the entire group schema
  • groups – identifies the section that contains group definitions
    • ..._group – identifies an individual group (the name has to end with "_group")
      • canonical_name – sets the canonical lable for the group
      • message_key – sets a system message key that can be used for translation and replaces the canonical label for the group if specified
      • property_keys – sets the property keys assigned to the group
  • tags – sets simple tags to categorize a schema

Example[edit]

{
    "type": "PROPERTY_GROUP_SCHEMA",
    "description": "This property group schema serves as an example on how to structure it.",
    "groups": {
        "x_group": {
            "canonical_name": "My properties X",
            "message_key": "smw-property-group-label-...",
            "property_keys": [
                "MY_PROPERTY_XA",
                "MY_PROPERTY_XB"
            ]
        },
        "y_group": {
            "canonical_name": "My properties Y",
            "message_key": "smw-property-group-label-...",
            "property_keys": [
                "MY_PROPERTY_Y"
            ]
        }
    },
    "tags": [
        "group",
        "property groups",
        "example",
        "example group"
    ]
}
Further live examples

Validation[edit]

The structure of this schema is validated by the following definition file for the schema structure: Octocat.png"property-group-schema.v1.json"

Notes[edit]

When grouping predefined properties provided by extension "Semantic Extra Special Properties"Adds some extra special properties to all pages the internal property keys ("id") need to be used. See the Octocat.png"definitions.json" file for the properties and their respective internal keys ("id"), e.g. ___REVID for special property "Revision ID".2


When grouping user-defined properties, i.e. properties created on wiki, the name of the property needs to be used. However spaces within the property name need to be replaced with underscores to get the property key, e.g. property "Has status code" needs to be added as "Has_status_code".

The underlying schema changed between it's initial release with Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x. and Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x..34 Thus you need to migrate existing schemas to the new structure. See the link to an example for the migration provided below.

Version history[edit]

See also[edit]


References

  1. a b  Semantic MediaWiki: GitHub pull request gh:smw:3749
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:4597
  3. a b  Semantic MediaWiki: GitHub pull request gh:smw:4045
  4. a b  Semantic MediaWiki: GitHub pull request gh:smw:4592