W3C home > Mailing lists > Public > public-semweb-lifesci@w3.org > June 2007

Using Labels in SPARQL

From: Bijan Parsia <bparsia@cs.man.ac.uk>
Date: Fri, 1 Jun 2007 11:31:26 +0100
Message-Id: <7BD5B13C-3F7B-4D8B-953B-CFE07C43CEFA@cs.man.ac.uk>
To: public-semweb-lifesci hcls <public-semweb-lifesci@w3.org>

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:00:48 GMT