- From: Alistair Miles <alimanfoo@googlemail.com>
- Date: Wed, 2 Feb 2011 09:01:58 +0000
- To: Bob DuCharme <bob@snee.com>
- Cc: danbri@danbri.org, public-esw-thes@w3.org
This is all really nice, thanks for the examples. If SPARQL property paths had been around in 2008, I think I might have reconsidered the need for skos:broaderTransitive :) Cheers, Alistair On Sat, Oct 16, 2010 at 09:52:04AM -0400, Bob DuCharme wrote: > The blog posting Dan mentions covers property paths as one set of > new SPARQL 1.1 features. I covered other new features at http://www.snee.com/bobdc.blog/2010/08/trying-sparql-11-new-query-fea.html. > > For using property paths with SKOS, here are a few queries off the > top of my head with the International Virtual Observatory Alliance > SKOS thesaurus available at > http://www.ivoa.net/rdf/Vocabularies/vocabularies-20091007/IAUT93/ . > (If I brought over my neighbor who knows a lot more about astronomy > than I do, that would probably make these better.) > > All queries assume @prefix i: > <http://www.ivoa.net/rdf/Vocabularies/IAUT93#> and @prefix skos: > <http://www.w3.org/2004/02/skos/core#> . > > 1. Get all data in the subtree under the top level concept i:VariableStars: > > SELECT * > WHERE { > ?c skos:broader* i:VariableStars . > ?c ?p ?o . > } > > > 2. What concepts are skos:related to the same concepts that > i:BlackHoles is related to? > > SELECT DISTINCT ?c > WHERE { > i:BlackHoles skos:related^skos:related ?c . > FILTER (?c != i:BlackHoles) > } > > > 3. Working in some of SPARQL 1.1's aggregate functions > (http://www.w3.org/TR/sparql11-query/#aggregates) can help to > analyze a particular vocabulary. For example: how many nodes are > there six levels down? > > SELECT (COUNT(?b) as ?sixDeep) > WHERE { > ?c skos:broader{6} ?b . > } > > > Bob > > > -----Original Message----- > > From: Dan Brickley [mailto:danbri@danbri.org] > Sent: Saturday, October 16, 2010 6:04 AM > To: SKOS > > Subject: SKOS query in SPARQL 1.1 > > Hello SKOS people, > > http://www.snee.com/bobdc.blog/2010/10/playing-more-with-sparql-11-pr.html > from Bob DuCharme might be of interest. > > "Playing more with SPARQL 1.1 property paths" > > It describes some new language features in SPARQL (along with their > implementation in ARQ, Jena's query engine; Java software). > > The new SPARQL draft includes a 'property paths' feature, > http://www.w3.org/TR/2010/WD-sparql11-query-20101014/#propertypaths > > "A property path is a possible route through a graph between two graph > nodes. A trivial case is a property path of length exactly 1, which is > a triple pattern. Property paths allow for more concise expression of > some SPARQL basic graph patterns and also add the ability to match > arbitrary length paths. The ends of the path may be RDF terms or > variables. Variables can not be used as part of the path itself, only > the ends. Query evaluation determines all matches of a path expression > and binds subject or object as appropriate." > > This should lend itself to SKOS (and Bob reports some success there), > since we often have hierarchies of skos:broader to traverse. If anyone > experiments with this, I'm sure everyone here would be happy to see > some summary and sample queries. The SPARQL Working Group might > appreciate feedback too. > > cheers, > > Dan > > > -- Alistair Miles Head of Epidemiological Informatics Centre for Genomics and Global Health <http://cggh.org> The Wellcome Trust Centre for Human Genetics Roosevelt Drive Oxford OX3 7BN United Kingdom Web: http://purl.org/net/aliman Email: alimanfoo@gmail.com Tel: +44 (0)1865 287669
Received on Wednesday, 2 February 2011 09:02:37 UTC