Re: Wordnet Planets SPARQL Puzzle

Hi Glenn 

Interjecting into your email thread re Danny's SPARQL puzzle
in case you hadn't seen my tweets to him today on this topic 

On Tue, 12
Apr 2011 09:33:05 -0400, glenn mcdonald  wrote:   Which is what I was
talking about in Boundedness: does the data have the properties you need to
extract the subset you want. E.g., Danny Ayers yesterday was trying to make
a SPARQL query for Wordnet that found the planets in the solar system that
aren't named after Roman gods. But neither he nor I could find any way in
the data to distinguish actual planets in the list of solar bodies, so we
couldn't quite make it right. That was a data problem, not a tool problem.
But the difficulty of figuring this out, _using_ the tools, was a tool
problem. 

Here is a query that answers Danny's question (also online at
http://pastebin.com/8juVLmCT). You'll need a SPARQL 1.1 engine to run this,
if you don't have a local one to hand (or it doesn't support all the
features I've used in the query since some are only in the editors drafts
currently) then you can run this online at
http://www.dotnetrdf.org/demos/leviathan/ 

AFAIK this should also run
under Jena's ARQ (you may need the latest snapshot) and should be runnable
on sparql.org except that the site appears to be down at the moment 

The
query is a tad clunky because the RKB Explorer endpoints are SPARQL 1.0
only so has to be split into several sections because the local SPARQL
engine has to do the MINUS bit. Once it has done the Wordnet bit it
constructs a DBPedia Resource URI and then uses an EXISTS filter over a
SERVICE call to DBPedia to ensure that the resource is a Planet 

PREFIX
rdfs: 
PREFIX wn: 

SELECT DISTINCT ?label WHERE 
{
 SERVICE 
 {
 ?s1
wn:memberMeronymOf  .
 ?s1 rdfs:label ?label.
 }
 MINUS
 {
 SERVICE 
 {

?s2 wn:hyponymOf  .
 ?s2 rdfs:label ?label.
 }
 }

BIND(URI(CONCAT("http://dbpedia.org/resource/", ?label)) AS ?dbpResource)

FILTER(EXISTS
 {
 SERVICE 
 {
 ?dbpResource a  .
 }
 })
} 

Regards, 

Rob
Vesse  
-- 
PhD Student
IAM Group
Bay 20, Room 4027, Building
32
Electronics & Computer Science
University of Southampton
 

Received on Tuesday, 12 April 2011 14:03:51 UTC