#ask: syntax – "order" printout sorter

From semantic-mediawiki.org
< #ask: syntax elements
#ask: syntax elements#ask: syntax – "order" printout sorter
#ask: syntax details:
Syntax
+order=
Description Defines the sorting order for printout statements (dot chain syntax)1
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
Since version 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[edit]

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 11 October 2018 and compatible with MW 1.27.0 - 1.31.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[edit]

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


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