/field/

Description

Fields are the mobo equivalent to SMW attributes.

The biggest difference to SMW attributes is that mobo fields already declare how they are rendered and validated. Those information are inherited through the models up to the final form.

Fields declare

  • A human readable title
  • An optional description
  • The datatype, consisting of type and format (see JSON Schema Spec)
  • Whether the field links to forms
  • Additional validation (some datatypes already come with validation)
  • Semantic Forms options that define how the field will render and behave in Semantic Forms

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:

$abstract: true
$extend

This includes and extends another file of the development.
Inheritance is applied, the children (the current file) overwrites the parent properties.

Type(s): arraystring

Specific to: intermediary

Example:

# Inherit a single parent
$extend: /model/_Shape

Example:

# Multiple parents are possible
$extend:
  - /field/fieldA
  - /field/fieldB

Example:

# extend is also used to import fields into models or models into forms.
title: A Model with two fields
items:
  - $extend: /field/fieldA
  - $extend: /field/fieldB
$ignore

If true, this file will be ignored completely.
Use this to temporarily remove parts of the development model without deleting them.

Type(s): boolean

Specific to: intermediary

Default: false

Example:

$ignore: true
$remove

Array, containing the IDs of all items/properties to remove from current object.

Type(s): array

Specific to: intermediary

Example:

$remove:
  - fieldA
  - fieldB
default

The default value. Applies only to fields.

Specific to: domain

deprecated

If true, the field will be marked as deprecated. It will not be displayed in forms, but the template will keep it in order to display old entries.

Type(s): boolean

Specific to: domain

Default: false

Example:

deprecated: true
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:

description: |
  Longer description of the current model part.
enum

List of all possible values.
Defaults to a dropdown widget.

Type(s): array

Specific to: domain

Example:

type: string
enum:
  - red
  - green
  - blue
form

Defines which form should be automatically used if the red link is clicked. It can link to one multiple forms.
When form it used, it implies: `type: string` and `format: Page`

Type(s): arraystring

Specific to: domain

Example:

form: formName

Example:

form:
  - formName1
  - formName2
format

Describes the semantic format (how to interpret the type). E.g. 'email' or SMW specific datatypes like 'Temperature'

Type(s): string

Specific to: domain

Valid entries: date, date-time, url, email, tel, Page, page, Code, code, geographic coordinate, Geographic coordinate, Quantity, quantity, Record, record, Temperature, temperature

Example:

type: string
format: email
items

Some fields have multiple values (e.g. comma seperated).
In this case the items property needs to be used.
The items object then defines the actual data type, format and form

Type(s): arrayobject

Specific to: domain

Default: {}

Example:

title: Tags
items:
  type: string
itemsOrder

In case that fields have been inherited, they might not end up in the correct order.
The itemsOrder array lists the order of the fields. Every field that is not listed will be appended at the bottom, in their regular order.

Type(s): array

Specific to: domain

Example:

itemsOrder:
  - brand
  - modelName

Example:

itemsOrder:
  - '@unique'
  - '@sorted'
  - b
  - c
  - a
  - b
maxItems

How many instances are allowed at most.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

maxLength

The maximum length of a string.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

maximum

The maximum value of a number.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

minItems

How many instances are required at least.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

minLength

The minimum length of a string.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

minimum

The minimum value of a number.

Type(s): number

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

pattern

Provides a Regular Expression (Regex) pattern to validate the field value.
This is currently not supported by Semantic Forms.

Type(s): string

Specific to: domain

Unsupported: This property is currently unsupported by the end-system.

Example:

pattern: '/^[\d]{4,5}/$'
sf_form

The sf_form property is an object that redirects all settings directly to Semantic Forms.
If no value is necessary (e.g. "existing values only"), use true. To see which options are supported, refer to the Semantic Forms manual.

Type(s): object

Specific to: platform

Example:

sf_form:
  input type: combobox
  values from namespace: Manufacturer
  max values: 1
  existing values only: true
