Internationalized SPARQL queries

Looking throught some notes of the [SPARQL Calendar Demo][1] I encountered the problem of internationalization: My dataset (here) does contain myself as a FOAF Person with statements like:

<pre> <foaf:firstname>Christoph</foaf:name> <foaf:surname xml:lang="de">Görn</foaf:surname> <foaf:surname>Goern</foaf:surname> </pre> <p>

Using the SPARQL query that

Show me all people along with their names (if found), unique IDs (if found), and calendar URLs (if found) in my current RDF dataset.

results in:

<pre> 1 ( ?who = http ://B4mad.Net/FOAF/goern.rdf#goern ) ( ?name = "Christoph Goern" ) ( ?id = "0a9d600329b781dcdd710bf97c8ad16c44cf8dc9" ) ( ?cal = http ://b4mad.net/addressbook/geburtstage.rdf ) 2 ( ?who = http ://B4mad.Net/FOAF/goern.rdf#goern> ) ( ?name = "Christoph Goern" ) ( ?id = "0a9d600329b781dcdd710bf97c8ad16c44cf8dc9" ) ( ?cal = http ://b4mad.net/FOAF/goern-reisen.rdf ) 3 ( ?who = http ://B4mad.Net/FOAF/goern.rdf#goern ) ( ?name = "Christoph Görn"@de ) ( ?id = "0a9d600329b781dcdd710bf97c8ad16c44cf8dc9" ) ( ?cal = http ://b4mad.net/addressbook/geburtstage.rdf ) 4 ( ?who = http ://B4mad.Net/FOAF/goern.rdf#goern ) ( ?name = "Christoph Görn"@de ) ( ?id = "0a9d600329b781dcdd710bf97c8ad16c44cf8dc9" ) ( ?cal = http ://b4mad.net/FOAF/goern-reisen.rdf ) </pre> <p>

Too many of myself! Note to self: fix my body count.

To do so, the SPARQL query should filter out any foaf:name that has a unset xml:lang:

<pre> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ical: <http://www.w3.org/2002/12/cal/icaltzd#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?who ?name ?id ?cal WHERE { ?who rdf:type foaf:Person . OPTIONAL { ?who foaf:name ?name } OPTIONAL { ?who rdfs:label ?name } OPTIONAL { { ?who foaf:mbox ?id } UNION { ?who foaf:mbox_sha1sum ?id } } OPTIONAL { ?who rdfs:seeAlso ?cal . ?cal rdf:type ical:Vcalendar } . FILTER ( langMatches( lang(?name), "" ) ) } ORDER BY ?name </pre> <p>

[1]: http://www.thefigtrees.net/lee/blog/2006/04/sparql_calendar_demo_using_spa.html