#ask: syntax – "depth" hierarchy restrictor

From Linux Web Expert

#ask: syntax details:
Syntax +depth=
Description Property "Has description" (as page type) with input value "Restricts the hierarchy depth of a query[[CiteRef::gh:smw:2662" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.
Datatype support All datatypes
Component condition
Software Semantic MediaWiki
Since version Semantic MediaWiki 3.0.0 Released on an unknown date unknown versions of MediaWiki
Keyword hierarchy · depth restriction · property hierarchy · category hierarchy · class hierarchy · subcategory · subproperty · inferencing

The +depth= hierarchy depth restrictor was introduced in Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki.

Rationale

Semantic MediaWiki by default considers all subcategories and subproperties as part of a hierarchy when selecting pages. Limits settable with either configuration parameter $smwgQSubcategoryDepthNo description was provided. 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 $smwgQSubcategoryDepthNo description was provided. or configuration parameter $smwgQSubpropertyDepthSets the maximum level of subproperty inclusion (steps within property hierarchy) which is the default behavior.

When using an RDF store setup 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
}}
Link

<sandbox.semantic-mediawiki.org>: More examples for this query parameter

See also

Specific information
Information on configuration parameters
#scite could not render a citation text for reference "gh:smw:2662" because type "issue" was not assigned to a template.