sf_overwrite

Overwrites the final wikitext/HTML that is rendered in Semantic Forms Edit mode

Type(s): string

Specific to: implementation

showForm

Whether to display this element in the form-edit view.

Type(s): boolean

Specific to: domain

Default: true

Example:

showForm: false
showPage

Whether to display this element in the page view.

Type(s): boolean

Specific to: domain

Default: true

Example:

showPage: false
smw_appendFormField

Adds wikitext after the form input field. This is only displayed when the form is in edit mode.

Type(s): string

Specific to: implementation

Example:

smw_appendFormField: ' [[:Category:Location|...]]'
smw_arraymaptemplate

Name of the arraymap template to use.
Field needs to be of type `array`.

Type(s): string

Specific to: platform

Default: false

Example:

smw_arraymaptemplate: ArrayMapRemoveNamespaceTags
smw_drilldown

If the global settings `smw_semanticDrilldown` is enabled, fields with smw_drilldown set to true will be filterable.

Type(s): boolean

Specific to: platform

Default: false

Example:

smw_drilldown: true
smw_forceSet

Forces the semantic storage of the attribute through the #set parser function.
This is useful for #subobject models that want to expose one or more fields as regular #set properties.

Type(s): boolean

Specific to: platform

Default: false

Example:

smw_forceSet: true
smw_overwriteData

Overwrites the final #set or #subobject value of the field.
Is used similar to `smw_overwriteOutput`

Type(s): string

Specific to: implementation

smw_overwriteDisplay

Overwrites only the display value of the current field
Is used similar to `smw_overwriteOutput`.

Type(s): string

Specific to: implementation

smw_overwriteOutput

Overwrites the final value of the field, used for both display and data set

Type(s): string

Specific to: implementation

Example:

smw_overwriteOutput: '[[CustomNamespace:]]'

Example:

smw_overwriteOutput: '/subpath/{{{fieldId|}}}'
smw_overwriteOutputToLink

If true, this will create a link in display mode, using #formredlink if applicable.
This needs to be used together with `smw_overwriteOutput`.

Type(s): boolean

Specific to: platform

Example:

smw_overwriteOutput: 'CustomNamespace:'
smw_overwriteOutputToLink: true
smw_property

If smw_property is set to false the templates won't declare it as a semantic property. Please note that the field can't be queried then.

Type(s): boolean

Specific to: platform

Default: true

Example:

smw_property: false
title

Human readable title.

Type(s): string

Specific to: domain

Example:

title: Some title
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:

type: number

Supported Datatypes

Overview

Semantic MediaWiki mobo
Boolean type: boolean
Code type: string
format: Code
Date type: string
format: date
Email type: string
format: email
Geographic coordinate type: string
format: Geographic coordinate
Number type: number
Page type: string
format: Page
Quantity type: string
format: Quantity
Record type: string
format: Record
Telephone number type: string
format: tel
Temperature type: string
format: Temperature
Text type: text
URL type: string
format: url

Primitive Datatypes (type)

  • number / integer
  • boolean
  • string / text

To define a primitive datatype, just declare the type:

type: number

Semantic Datatypes (format)

Semantic Datatypes are defined through the format attribute. Usually the primitive type datatype is string.

  • JSON Schema data types
    • date / date-time
    • url
    • email
    • tel
  • SMW specific data types
    • Page
    • Code
    • Geographic coordinate
    • Quantity
    • Record
    • Temperature

To define a semantic data type, declare the format in addition to the "type":

type: string
format: date

Linking to Forms (form)

The form property can be used to reference to a form. This implicitly sets type to string and format to Page If the url links to a page that does not exist yet, it will be created through the defined form.

form: Location

It is also possible to link to multiple forms:

form:
  - FormA
  - FormB

Multiple values

Some fields need to specify multiple values. In this case the type needs to be set to array and the items property holds the actual type/format/form:

title: Locations

type: array
items:
    type: string
    form: Location