#ask: syntax – "order" printout sorter

From semantic-mediawiki.org
#ask: syntax elements#ask: syntax – "order" printout sorter
Syntax
+order=
Description Defines the sorting order for printout statements (dot chain syntax)1
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
First version supported Semantic MediaWiki 2.5.0 Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x.
Keyword sorting · display · printout

The +order= query printout sorter was introduced in Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x..

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 and compatible with MW 1.27.0 - 1.30.x. brought two more sorting options to the +order= query parameter allowing to do natural sorting instead of strict sorting: "n-asc" and "n-desc"2. This allows to sort 1, 2, 3, 10 ... instead of 1, 10, 2, 3 ...3

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


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2073
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:2953
  3. ^  Semantic MediaWiki: Sandbox example sb:smw:2953