A Java utility class for the Wordnet namespace

January 2nd, 2003  |  Published in java, rdf, wordnet  |  3 Comments

To support the work I’ve been doing with Wordnet and RDF, I wrote a utility Java class to handle URIs from the Wordnet ontology for RDF devised by Dan Brickley.


The class is implemented using the Java Wordnet Library package, which means it requires JDK 1.4.

The major methods are:

  • public Synset lookup(String uri)
  • Takes a URI string such as https://xmlns.com/wordnet/1.6/Dog and returns a JWNL Synset object representing the wordnet synset of that URI.

  • public String uri(Synset synset)
  • Takes a JWNL Synset object and returns its canonical URI string from the wordnet namespace.

The constructor takes a filename of a JWNL config file from which to configure the JWNL system.

Responses

  1. Javier Gramajo says:

    March 7th, 2003 at 11:01 am (#)

    Hi,

    I’m trying to start with jwnl, so a get from
    the specified source (http://sourceforge.net/project/)
    jwnl12_jdk14.zip
    jwnl12_jdk14_src.zip

    I make the installation to “c:\Program File\jwnl”

    I try to run your utility over Jbuilder7 with jdk 1.4, but I always get this error:

    java.lang.NumberFormatException: NUMBER_OF_VERB_FRAMES
    at java.lang.Integer.parseInt(Integer.java:426)
    at java.lang.Integer.parseInt(Integer.java:476)
    at net.didion.jwnl.data.VerbFrame.initialize(Unknown Source)
    at net.didion.jwnl.JWNL.initialize(Unknown Source)

    Even if I use only the Examples.java and give as a input parameter file_properties.xml or map_properties.xml

    I get these errors:

    net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.MapBackedDictionary

    at net.didion.jwnl.util.factory.Element.install(Unknown Source)

    at net.didion.jwnl.JWNL.initialize(Unknown Source)

    at wnginy.Examples.main(Examples.java:45)

    Caused by: net.didion.jwnl.JWNLException: Could not open dictionary files

    at net.didion.jwnl.dictionary.MapBackedDictionary.(Unknown Source)

    at net.didion.jwnl.dictionary.MapBackedDictionary.install(Unknown Source)

    at net.didion.jwnl.dictionary.MapBackedDictionary.install(Unknown Source)

    … 3 more

    Caused by: java.io.IOException: El sistema no puede hallar la ruta especificada

    at java.io.WinNTFileSystem.createFileExclusively(Native Method)

    at java.io.File.createNewFile(File.java:825)

    at net.didion.jwnl.princeton.file.PrincetonObjectDictionaryFile.openFile(Unknown Source)

    at net.didion.jwnl.dictionary.file.AbstractDictionaryFile.open(Unknown Source)

    at net.didion.jwnl.dictionary.file.DictionaryCatalog.open(Unknown Source)

    at net.didion.jwnl.dictionary.file.DictionaryCatalogSet.open(Unknown Source)

    … 6 more

    Can you help me, I’m trying to found Synonyms from a group of words.

    Thanks,

    Javier

  2. ashley says:

    January 25th, 2004 at 11:54 pm (#)

    I have the same problem as Javier but with version JWNL1.3.
    I ran the JWNLExample.java file on the command line in windows XP and got the following runtime error:
    >java cs276a.examples.JWNLExample
    Exception in thread “main” java.lang.NumberFormatException: For input string: “NUMBER_OF_VERB_FRAMES”
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at net.didion.jwnl.data.VerbFrame.initialize(VerbFrame.java:22)
    at net.didion.jwnl.JWNL.initialize(JWNL.java:133)
    at cs276a.examples.JWNLExample.main(JWNLExample.java:22)

    Any hints and help would be appreciated.
    Thanks

    -ashley

  3. Maurice says:

    May 23rd, 2004 at 5:52 pm (#)

    Computer security recourse: [Secure Root]