#ask: hierarchy depth restriction

From semantic-mediawiki.org
Jump to: navigation, search
#ask: syntax elements#ask: hierarchy depth restriction
Syntax
+depth=
Description Restricts the hierarchy depth of a query1
Datatype support All datatypes
Component condition
Software Semantic MediaWiki
First version supported Semantic MediaWiki 3.0.0 Released on an unknown date and compatible with MW 1.27.0 - 1.30.x.
Keyword hierarchy · depth restriction · property hierarchy · category hierarchy · class hierarchy · subcategory · subproperty · inferencing

Rationale

Semantic MediaWiki by default considers all subcategories and subproperties as part of a hierarchy when Selecting pages. Limits settable with either configuration parameter $smwgQSubcategoryDepthSets the maximum level of subcategory inclusion (steps within category hierarchy) or configuration parameter $smwgQSubpropertyDepthSets the maximum level of subproperty inclusion (steps within property hierarchy) apply to all queries within the respective wiki. To individually prevent selected Inline queries using either the #ask or #show parser function to consider subcategories or subproperties the +depth= query parameter is used to set the levels for inferencing where a hierarchy is detectable.

The integer set with the +depth= query parameter denotes the maximum level for considering either the subcategories or subproperties. Setting "0" resolves only the category or property stated in the inline query. If this query parameter is not used all hierarchy levels are considered to the maximum extent either defined with configuration parameter $smwgQSubcategoryDepthSets the maximum level of subcategory inclusion (steps within category hierarchy) or configuration parameter $smwgQSubpropertyDepthSets the maximum level of subproperty inclusion (steps within property hierarchy) which is the default behavior.

NoteNote: When using an RDF store set with SPARQLStore via configuration parameter $smwgDefaultStoreSets the storage backend to be used for the semantic data this query parameter may only be set to either "0" or "1".

Example

Syntax for category inferencing
{{#ask:
 [[Category:Foo|+depth=0]]
 |?Category
}}
Syntax for property inferencing
{{#ask:
 [[SomeProperty::+|+depth=1]]
 |?SomeProperty
}}

or

{{#ask:
 [[SomeProperty::SomeValue|+depth=0]]
 |?SomeProperty
}}

See also

Specific information
Information on configuration parameters

References

  1. ^  Semantic MediaWiki: GitHub issue gh:smw:2662