Template:Articles in

From Wikidata
Jump to navigation Jump to search
Documentation icon Template documentation[view · edit · history · purge ]


This template is used to generate a partial SPARQL query to filters the results from the language links that are about an item (or a SPARQL variable). You may be looking for {{Articles in wikipedia}} to find if the item has some article in a specific wikipedia language edition instead.

For example the call {{Articles in|?searcheditem|fr}} inside a SPARQL expression will filter the ?searcheditem values to retain only the values for wich wikidata knows a sitelink in french.

SELECT ?item WHERE {
  ?item wdt:P279*/wdt:P31 wd:Q5
     OPTIONAL { ?wartfritem schema:about ?item . ?wartfritem schema:inLanguage "fr" }
     FILTER(bound(?wartfritem))
}
Try it!

can for example be used to generate a query for all humans with an article in french on wikimedia or another wiki :

SELECT ?item WHERE {
  ?item wdt:P279*/wdt:P31 wd:Q5
     OPTIONAL { ?wartfritem schema:about ?item . ?wartfritem schema:inLanguage "fr" }
     FILTER(bound(?wartfritem))
}
Try it!


Usage[edit]

   OPTIONAL { ?wartfrQ5 schema:about Q5 . ?wartfrQ5 schema:inLanguage "fr" }
    FILTER(bound(?wartfrQ5))

See also[edit]

Finds if there is an article in a language on a wikimedia wiki in a certain language. For example if the item as an article in wikiversity in french, or in wikimedia in french …

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
item1

An item, either a variable or a specific item id

Default
?item
Example
Q42 or ?item
Unknownrequired
lang2

a wikimedia project language code

Example
en
Unknownoptional
notnot

put any value if you want that the item has no article in the language

Suggested values
yes
Example
yes
Unknownsuggested

OPTIONAL { ?wart{{{2}}}{{{1}}} schema:about {{{1}}} . ?wart{{{2}}}{{{1}}} schema:inLanguage "{{{2}}}" }

    FILTER(bound(?wart{{{2}}}{{{1}}}))