#ask: syntax – "order" printout sorter

From Linux Web Expert

#ask: syntax details:
Syntax +order=
Description Property "Has description" (as page type) with input value "Defines the sorting order for printout statements (dot chain syntax)[[CiteRef::gh:smw:2073" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
Since version Semantic MediaWiki 2.5.0 Released on an unknown date unknown versions of MediaWiki
Keyword sorting · display · printout

The +order= query printout sorter was introduced in Semantic MediaWiki 2.5.0Released on an unknown date unknown versions of MediaWiki.

Rationale

Allows to define an order for printout statements in a query result which were selected with the dot chain syntax (property chains) using the +order= query parameter.

The options set with the +order= query parameter denote the order the content of the respective result column should have. The option is either "asc" (long version is "ascending"), "desc" (long version is "descending") or "rand" (long version is "random" in short), like e.g. |+order=asc, |+order=desc or |+order=rand. Note that "asc" is the default which usually does not need to be defined explicitly.

Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki brought two more sorting options to the +order= query parameter allowing to do natural sorting instead of strict sorting: "n-asc" and "n-desc"1. This allows to sort 1, 2, 3, 10 ... instead of 1, 10, 2, 3 ...2

Examples

Syntax
{{#ask:
 [[{{FULLPAGENAME}}]]
 |?Has subobject |+order=asc
 |?Has subobject.MyFirstProperty.MySecondProperty |+order=asc
 |format=broadtable
}}

or

{{#ask:
 [[{{FULLPAGENAME}}]]
 |?Has subobject |+order=desc
 |?Has subobject.MyFirstProperty.MySecondProperty |+order=desc,asc
 |format=broadtable
}}
Link

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

See also

#scite could not render a citation text for reference "sb:smw:2073" because type "example" was not assigned to a template.
#scite could not render a citation text for reference "gh:smw:2953" because type "pullrequest" was not assigned to a template.
#scite could not render a citation text for reference "sb:smw:2953" because type "example" was not assigned to a template.

References

  1. ^ gh:smw:2953 
  2. ^ sb:smw:2953