Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Java API hard to install?

Tom Groves
2006-10-19
2013-05-28
  • Tom Groves
    Tom Groves
    2006-10-19

    Is it just me, or is the Java API really hard to get working? I have an OpenCyc server running on one machine, and I want to be able to access it from Java, either on the same machine (Linux) or another (Windows) on which I _don't_ want to install the whole package due to space constraints.

    I got the Java classes out of the package and added them to my Java lib directories, which let my Java code see and import the org.opencyc.api stuff, but trying to run the ApiDemo or simply create a CycAccess object causes all sorts of errors due to missing classes.

    Some further searching found me this:

    Required Libraries for OpenCyc java developers
    ----------------------------------------------
    JUnit
    Jakarta Oro
    Jakarta Commons
    Weka
    Violin Strings
    FIPA OS
    Xerces-J
    -------------

    That comes to about 36 different packages! Each of which has its own (sometime complex or poorly documented) install. But the total size isn't much - certainly much smaller than the main OpenCyc package. Isn't it possible to add these to the OpenCyc package, and have it optionally install them?

    All I really need to be able to do is send Strings to the server, and get an array or tree of Strings or other objects back. Why does that require me to install so many other projects? A simple web browser can do it, so I would have thought there'd be a Java class to save me having to handle the HTML bits myself...

     
    • jazz
      jazz
      2007-02-23

      You don't need all these packages. I added just OpenCyc.jar and jakarta-oro-2.0.4.jar (both taken from the OpenCyc 1.0 lib dir) to my project and I was set.

      After that, querying Cyc was as easy as this:

          CycAccess cyc = new CycAccess("localhost", 3600);

          CycConstant constant = cyc.getRandomConstant();
          System.out.println("Constant: " + constant);

          CycConstant mother = cyc.getConstantByName("HumanMother");
          System.out.println(mother);

          CycList isas = cyc.getAllIsa(mother);
          System.out.println("isas: " + isas.size());
          for (Object isa : isas) {
            System.out.println(isa);
          }

          cyc.close();

      I am actually surprised how quickly I got started there.

      -jazz