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

Dave Beckett dave at dajobe.org
Sat Jan 7 20:19:38 GMT 2006


Marinaio di terra wrote:
> 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:

I also just discovered that in the released rasqal, LANG() was broken.
I returns "-" for a literal with no language tag which was wrong.

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

This should work in future.

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

Bug!

Also I've just added the new SPARQL langMatches() function to rasqal CVS
which lets you do wildcards, although the current definition doesn't let
it match literals with no language present:
  http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/#func-langMatches

If that is a problem for you, maybe you could ask the DAWG about it.

Dave


More information about the redland-dev mailing list