Search code examples
nlpsparqlwordnet

Wordnet access using queries


Has anyone seen a library to access Wordnet using some sort of query language? My idea is that there should be a way to write something like:

SELECT hypernyms(word, level)
WHERE word = 'art'

I've already consulted SharpNLP, but is not quite what I want. It's awesome, but not what I'm looking for. Should I use some query language, like SPARQL or some homemade dialect of SQL?


Solution

  • You can run directly SPARQL queries over the Wordnet database from the following SPARQL the endpoint hosted by Talis at:

    There's an RDF version of Wordnet loaded in it. Also see Wordnet 3.0 in RDF. Having an RDF version of the Wordnet data allows you to directly use SPARQL to query it. I have just tested it a bit and you can run something like:

    SELECT * WHERE { 
      ?s <http://www.w3.org/2006/03/wn/wn20/schema/hyponymOf> ?o
    }
    LIMIT 10
    

    This query would get a small sample of hyponyms. If you want to get it from here and learn SPARQL I recommend you as a start the Jena/ARQ SPARQL Tutorial.

    Edit

    In another question, exploratory SPARQL queries?, you can see how to run Exploratory SPARQL queries to investigate the structure of a dataset behind a SPARQL endpoint.