I have some triples that look like this:
test:thing rdfs:label \"Non-Language Label\"
test:thing rdfs:label \"English Label\"@en
test:thing rdfs:label \"French L
The easiest way to check the language of literals is to use the lang() function. Using this, your query can be written as:
PREFIX rdfs:
PREFIX test:
SELECT ?label ?preferredLabel
WHERE {
test:thing rdfs:label ?label
OPTIONAL {
test:thing rdfs:label ?preferredLabel .
FILTER (lang(?preferredLabel) = "" || lang(?preferredLabel) = "fr")
}
}