Password
Title
Content
Bravo! A solution to the latest SPARQL puzzle.
@glenn_mcdonald found a way of getting the non-Roman-god solar system bodies:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wn: <http://www.w3.org/2006/03/wn/wn20/schema/> PREFIX id: <http://wordnet.rkbexplorer.com/id/> SELECT DISTINCT ?planet WHERE { ?s1 wn:memberMeronymOf id:synset-solar_system-noun-1 . ?s1 rdfs:label ?planet . OPTIONAL { ?s1 wn:containsWordSense ?ws1 . ?ws1 wn:word ?w . ?ws2 wn:word ?w . ?s2 wn:containsWordSense ?ws2 . ?s2 wn:hyponymOf id:synset-Roman_deity-noun-1 . } FILTER (!bound(?s2)) }
Isolating just the planets looks to be out of reach using the WordNet endpoint alone, but I guess that can be left as a challenge for federated query e.g. CONSTRUCTs from different datasets into a local store before SELECTing.
Update
From RobVesse -
Here's an even simpler query for yesterdays puzzle - still doesn't isolate real planets though
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 { ?s1 wn:memberMeronymOf <http://wordnet.rkbexplorer.com/id/synset-solar_system-noun-1> . ?s1 rdfs:label ?label. OPTIONAL { ?s2 wn:hyponymOf <http://wordnet.rkbexplorer.com/id/synset-Roman_deity-noun-1> . ?s2 rdfs:label ?label. } FILTER (!BOUND(?s2)) }
...plus...
Here's a soln using wordnet and dbpedia to show only planets not named after roman gods, requires a SPARQL 1.1 engine to run
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)
Here's a suitable engine: Leviathan (a demo of the SPARQL Engine used in dotNetRDF).
Tags
Date