map owl to neo4j (java example)
Asked Answered
S

1

0

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?

Subsume answered 12/12, 2013 at 13:16 Comment(8)
Did you import Reasoner correctly? If I remember correctly it was Ctrl+o to let Eclipse automatically solve the imports. Btw. I don't think you will get many answers to a specific question like that. Also try a forum/mailinglist for OWL or Neo4j. That is more likely to solve your problem.Glenoid
I have imported OWLReasoner (I don't have any Reasoner class in my added jar files).Subsume
Have you considered simply using an RDF database that supports OWL?Foolhardy
I know that is possible to use neo4j(proof of that is in the link above) for that and I want to need to use Cypher.Subsume
If you do /not/ need inferences, you do not need OWLReasoner or any implementation. The code you show will only check the ontology for inconsistencies, but that does not seem to have anything to do with your use case.Baryta
The code above is not a full code but the beginning which does not work for me. I'm a little bit lost in it. It is possible that the need some inference but the article which I use to do move data do not have any information about it. I have found similar example #17611977 - there is pellet (inference engine) used.Subsume
I found Reasoner in HermiT - it implements OWLReasoner so I guess HermiT is the jar you need to add to the classpath for this to compile.Baryta
You was right Ignazio - I have added HermitIt.jar.Subsume
S
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).

Subsume answered 17/12, 2013 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.