#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.
About cityIt is used on template "TableImportAnnotations" to demonstrate the the import-annotation parameter to result format "Plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements)..
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.
Inhabitantsstatistics about the human population, i.e. people that live together in the same place
NDL IDWeb National Diet Library of Japan (NDL) Authorities
PopulationThe number of inhabitants of some geographical place.
Wikidata IDWikidata ID
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.
About city
Has abstractEine Zusammenfassung oder Kurzfassung eines Textes.
Has mltGenerisches Attribut für sprachspezifischen Text
Has topic label
Has topic predecessor
InhabitantsStatistiken zur Bevölkerung, d. h. den Menschen, die am gleichen Ort zusammenleben
NDL ID
PopulationDie Anzahl der Einwohner eines geografischen Orts.
Wikidata IDWikidata-Kennung
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