Difference between revisions of "Help:Ask syntax/Hierarchy depth restriction"

From semantic-mediawiki.org
< #ask: syntax elements
#ask: syntax elements#ask: syntax – "depth" hierarchy restrictor
(chg)
(add)
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
  |syntax=+depth=
 
  |syntax=+depth=
 
  |description=Restricts the hierarchy depth of a query[[CiteRef::gh:smw:2662]]
 
  |description=Restricts the hierarchy depth of a query[[CiteRef::gh:smw:2662]]
  |display title=#ask: hierarchy depth restriction
+
  |display title=<code>#ask:</code> syntax – "depth" hierarchy restrictor
 
  |introduced with=3.0.0
 
  |introduced with=3.0.0
 
  |component=condition
 
  |component=condition
  |keyword=hierarchy; depth restriction; property hierarchy; category hierarchy; class hierarchy; subcategories, subproperties; inferencing
+
  |keyword=hierarchy; depth restriction; property hierarchy; category hierarchy; class hierarchy; subcategory; subproperty; inferencing
 
}}
 
}}
 +
The '''<code>+depth=</code>''' hierarchy depth restrictor was introduced in {{Release|3.0.0}}.
 +
 
== Rationale ==
 
== Rationale ==
[[Semantic MediaWiki]] by default considers all [[Help:Inferencing#Subcategories|subcategories]] and [[Help:Inferencing#Subproperties|subproperties]] as part of a hierarchy when [[Help:Selecting pages|selecting pages]]. Limits settable with either {{Config|$smwgQSubcategoryDepth}} or {{Config|$smwgQSubpropertyDepth}} apply to all queries within the respective wiki. To individually prevent selected [[Help:Inline queries|inline queries]] using either the <code>#ask</code> or <code>#show</code> parser function to consider subcategories or subproperties the <code>|+depth=</code> option is used to set the levels for inferencing where a hierarchy is detectable.
+
[[Semantic MediaWiki]] by default considers all [[Help:Inferencing#Subcategories|subcategories]] and [[Help:Inferencing#Subproperties|subproperties]] as part of a hierarchy when [[Help:Selecting pages|selecting pages]]. Limits settable with either {{Config|$smwgQSubcategoryDepth}} or {{Config|$smwgQSubpropertyDepth}} apply to all queries within the respective wiki. To individually prevent selected [[Help:Inline queries|inline queries]] using either the <code>#ask</code> or <code>#show</code> parser function to consider subcategories or subproperties the <code>+depth=</code> query parameter is used to set the levels for inferencing where a hierarchy is detectable.
  
The integer set with the <code>|+depth=</code> option denotes the maximum level for considering either the subcategories or subproperties. Setting "<code>0</code>" resolves only the category or property stated in the inline query. If this option is not used all hierarchy levels are considered to the maximum extent either defined with {{Config|$smwgQSubcategoryDepth}} or {{Config|$smwgQSubpropertyDepth}} which is the default behavior.
+
The integer set with the <code>+depth=</code> query parameter denotes the maximum level for considering either the subcategories or subproperties. Setting "<code>0</code>" 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 {{Config|$smwgQSubcategoryDepth}} or {{Config|$smwgQSubpropertyDepth}} which is the default behavior.
 +
 
 +
{{Callout
 +
|When using an RDF store setup with <code>SPARQLStore</code> via {{Config|$smwgDefaultStore}} this query parameter may only be set to either "<code>0</code>" or "<code>1</code>".
 +
}}
  
 
== Example ==
 
== Example ==
Line 20: Line 26:
 
}}
 
}}
 
</pre>
 
</pre>
; Syntax for propery inferencing
+
; Syntax for property inferencing
 
<pre>
 
<pre>
 
{{#ask:
 
{{#ask:
Line 34: Line 40:
 
}}
 
}}
 
</pre>
 
</pre>
 +
 +
; Link
 +
[https://sandbox.semantic-mediawiki.org/wiki/Issue/2662 <sandbox.semantic-mediawiki.org>: More examples for this query parameter]
  
 
== See also ==
 
== See also ==
Line 42: Line 51:
 
* Help page on {{Config|$smwgQSubcategoryDepth}}
 
* Help page on {{Config|$smwgQSubcategoryDepth}}
 
* Help page on {{Config|$smwgQSubpropertyDepth}}
 
* Help page on {{Config|$smwgQSubpropertyDepth}}
 
+
<div style="display: none">
 
{{#scite:gh:smw:2662
 
{{#scite:gh:smw:2662
 
  |type=issue
 
  |type=issue
 
  |url=https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/2662
 
  |url=https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/2662
 
}}
 
}}
 +
{{doc.info
 +
|master page=Help:Ask_syntax/Hierarchy_depth_restriction
 +
|status=effective
 +
|progress=100
 +
|priority=1
 +
|minversion=3.0.0
 +
}}
 +
</div>

Latest revision as of 22:54, 24 June 2018

#ask: syntax details:
Syntax
+depth=
Description Restricts the hierarchy depth of a query1
Datatype support All datatypes
Component condition
Software Semantic MediaWiki
Since version Semantic MediaWiki 3.0.0 Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.
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 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..

Rationale[edit]

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) when querying 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) when querying 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[edit]

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[edit]

Specific information
Information on configuration parameters

References

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