Help:Many-valued properties

From SUWS-wiki

A many-valued property maps between a subject and two or more values. This is distinct from the most common type of property, a binary property which maps between a single subject and a single value. A many-valued property cannot be split up into separate properties, because the set of values that it groups are all interconnected in some way.

Implementation in SMW 1.0

In Semantic MediaWiki 1.0, you can specify that a property takes multiple values by listing more than one type in its Property:Has type, separated by ; (semicolons).


Semantic search

You can search on many-valued properties similarly to other properties; see Help:Semantic search. As with any property, you can use the + wildcard to select all pages with some value for a many-valued property, for example {{#ask: [[Employment::+]] }} To find pages that match a particular value for any of the parts of a many-valued property, just list the values to match, separated by semicolons. If you don't care about the value of one of the datatypes, use ? to match any value for it including omitted. You can also use comparators (such as ! for not, < for less than or equal to, etc.) for each of the datatype's values.

For example,

 {{#ask: [[Employment:: ?; !professorship; <1950-12-31; ?]] }}

selects values for the property Employment with any value for the employer string, where the title string is not "professorship", the start date is before 1951, and with any value for end date.

Limitations

  • You cannot use the special Allows value property to limit the values of any element of a many-valued property.
  • You cannot use the special Display units property to control how a specific element appears.
  • You cannot set the layout of the values; they will always appear as a comma-separated list.
  • You cannot create a timeline query of many-valued properties.