简体   繁体   中英

Trouble while loading an ontology with Pellet API

I want to use Jena Pellet API as Reasoner for infering new data in an owl file . I've downloaded the jar file pellet.jar and I've attached It to my Eclipse java project. However I'm still getting this error message while running my projet.

Can someone know what I missed here ?

here is my code

public class Mainprogram {

    public static String FILENAME = "file:./sample.owl";

    public static void main( String[] args ) {
        new Mainprogram().run();
    }

    protected OntModel getSoctraceOntology(){

        OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);

        model.read(FILENAME, null, "RDF/XML");          

        // validation report
        ValidityReport report = model.validate();

        printIterator(report.getReports(), "Validation Rresults");          

        return model;

    }       
}

and here is the error message

Exception in thread "main" java.lang.NoClassDefFoundError: com/clarkparsia/pellet/rules/ContinuousRulesStrategy
at org.mindswap.pellet.jena.OWLReasoner.<init>(OWLReasoner.java:90)
at org.mindswap.pellet.jena.PelletInfGraph.<init>(PelletInfGraph.java:146)
at org.mindswap.pellet.jena.PelletReasoner.bind(PelletReasoner.java:78)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.generateGraph(OntModelImpl.java:2744)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:139)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:128)
at com.hp.hpl.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:410)
at soctrace.Mainprogram.getSoctraceOntology(Mainprogram.java:72)
at soctrace.Mainprogram.run(Mainprogram.java:39)
at soctrace.Mainprogram.main(Mainprogram.java:34)
Caused by: java.lang.ClassNotFoundException: com.clarkparsia.pellet.rules.ContinuousRulesStrategy
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 10 more

Thanks for any Help.

Edition

i'm using the pellet-1.3.zip file downloaded from mindswap.org and the pellet.core.jar file downloaded from java2s.com

Can you please provide more details?

What is the Pellet version you are using? Did you check the examples those have given as part of pellet source code distribution? There are some examples for Jena also.

Apart from that, ContinuousRulesStrategy is part of com.clarkparsia.pellet.rules package. Please check if all the required jars are attached or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM