W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > March 2006

Re: Comments on STRING [OK?]

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Mon, 27 Mar 2006 12:22:24 +0100
Message-ID: <4427CAF0.7070406@hp.com>
To: Faisal.Alkhateeb@inrialpes.fr
CC: public-rdf-dawg-comments@w3.org



Faisal.Alkhateeb@inrialpes.fr wrote:
> Hello,
> 
>   Regadring the string in sparql, if we have the following DATA:
> 
> DATA:
> @prefix foaf:       <http://xmlns.com/foaf/0.1/> .
> 
> _:a  foaf:name       "Robert"@EN.
> _:a  foaf:name       "Roberto"@ES.
> _:a  foaf:mbox       <mailto:bob@work.example> .
> 
> And the following query:
> 
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ?name ?mbox
>  WHERE { ?x foaf:name  ?name ;
>             foaf:mbox  ?mbox .
>          FILTER ( lang(?name) = "es" ) }
> 
> I think that this query fails to match "es" in the FILTER. 
> 
> And what about if we have 'ES' or '''ES''',  does the query match the DATA or 
> not?
> Should we transform the literals to a normal form?
> 
> 
> Best regards,
> Faisal
> INRIA Rhône-Alpes

SPARQL has a specific function to match language tags.  It follows the rules 
of RFC3066.

http://www.w3.org/2001/sw/DataAccess/rq23/#func-langMatches

  FILTER ( langMatches( lang(?name), "es" )

Other examples:

langMatches( "ES", "es" ) ==> true
langMatches( "EN-gb", "en" ) ==> true
langMatches( "EN-gb", "en-g" ) ==> false


I hope this responds to your comment - please let us know if it does.

	Andy
----

There is a new mailing list public-sparql-dev@w3.org for general questions on 
SPARQL.
Received on Monday, 27 March 2006 11:22:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:50 GMT