SKOS and SPARQL - what seems like an obvious use-case is difficult to implement

We are looking to implement some basic discovery operations over SKOS datasets using SPARQL.
The hypothesis is that, given the relatively strong and stable RDF data model that SKOS provides, some ops could be bundled into a standard 'concept retrieval interface' and implemented by standard vocabulary services.

However, a couple of what seem (to us) to be obvious ops seem to require multiple requests to implement.
We are interested to know if
(a) we are missing a trick or two in SPARQL
(b) we are deluded in our assessment that these use-cases are common, and thus should be supported more directly


Case 1 - 'simple search'
'Get Concept By Label'
- We want to get a hit if the value of any prefLabel = the target string, regardless of language qualifier.
- since a language qualified value will not match a request for a language-unqualified value (http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#matchLangTags) we must use a SPARQL filter expression, e.g.

SELECT $concept WHERE
{
$concept skos:prefLabel $conceptName.
FILTER regex(str($conceptName), "^Ludlow$")
}

- this generates multiple hits if the language-qualified labels are the same string (e.g. in our case one concept has prefLabel="Ludlow"@en, prefLabel="Ludlow"@fr, prefLabel="Ludlow"@it, prefLabel="Ludlow"@sv)
- the DISTINCT operator will strip the duplicates - great!

SELECT DISTINCT $concept WHERE
{
$concept skos:prefLabel $conceptName.
FILTER regex(str($conceptName), "^Ludlow$")
}

- but we want the response to contain all the details of the SKOS Concept, so we need to use DESCRIBE, but
    - DISTINCT is only available on SELECT :-(
    - SPARQL doesn't support nested queries - i.e. we can't wrap a DESCRIBE around a SELECT DISTINCT

It looks like we have to add some logic to the client to run a DESCRIBE on each result from the SELECT DISTINCT operation - correct?


Case 2 - 'all my relations'
'Get Concept And Its Relations'
- we want to get the concept, and also all narrower, or all broader, or maybe just all related - out to some graph radius.
i.e. transitive success.
This is to support some matching or portrayal functions where the objects known to a client application are classified to either more or less detail than the reference system supports.

Again, it looks like we have to add an iterator to the client, to work through the results of a DESCRIBE request.


Simon
______
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (0)8 6436 8639  Cell: +61 (0) 403 302 672
Polycom PVX: 130.116.146.28
<http://www.csiro.au<http://www.csiro.au/>>

ABN: 41 687 119 230

Received on Monday, 16 March 2009 02:05:02 UTC