map owl to neo4j (java example)

こ雲淡風輕ζ 提交于 2019-12-08 13:02:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!