Help:Special property Subcategory of

The Subcategory of property is a special property in Semantic MediaWiki with a built-in meaning: it is used to indicate that a category is a subcategory of another and that SMW should treat this subcategory as a subclass for the purpose of inferencing in queries. It is primarily useful when is set to " " and subcategories need to be explicitly declared - or else ignored - as subclasses.

Setting the special property
Declaring this property is useful only if is set to " ". If this configuration setting is set to " " (per the default setting), the special property is automatically set on any subcategory and Semantic MediaWiki automatically considers MediaWiki's subcategory hierarchy in querying: for example, if "B" is a subcategory of "A", then a query for all pages within "A" should also return all pages in "B". Subcategories that are found lower in the same hierarchy are also considered in querying, to an extent. See also Help:Inferencing for general information.

If is set to " ", however, then pages in subcategories do not automatically turn up in query results. This is where the special property comes in: it lets you explicitly declare subclass relationships for any subcategory, enabling you to specify which subcategories should be considered in querying. This means that a query on a given head category considers pages in those subcategories (including subcategories lower down the hierarchy) where the special property has been manually declared; conversely, it ignores pages in those subcategories where the special property has not been declared.

Querying for a page within the category "Semantic MediaWiki documentation" should also find pages within its subcategories, e.g. "Special properties" and "Configuration parameters", if those categories have the special property  Subcategory of::Semantic MediaWiki documentation . You can query in all subcategories by querying on the head category. For instance, returns all pages within head category ("Semantic MediaWiki documentation") and its subcategories (e.g. "Special properties" and "Configuration parameters"). Note that other query restrictions still apply when querying within categories.
 * Example from this site

On systems where the first letter of an article does not get capitalized make sure that the property is maintained with a capital S  Subcategory of::Semantic MediaWiki documentation ; otherwise the system does not recognize it as a special property.
 * Note on syntax

Queries using the special property
The Subcategory of property can be used in a query statement, regardless of the value that is being used for.

Suppose, for instance, that you want to know all subcategories that are the immediate subclasses of "Category:Semantic MediaWiki documentation"; in other words, those that are directly linked to its head category through the special property (which is the case for any subcategory if  is set to  ). You could, then, construct a query like

(it is not required to use the Category: prefix or to de-link the results)

with the following results:

Subcategories in deeper levels of the category hierarchy (for instance, those in Category:Developer documentation) are not included in the results. It is not currently possible in SMW to query for subcategories in all levels of the category hierarchy.
 * Note