/model/
Description
Models will create Templates and Categories. They define the actual structure of the development model.
Models declare
- Which models they inherit from
- Which fields are used
- The order of the fields
- Mandatory and recommended fields
- The template “rendering” mode (table, unordered lists, …)
- If they are stored as regular semantic properties or a subobject
- MediaWiki Categories
- Prepend and append wikitext
Available Properties
ID | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
$abstract | If true this object is only used for inheritance and will not be created by itself. Type(s): boolean Specific to: intermediary Default: false Example:
|
||||||||
$extend | This includes and extends another file of the development. Type(s): arraystring Specific to: intermediary Example:
Example:
Example:
|
||||||||
$ignore | If true, this file will be ignored completely. Type(s): boolean Specific to: intermediary Default: false Example:
|
||||||||
$remove | Array, containing the IDs of all items/properties to remove from current object. Type(s): array Specific to: intermediary Example:
|
||||||||
description | General Description. Fields may use them as tooltips, forms can display a small description box. This depends on the used template. Type(s): string Specific to: domain Example:
|
||||||||
items | The items property contains an array of all fields that are used by the model. Fields usually should be implemented using $extend, so every field can have its own file and inheritance. It is possible to overwrite properties from the field directly in the mode. Type(s): arrayobject Specific to: domain Default: {} Example:
|
||||||||
itemsOrder | In case that fields have been inherited, they might not end up in the correct order. Type(s): array Specific to: domain Example:
Example:
|
||||||||
recommended | Array of fields that should be marked as recommended (complementary to mandatory). Type(s): array Specific to: domain Example:
|
||||||||
required | Array containing the IDs of all required fields. Type(s): array Specific to: domain Example:
|
||||||||
showForm | If true the template/model will be hidden in the form view. This will usually be declared in the forms by adding this after the model $extend. Type(s): boolean Specific to: domain Default: true Example:
|
||||||||
showPage | If true the template/model will be hidden in the page view. This will usually be declared in the forms by adding this after the model $extend. Type(s): boolean Specific to: domain Default: true Example:
|
||||||||
smw_append | Adds a append wikitext to forms and models. Type(s): objectstring Specific to: implementation Example:
Contains:
|
||||||||
smw_appendCategory | Wikitext to append on the category page Type(s): string Specific to: implementation Example:
|
||||||||
smw_appendForm | Appends wikitext only to forms (edit-view). Can either be a string or an object for more advanced features. (auto-generate headers, inject templates or add arbitrary wikitext) Type(s): objectstring Specific to: implementation Contains:
|
||||||||
smw_appendPage | Appends wikitext only to templates (page-view). Can either be a string or an object for more advanced features (auto-generate headers, inject templates or add arbitrary wikitext) Type(s): objectstring Specific to: implementation Contains:
|
||||||||
smw_categories | Array of additional categories the template should set. Type(s): array Specific to: platform Example:
|
||||||||
smw_category | If true, the models template will assign a category. The name of the category is the model ID. Type(s): boolean Specific to: platform Default: true Example:
|
||||||||
smw_display | Defines the template output rendering mode, whether the template should use tables, ul, etc. Type(s): string Specific to: platform Default: "table" Example:
|
||||||||
smw_prepend | Prepends wikitext to both forms and templates. Can either be a string or an object for more advanced features (auto-generate headers, inject templates or add arbitrary wikitext). Type(s): objectstring Specific to: implementation Example:
Example:
Contains:
|
||||||||
smw_prependCategory | Wikitext to prepend on the category page Type(s): string Specific to: implementation Example:
|
||||||||
smw_prependForm | Prepends wikitext only to forms (edit-view). Can either be a string or an object for more advanced features (auto-generate headers, inject templates or add arbitrary wikitext) Type(s): objectstring Specific to: implementation Contains:
|
||||||||
smw_prependPage | Prepends wikitext only to templates (page-view). Can either be a string or an object for more advanced features (auto-generate headers, inject templates or add arbitrary wikitext) Type(s): objectstring Specific to: implementation Contains:
|
||||||||
smw_set | Contains a set (object) of additional #set properties. Type(s): object Specific to: platform Example:
|
||||||||
smw_subobject | If true, this models attributes will be created as subobjects. Type(s): boolean Specific to: platform Default: false Example:
|
||||||||
smw_subobjectExtend | Contains a set (object) of additional #subobject properties. Type(s): object Specific to: platform Example:
|
||||||||
title | Human readable title. Type(s): string Specific to: domain Example:
|
||||||||
todo | If TODO notes are placed here, mobo can print them in the CLI (If the corresponding global setting is enabled). Type(s): string Specific to: domain |
||||||||
type | Defines the data-type. Type(s): string Specific to: domain Valid entries: string, number, boolean, array, object Example:
|
Annotated Examples
Model inheritance
/model/_Shape.json
# Abstract model. Will not be created on the target wiki.
$abstract: true
title: Shape
description: Generic Shape
# A shape model consists of two fields.
items:
- $extend: /field/x
- $extend: /field/y
required:
- x
- y
/model/Circle.json
$extend: /model/_Shape
title: Circle
# Addes the radius field
items:
- $extend: /field/radius
# Add radius to the required array
required:
- radius
In this example the Circle inherits all attributes of _Shape
, especially the fields x and y.
The Circle overwrites attributes like title
and introduces a new field radius
.