W3C home > Mailing lists > Public > public-lod@w3.org > April 2011

Re: Wordnet Planets SPARQL Puzzle

From: Kingsley Idehen <kidehen@openlinksw.com>
Date: Tue, 12 Apr 2011 10:20:05 -0400
Message-ID: <4DA45F95.3080601@openlinksw.com>
To: Rob Vesse <rav08r@ecs.soton.ac.uk>
CC: glenn mcdonald <glenn@furia.com>, public-lod@w3.org
On 4/12/11 10:03 AM, Rob Vesse wrote:
>
> 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 <glenn@furia.com> 
> 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: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX wn: <http://www.w3.org/2006/03/wn/wn20/schema/>
>
> SELECT DISTINCT ?label WHERE
> {
>  SERVICE <http://wordnet.rkbexplorer.com/sparql/>
>  {
>    ?s1 wn:memberMeronymOf 
> <http://wordnet.rkbexplorer.com/id/synset-solar_system-noun-1> .
>    ?s1 rdfs:label ?label.
>  }
>  MINUS
>  {
>   SERVICE <http://wordnet.rkbexplorer.com/sparql/>
>   {
>     ?s2 wn:hyponymOf 
> <http://wordnet.rkbexplorer.com/id/synset-Roman_deity-noun-1> .
>     ?s2 rdfs:label ?label.
>   }
>  }
>  BIND(URI(CONCAT("http://dbpedia.org/resource/", ?label)) AS ?dbpResource)
>  FILTER(EXISTS
>  {
>    SERVICE <http://dbpedia.org/sparql>
>    {
>      ?dbpResource a <http://dbpedia.org/ontology/Planet> .
>    }
>  })
> }
>
> Regards,
>
> Rob Vesse
>
> -- 
> PhD Student
> IAM Group
> Bay 20, Room 4027, Building 32
> Electronics&  Computer Science
> University of Southampton

Rob,

Nice!

And you change that into a SPARQL construct query and you have a 
linkeset that can be contributed back to DBpedia :-)


-- 

Regards,

Kingsley Idehen	
President&  CEO
OpenLink Software
Web: http://www.openlinksw.com
Weblog: http://www.openlinksw.com/blog/~kidehen
Twitter/Identi.ca: kidehen
Received on Tuesday, 12 April 2011 14:20:31 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 31 March 2013 14:24:32 UTC