[redland-dev] Re: Querying for the right language (i18n)

Marinaio di terra marinaioditerra at gmail.com
Mon Dec 12 13:14:03 GMT 2005


Ok ok, I've found the answer
http://www.w3.org/TR/rdf-sparql-query/#func-lang ...

it's enough to make a query like this:
PREFIX toy: <http://www.example.org/toy-schema.rdf#>
SELECT ?bc
WHERE {?x toy:color ?bc. FILTER(LANG(?bc) = "it")}

But what if I'd like to retrieve, using the same query, even the non
language-labelled informations? They say that 'It [LANG(arg)] returns
"" if arg is a literal with no language tag.' but a query like the
next one doesn't work:

PREFIX toy: <http://www.example.org/toy-schema.rdf#>
SELECT ?bc
WHERE {?x toy:color ?bc. FILTER( (LANG(?bc) = "it") || LANG(?bc) = "")}

Am I making any mistake or is it a Redland gap/bug?

Thanks a lot.
Christian

2005/12/12, Marinaio di terra <marinaioditerra at gmail.com>:
> Hi all,
> I'd like to know if there's a good way to query for a particular
> language inside a SPARQL query. I mean something like this:
>
> PREFIX toy: <http://www.example.org/toy-schema.rdf#>
> SELECT ?bc WHERE {?x toy:color ?bc at it}
>
> or like this:
>
> PREFIX toy: <http://www.example.org/toy-schema.rdf#>
> SELECT ?bc WHERE {?x toy:color ?bc} AND LANG(?bc) = "it"
>
> Actually I've seen those syntax don't work. Using Python-bindings I've
> seen that there is the function "_get_literal_value()" from which I can
> retrieve languages informations but it's not so practical to use.
>
> So is there a better way?


More information about the redland-dev mailing list