0

I am writing a RESTful Service in java program using Apache Jena OWL library. I already have my ontology created called. "university.owl" and trying to load it so i can make sqarql queries against it When I create a model with

OWLOntologyManager m=OWLManager.createOWLOntologyManager();
File file = new File(("D:/ontolog_project/universityont.owl"));
IRI iri = IRI.create(file);
System.out.println(iri);
System.out.println(iri.toString());

it works perfectly but the moment i create using the

Model model = ModelFactory.createDefaultModel(); 

I get an error like this

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.hp.hpl.jena.util.Metadata.<clinit>(Metadata.java:39)
    at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:34)
    at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:73)
    at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:54)
    at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:140)
    at Demo.main(Demo.java:66)
`Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 6 more

How do i resolve it?

Ekaku509
  • 17
  • 6
  • 1
    Sounds like you don't have slf4j on your classpath. – Joshua Taylor Jun 15 '16 at 20:58
  • 1
    The first part does not create a model, but simply creates a Java File object. And the first line is using the OWL API, not Jena. Once you use a class from Jena - your second code section - it looks for all necessary libs, and as @JoshuaTaylor already said, SLF4J is missing. – UninformedUser Jun 16 '16 at 06:39

0 Answers0