#ask: syntax – "lang" printout language filter

From semantic-mediawiki.org
< #ask: syntax elements
#ask: syntax elements#ask: syntax – "lang" printout language filter
#ask: syntax details:
Syntax
+lang=
Description Allows to filter a language specific printout1
Datatype support Datatype "Monolingual text "Holds a text value that associates the annotation with a specific language code
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 language filter

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

Rationale[edit]

It allows to filter results that match a specific language for printout statements using the +lang= query parameter. The filtering is only applied to properties of datatype "Monolingual text"Holds a text value that associates the annotation with a specific language code.

It is applied during query post-processing after the condition has already retrieved matchable entities. The printout and hereby the data values may match text in different languages and unless the query condition was designed in a way that would made them reducible, it would display them all. Thus a query condition can be indifferent towards possible language matches, yet enables to only select the one that match the denoted language value. See the help page on datatype "Monolingual text"Holds a text value that associates the annotation with a specific language code for examples to limit the query condition to only select results for specific language.

Examples[edit]

Syntax
{{#ask:
 [[Has property description::+]]
 |?Has property description|+lang=en
}}
Result
 Property description"Property description" is a predefined property that allows to describe a property in context of a language and is provided by Semantic MediaWiki.
Has abstractA summary or condensed version of a piece of writing.
Has mltGeneric property for monolingual text
Has topic labelDescribes a topic label in an annotated language.
Has topic predecessorDescribes a predecessor entity for a selected topic or manual item.
NDL IDWeb National Diet Library of Japan (NDL) Authorities
PopulationThe number of inhabitants of some geographical place.
owl:differentFromThe property that determines that two given individuals are different.

or only show German translations if available:

Syntax
{{#ask:
 [[Has property description::+]]
 |?Has property description|+lang=de
}}
Result
 Property description"Property description" is a predefined property that allows to describe a property in context of a language and is provided by Semantic MediaWiki.
Has abstractEine Zusammenfassung oder Kurzfassung eines Textes.
Has mltGenerisches Attribut für sprachspezifischen Text
Has topic label
Has topic predecessor
NDL ID
PopulationDie Anzahl der Einwohner eines geografischen Orts.
owl:differentFrom
Link

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

See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2037