Re: functions detail: lang/langmatches

On 11/3/2010 9:19 AM, Axel Polleres wrote:
> 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.

I do not like this suggestion.

I agree with the initial observation that lang(...) = ... doesn't make a 
good example since it's not the best way to do things, but I don't think 
that making the example _more_ complicated is the way to do it.

Perhaps instead we could adapt this example to take advantage of BIND or 
project expressions and simply project out the language, so that no 
testing is involved at all?

Lee

>
> Axel
>
>
>
>
>
>

Received on Wednesday, 3 November 2010 13:30:23 UTC