W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2010

functions detail: lang/langmatches

From: Axel Polleres <axel.polleres@deri.org>
Date: Wed, 3 Nov 2010 13:19:54 +0000
Message-Id: <D882FF0C-747A-45C1-9C9F-BE11D3CC74D3@deri.org>
To: SPARQL Working Group <public-rdf-dawg@w3.org>
Hi all,

A user just made me aware of a small editorial detail we could improve in the query spec to explain lang/langmatches better:
We have the following example for lang in the spec: http://www.w3.org/TR/rdf-sparql-query/#func-lang

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> .

This query finds the Spanish foaf:name and foaf:mbox:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox
 WHERE { ?x foaf:name  ?name ;
            foaf:mbox  ?mbox .
         FILTER ( lang(?name) = "ES" ) }


Since the example comes before langMatches http://www.w3.org/TR/rdf-sparql-query/#func-langMatches
users may be inclined to read that this is the way to match language tags.

The suggestion to improve this is as follows:

1)Add a triple to the graph of the example of lang, i.e.

Data:

@prefix foaf:       <http://xmlns.com/foaf/0.1/> .

_:a  foaf:name       "Robert"@EN.
_:a  foaf:name       "Roberto"@ES.
_:a  foaf:name       "roberto"@es.
_:a  foaf:mbox       <mailto:bob@work.example> .

2) and after the result add a note with a forward-reference to langMatches, e.g.:
"
Note that "roberto"@es is not returned here returned since "=" used in this FILTER checks for string equality in a case-sensitive manner.
For more general matching of lang-tags, please refer to the function <a href="#func-langMatches>langMatches</a> explained below.
" 

Opinions on this suggestion? I am neutral on it, but think it wouldn't do harm.

Axel
Received on Wednesday, 3 November 2010 13:20:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:44 GMT