functions detail: lang/langmatches

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 UTC