I'm working with input models like this one:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns="http://www.test.org/";>

    <rdf:Description rdf:about="http://www.test.org/test";>
<sometext xml:lang="en" rdf:parseType="Literal">some text</sometext>
        <sometext xml:lang="fr" rdf:parseType="Literal">texte</sometext>
    </rdf:Description>

</rdf:RDF>

I'm trying to load the text for a given language, using some SPARQL like this:

SELECT ?sometext
WHERE {
    ?x <http://www.test.org/sometext>?sometext .
    FILTER (LANG(?sometext) = 'en')
}

As you can see bellow, I'm having trouble to filter the result according to the language (en):
$ sparql --data=data.rdf.xml  --query=test.rq
------------
| sometext |
============
------------

If I comment out the filtering as
# FILTER (LANG(?sometext) = 'en')

the result is as bellow:
------------------------------------------------------------------------
| sometext |
========================================================================
| "texte"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>|
| "some text"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>|
------------------------------------------------------------------------

If I remove all the rdf:parseType="Literal" attributes from the model, using the initial query, result is:
------------------
| sometext       |
==================
| "some text"@en |
------------------

So, it seems that the xml:lang attribute applies to the sometext element itself, but _not_ to the enclosed literal denoted by rdf:parseType="Literal". I'm quite sure it's not a bug within the Jena framework, but rather a consequence from my ignorance: how should i write the SPARQL query to filter the results according to the value of the xml:lang attribute, provided I have to accommodate with the input model ?

Thanks for any advice or interesting pointer.
Regards.

Reply via email to