In a multilingual setting, it is necessary to attach language tags to textual information, in order to identify the appropriate label for localized applications.
This pattern can be applied when labels have information in some natural language.
:juan :position "Professor"@en .
:juan :position "Catedrático"@es .
Multilingual labels are part of the RDF standard and well supported by semantic web tools.
For example, the following SPARQL query asks for people whose
position is Professor and would return :juan
.
SELECT * WHERE {
?x ex:position "Professor"@en .
}
Dealing with big multilingual linked data repositories where all literals have a language tag makes SPARQL queries more verbose. For example, the following SPARQL query for previous example would return no results.
SELECT * WHERE {
?x ex:position "Professor" .
}
There are some patterns and built-in SPARQL functions that deal with language
tagged literals like:
lang()
returns the language of a literal
langMatches()
checks if the language of a literal matches a given language
str()
returns the literal without the language tag
str()
function, the previous query can be rewritten as:
SELECT * WHERE {
?x ex:position ?p .
FILTER ( str(?p)="Professor" )
}
This pattern is the same as the Multi-lingual literal.
This pattern is also related to the Repeated property pattern where a resource can have several values for the same property. In this case, the values are literals in different languages.