Special property "Subcategory of"

From semantic-mediawiki.org
Subcategory of
Lets you explicitly indicate that one category is a subcategory of another
Further Information
Provided by: extension "Semantic MediaWiki "Allows to store and query data annotated to pages
Added: 1.5.0
Removed: still in use
Alias: has no alias
Optional: no
Visible: yes
Annotable: no
Declarative: yes
Key:
_SUBC
Setting: not specified
Focus: not specified
In this wiki: Property:Subcategory of
Table of Contents

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 configuration parameter $smwgUseCategoryHierarchySets whether elements of the subcategory hierarchy are considered as hierarchy elements in the annotation process is set to "false" and subcategories need to be explicitly declared - or else ignored - as subclasses.

Setting the special property[edit]

Declaring this property is useful only if configuration parameter $smwgUseCategoryHierarchySets whether elements of the subcategory hierarchy are considered as hierarchy elements in the annotation process is set to "false". If this configuration setting is set to "true" (per the default setting), the special property is automatically set on any subcategory[1] 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#Subcategories for general information.

If configuration parameter $smwgUseCategoryHierarchySets whether elements of the subcategory hierarchy are considered as hierarchy elements in the annotation process is set to "false", 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.

Example from this site

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,

{{#ask: [[Category:Semantic MediaWiki documentation]] … }}

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.

Note on syntax

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.

Queries using the special property[edit]

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

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 $smwgUseCategoryHierarchy is set to true). You could, then, construct a query like

{{#ask: [[Subcategory of::Semantic MediaWiki documentation]] }}

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

with the following results:

API, Ask syntax, Configuration parameters, Datatypes, Developer documentation, Functional classes, Installation, Maintenance, Maintenance alert, Parser hooks, Result formats, Samples, Schema, Semantic MediaWiki Plus extensions, Semantic MediaWiki documentation - old releases, Semantic MediaWiki documentation/de, Semantic MediaWiki documentation/fr, Semantic MediaWiki documentation/ja, Semantic MediaWiki documentation/nl, Semantic MediaWiki documentation/zh-hans, Semantic MediaWiki extensions, Semantic MediaWiki historical documentation, Semantic gardening, Special pages, Special properties, Store documentation, Upgrade, User rights and groups

Note

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.

This special property is only a visible as well as a manually annotable special property if option SMW_CAT_HIERARCHY to configuration parameter configuration parameter $smwgCategoryFeaturesSets the behaviour of the query features related to category handling was removed from it".

See also[edit]

Notes[edit]

  1. If the setting is set to true, manually declaring the property will not harm but it serves no purpose.