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?
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.
peter
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.
On 03/24/2017 05:47 PM, Stas Malyshev wrote:
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.
That's what I thought, but SPARQL is such a complex beast that I wanted to get an answer from someone who knows for sure.
peter
wikidata-tech@lists.wikimedia.org