Hi!
I'm trying to figure out whether the Wikidata label service (the stuff that is invoked as SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } in queries to the Wikidata query service) is something that can be done in SPARQL or whether it is an extension that can't be done in SPARQL. Does anyone know the answer to this?
Yes, you can do labels in SPARQL, just do:
?item rdfs:label ?itemLabel. FILTER(lang(?itemLabel) = 'en')
The reason that I ask is that it appears that the service accesses the names of SPARQL variables in solution sets, and I can't think of how it does that using SPARQL facilities.
That part you probably can't do in SPARQL, I think - you have to name the variables explicitly.