简体   繁体   中英

Import Pellet Reasoner into Jena

I am trying to import Pellet reasoner into Jena, the newest version of Pellet is 2.3.1 where I can't find any .jar file to be imported. Also, I followed the Wiki/FAQ to run the bash file in the release folder under Mac OS. The error message shown as:

Error: Unable to access jarfile lib/pellet-cli.jar

It seems that I have to export a jar file by myself and import the jar into my Jena workplace and I did, but Java exception appears when I use OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC );

The exception message is:

java.lang.NoClassDefFoundError:
org/mindswap/pellet/utils/progress/ProgressMonitor
at org.mindswap.pellet.jena.PelletReasoner.bind(PelletReasoner.java:95)
at org.mindswap.pellet.jena.PelletReasoner.bind(PelletReasoner.java:1)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.generateGraph(OntModelImpl.java:2852)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:142)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:131)
at com.hp.hpl.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:300)
at smarthome.ReasoningController.main(ReasoningController.java:113)
at smarthome.SmartHomeGUI.main(SmartHomeGUI.java:34)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.mindswap.pellet.utils.progress.ProgressMonitor
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)
... 19 more` 

How can I fix this problem? Thanks in advance.

User ignazio1977 over on google groups created a git repository from which you can download a .zip archive of the various jars needed for pellet. It looks like your missing a class package and this might solve your problem.

https://github.com/ignazio1977/pellet/blob/releases/pellet-distribution-2.3.2-SNAPSHOT-dist.zip

first off @Pranay's answer is dead on. However both Jena and Pellet have been updated since then. Jena is now in version 2.13.x and pellet is in 2.4.0 Therefore if you want to update to the latest you are going to have to create a new pellet .jar file. Please refer to this file https://github.com/Complexible/pellet/blob/master/pom.xml
in order to find out all of the dependencies and their respective versions.

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