Search code examples
javaowlprotegeowl-api

Why I cant create an ontology?


I am currently getting started with OWL. I believe that I have setted up the correct .jar for the OWL API. However, when I compile the code I get an error on the line:

OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

The error says :

cannot access com.google.inject.Provider 
class file for com.google.inject.Provider not found

Any ideas on what might be causing the issue?


Solution

  • If you use pom, be sure you use correct dependency as is written here.

    <dependency>
        <groupId>net.sourceforge.owlapi</groupId>
        <artifactId>owlapi-distribution</artifactId>
        <version>5.1.0</version>
    </dependency>
    

    If you use jar file, as you exactly wrote, so be sure, you added it correct as is written here

    Afterwards, be sure, you imported the correct package in your Class. And also, be sure you downloaded all you need, like that

    For start line in your question, you need that imports

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

    And better, try to use maven as was written here