Re: Using Labels in SPARQL

On Jun 1, 2007, at 3:31 AM, Bijan Parsia wrote:

>
> 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

this isn't really a gensym but never mind - it's the stable  
identifier for the class, or rather a bastardization of the stable  
identifier to make it conform to the URI standard

> In Swoop, we added the ability for the display (e.g., class tree,  
> definitions) to replace URIs with the label of your (language) choice.

very nice it is too - I believe you added this on my request when I  
was playing with GO in Swoop back in the day

> 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"))
> }

wouldn't the argument have to be a literal? E.g.

LABELS obo:myLabels FOR <http://www.geneontology.org/formats/oboInOwl#>

?class rdfs:subClassOf "biological process"@en			(this is the label  
for GO:0008150)


> 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.

I'll bet Alan has some lisp macro facility to do this already in his  
LSW s-expression syntax sparql queries

Even though I'm not keen on specifying the extra triples in the query  
I'm not sure this warrants ad-hoc extensions to a standard. I'd  
rather see it part of a more general mechanism, such as a function in  
the head. It would feel more natural to write:

?class rdfs:subClassOf hasLabel("biological process"@en)

> Cheers,
> Bijan.
>
>

Received on Friday, 1 June 2007 15:38:50 UTC