The result I get from the
langMatches(lang("wort"@de-de),(concat("de","-","de")) ) - approach
in JSON. (attached)
On 28.01.16 11.32 Uhr, Bardo Nelgen wrote:
Hi Andy,
thanks for the immediate reply.
We actually use "en-gb" for UK English in our model – but anyway…
My test-Scenario looks like
?lang = "de"
?locale = "de"
which in
langMatches(lang("wort"@de-de),(concat(str(?lang),"-",str(?locale))) )
unfortunately does not evaluate as true, althoughthe "hard-coded" variant
langMatches(lang("wort"@de-de),"de-de")
indeed does…
Since we *always* deploy language-locale *combinations* throughout the
data model – for fine grained targeting – using an adaption of your
other example
langMatches(lang("wort"@de-de),(concat("de","-","de")) )
evaluates to "true" as well – outputting "wort"@de-de
So the problem seems do lie in the string-making via str(?lang) and
str(?locale).
I also output both variables separately with the same query (for
further processing) which tells me they are filled correctly; also
being quoted in the result to demonstrate the string-property on both.
What else could possibly go wrong with a simple to-string conversion ?
Slightly confused greets,
Bardo
On 28.01.16 10.25 Uhr, Andy Seaborne wrote:
On 27/01/16 20:35, Bardo Nelgen wrote:
Hi all,
most likely I am missing something here, but maybe I am simply doing it
the wrong way:
I need to match a language-locale value where both language and locale
come from different branches in the data model.
So what I came up with in my FILTER clause is
langMatches(lang(?Headline),(concat(str(?lang),"-",str(?locale))) )
Is it meant to work this way or is the approach doomed by itself ?
Any suggestions very welcome. :-)
Regards,
Bardo
If ?Headline, ?lang and ?locale are right it will work but did you
mean the arguments the other way round?
langMatches(lang("word"@EN-uk),(concat("en","-","uk")) ) ==> true
But
langMatches(lang("word"@EN),(concat("en","-","uk")) ) ==> false
The second argument is the language range,
langMatches("en-UK","EN") => true
Andy
{
"head": {
"vars": [ "mailHeaderSubject" , "mailPartsDescription" , "lang" , "locale" ]
} ,
"results": {
"bindings": [
{
"mailHeaderSubject": { "type": "literal" , "xml:lang": "de-de" ,
"value": "Unsere Lieblings-Testmail" } ,
"mailPartsDescription": { "type": "literal" , "xml:lang": "de-de" ,
"value": "Dies ist die Standard-Mail-Beschreibung" } ,
"lang": { "type": "literal" , "value": "de" } ,
"locale": { "type": "literal" , "value": "de" }
}
]
}
}