Using Labels in SPARQL

Looking at some of the queries in:
	http://esw.w3.org/topic/HCLS/Banff2007Demo? 
action=AttachFile&do=get&target=Banff2007Part2.pdf

I am reminded again of the practice of using gensyms for the URIs of  
terms, e.g.,:
	?class rdfs:subClassOf go:GO_0008150

In Swoop, we added the ability for the display (e.g., class tree,  
definitions) to replace URIs with the label of your (language)  
choice. I'm sure other tools do that as well. Obviously, a query  
creation tool could do this as well.

I was wondering if it would be worth adding some syntactic sugar to  
sparql to support this style. Maybe something like

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX go: <http://purl.org/obo/owl/GO#>
PREFIX obo: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
LABELS obo:myEnglishLabels FOR <http://www.geneontology.org/formats/ 
oboInOwl#>

select  ?name  ?class ?definition
from <http://purl.org/commons/hcls/20070416>
where
{   graph <http://purl.org/commons/hcls/20070416/classrelations>
      {?class rdfs:subClassOf NiceNameForGO_0008150}
     ?class rdfs:label ?name.
     ?class obo:hasDefinition ?def.
     ?def rdfs:label ?definition
     filter(regex(?name,"[Dd]endrite"))
}

I'm not sure if we'd want to let that sugar percolate into the  
rdfs:label queries. Then the query would look like:

select  ?class ?definition
from <http://purl.org/commons/hcls/20070416>
where
{   graph <http://purl.org/commons/hcls/20070416/classrelations>
      {?class rdfs:subClassOf NiceNameForGO_0008150}
     ?class obo:hasDefinition ?def.
     filter(regex(?class,"[Dd]endrite"))
}

It just strikes me that all the label probing is beside the actually  
application logic of the query and gets in the way.

If one want to get the uri as well, a function could do that, perhaps  
even in the head.

Cheers,
Bijan.

Received on Friday, 1 June 2007 10:30:41 UTC