问题
I want to map ontology from OWL into Neo4j database. I have found some example here.
If I understand it well I need to create Java program with OWL API libraries included. I don't need any inference engine (according to this: Mapping from an OWL ontology to Neo4j graph database).
I have created project in Eclipse add OWL API (and oboformat) libraries and paste the code
private void importOntology(OWLOntology ontology) throws Exception {
OWLReasoner reasoner = new Reasoner(ontology);
if (!reasoner.isConsistent()) {
logger.error("Ontology is inconsistent");
// Throw your exception of choice here
throw new Exception("Ontology is inconsistent");
}
Transaction tx = db.beginTx();
try {
...
}
}
I have got an error in line: new Reasoner(ontology); - that there is no class Reasoner, I don't understand if I need to use some reasoner inference engine like Hermit or Pellet ?
I have got also error in line Transaction tx = db.beginTx();. Do I need use spring framework to run this example?
回答1:
Reasoner class is in Hermit OWL Reasoner. To solve the problem you should add HermiT.jar file to your project.
Transaction class in this example is from neo4j libraries (org.neo4j.graphdb.Transaction).
来源:https://stackoverflow.com/questions/20544598/map-owl-to-neo4j-java-example