Status: | effective |
Progress: | 100% |
Version: | 1.5.0+ |
Special property "Subcategory of"
Subcategory of | |
---|---|
Lets you explicitly indicate that one category is a subcategory of another
| |
Further Information | |
Provided by: | extension "Semantic MediaWiki "No description was provided. |
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 | |
Template:Interlanguagelink: en
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 $smwgUseCategoryHierarchy
No description was provided. is set to "false
" and subcategories need to be explicitly declared - or else ignored - as subclasses.
Setting the special property
Declaring this property is useful only if configuration parameter $smwgUseCategoryHierarchy
No description was provided. 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 $smwgUseCategoryHierarchy
No description was provided. 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
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:
- 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.
SMW_CAT_HIERARCHY
to configuration parameter configuration parameter $smwgCategoryFeatures
Sets the behaviour of the query features related to category handling was removed from it".See also
- Help page on subcategory inferencing
- Help page on configuration parameter
$smwgQSubcategoryDepth
No description was provided. - Help page on configuration parameter
$smwgCategoriesAsInstances
Sets whether a category statement should be treated as an element of the category - Help page on configuration parameter
$smwgUseCategoryHierarchy
No description was provided. - Property page Subcategory of to see which pages use this special property on this wiki.
Notes
- ↑ If the setting is set to
true
, manually declaring the property will not harm but it serves no purpose.