Special property "Subproperty of"

From semantic-mediawiki.org
(Redirected from Special property "Subproperty of")
Special property "Subproperty of"Special property "Subproperty of"
Subproperty of
Lets you indicate that one property is a subproperty of another
Further Information
Provided by: extension "Semantic MediaWiki "Allows to store and query data annotated to pages
Added: 1.0
Removed: still in use
Alias: has no alias
Optional: no
Visible: yes
Annotable: yes
Declarative: yes
Setting: not specified
Focus: not specified
In this wiki: Property:Subproperty of
Table of Contents

The Subproperty of property is a special property in Semantic MediaWiki with a built-in meaning: it lets you indicate that one property is a subproperty of another, which we call its head property. This enables you to query on one or multiple subproperties by querying on their common head property, without having to resort to elaborate OR criteria property by property. It means, for instance, that a query for pages with the head property should also return pages that have the subproperty.

In addition to straightforward child-parent relationships, SMW also supports a deeper hierarchy, the maximum depth of which depends on configuration parameter $smwgQSubpropertyDepthSets the maximum level of subproperty inclusion (steps within property hierarchy) (10 by default). A property may also have multiple head properties as direct parents.


On this wiki, Property:Has chair is a head property with multiple subproperties ("Has financial chair", "Has program chair", "Has online chair", etc.). Each subproperty uses the special property [[Subproperty of::Has chair]].

Querying for the property "Has chair" should also find you pages with its subproperties. You can query on those subproperties by querying on the head property. For instance,

{{#ask: [[Has chair::+]] }}

returns all pages that use the head property ("Has chair") and its subproperties ("Has financial chair", etc.).

The same works for inverse queries. To find all users who have been chairs, regardless of their precise role, you could use a query like:

{{#ask: [[Category:User]] [[-Has chair::+]] }}


Chained properties in query conditions[edit]

A head property cannot be part of a property chain in a query condition unless it comes at the end, before the value. For example, if the head property were called "organised by", then the following example will not work, but it would been fine if "member of" had been a parent property instead:

{{#ask: [[organised by.member of::SMW community]] ... }}

Using head properties as printout parameters[edit]

If a head property is used as a printout parameter in a query, the corresponding results will be the values of the head property only. To ensure that those of its subproperties are included as well, each relevant subproperty must be explicitly specified as printout parameter.

For instance, in our earlier example :

{{#ask: [[Has chair::+]]
 |?Has financial chair
 |?Has online chair
 |?Has general chair
 |?Has local chair
 |?Has program chair
 |?Has sponsorship chair


  • The maximum level of subproperty inclusions (steps within property hierarchy) to be considered by queries can be configured configuration parameter $smwgQSubpropertyDepthSets the maximum level of subproperty inclusion (steps within property hierarchy) (default: 10).
  • Starting with Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x. it is possible to enforce that the subproperty uses the same datatype as the head property 1. See the help page on mandatory parent datatype inheritance for further information.
  • On systems where the first letter of an article does not get capitalized make sure that the property is maintained with an capital S [[Subproperty of::Spouse]] otherwise the system does not recognize it as a special property.
  • This special property also agrees with rdfs:subPropertyOf:
If property P is a subproperty of property P', then all pairs of resources which are related by P are also related by P'.
  • A property's wiki page shows its subproperties (since Semantic MediaWiki 1.2.1Released on 8 August 2008 and compatible with MW 1.11.x - 1.14.x.). The page of the head property does not, however, list the values of its subproperties.
  • If no pages (or very few pages) in the wiki use a property, then even if lots of pages use its subproperties:
    • The property's page will list no (or few) pages under "Pages using the property"
    • The property will not appear in Special:Properties (or will appear with a caution This property is hardly used within the wiki!).

See also[edit]


  1. ^  |  Semantic MediaWiki: GitHub pull request gh:smw:3733