0
votes

Post-Answer Edit: This was an issue that arose primarily due to IDE issues. This is more likely to be useful if you are new to eclipse, or java programming in general while also learning about OWL.

I am very new to OWL in general, and need to familiarize myself with the OWL API for a project I am working on. I am a bit rusty on my java, so maybe my issue is there, though I do not think so.

Issue: I have been playing with OWL API for several days and am having trouble finding compatible versions of libraries necessary to do ANYTHING. Here is some example code of a very basic operation I am trying to perform:

package converter;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLOntologyManager;

public class OWL_Converter {

    OWLOntologyManager m = OWLManager.createOWLOntologyManager();
}

This throws exactly 11,362 errors for me when I try to build in eclipse. The first 50 or so of these errors say things like "AbstractAnnotatedAxiomRoundTrippingTestCase cannot be resolved to a type". Please someone help me figure out what I am doing wrong. I have been messing around with OWL and OWL api for the past three days with very slow progress, and now I am hitting walls like this where it seems that no matter how many of the OWL api classes I import, I still have unresolved types from indirect references of classes, etc...

The stack trace appears as below:

Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
    at org.semanticweb.owlapi.OWLAPIServiceLoaderModule.<clinit>(OWLAPIServiceLoaderModule.java:50)
    at org.semanticweb.owlapi.apibinding.OWLManager.<clinit>(OWLManager.java:42)
    at owl_converter.Converter.main(Converter.java:115)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 9 more
1
What exactly are you doing? I have been working with OWL api for the last 3 years and think it has the best getting started guide. Also, the code that you have written is totally fine. Please add the stack trace so that we can see what is wrong. - Artemis
@Artemis , thanks for responding. It's good to hear that someone has had a smoother process onboarding to owl - it gives me hope that I can too. For myself, outside of these bizzare errors I am seeing, I have also had issues with the documentation. On each of the examples I have sifted through, there always seems to be at least one function that was deprecated since its creation, and then I cannot seem to find information on how it was replaced. As I am just beginning, it just becomes a bit over whelming :/ Also, edited the original post to include the stack trace. Thanks! - Dude
You need to add the apache logger for this to work. You are missing the slf4j log api. Add that and then repost the next problem. Generally this line of code is totally fine. - Artemis
I added it, but it did not seem to do anything. In fact when I imported the library in my java file, it is indicated by eclipse as not being used. - Dude
Without seeing your whole code is impossible to say what is wrong. The stack trace indicates the absence of some APIs. Follow Ignazio's suggestion or put your code on github and give people access for us to see what is wrong. I think it is mainly the compilation that is the problem not the OWL API. - Artemis

1 Answers

0
votes

Are you compiling the OWL API source? You can skip having to fill in all dependencies manually in two ways:

  • import existing maven project in Eclipse (this will use the pom files to determined dependencies)

  • look at the classpath files in the antbuild folder and make sure your .classpath file matches.

You might need to do a maven test build to ensure the libraries are downloaded.