How to check ontology compliance using java

I use Ontology to recognize user actions .... I have an ontology (OWL) consisting of various classes that I will use with the properties of an object .....

I am new to ontology and am confused even after reading a lot about it ....
I understand that a class is defined relative to another class using various propositions ... anyway, I can check if the objects of a certain class are associated with another class. What I want to ask, how can I check if ABox matches the terminological part of the ontology (TBox, as I understand it) .....

I used a protege to create my ontology, and also tried using jena and herlet reasoner along with its GUI version of SWOOP to check the sequence.

I am completely confused and have no idea what to use ...

+4
source share
3 answers

I used the Jena API to work with ontologies created by Protege earlier. Jena, however, is confusing. However, these are the resources I used to figure this out:

To find out how this works, we made a few splashes where we created a very simple OWL file and wrote Java using Jena to see how we can get what we need. The code was one-time, but it allowed us to learn a little about the OWL and Jena API files in an idealized context.

0
source

SWOOP is pretty outdated if you are going to use the GUI, I recommend you stick with Protoge 4. For information on using Pellet there is a pretty good online tutorial .

I recommend using OWLAPI on Jena if you are going to work with OWL programmatically. Jena is a more RDF-oriented API, while OWLAPI is for OWL, so it will be easier to work with when you do OWL-related things. However, the yen is much more functional.

+2
source

Here's how you can perform consistency checking with the Java OWL API:

/*Load your ontology from a local file and do the initialisations*/ File inputfile = new File("ontologyPath"); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); ; OWLDataFactory dataFactory = manager.getOWLDataFactory(); OWLOntology yourOntology = manager.loadOntologyFromOntologyDocument(inputfile); IRI ontologyIRI = yourOntology.getOntologyID().getOntologyIRI(); /* Load a reasoner, the default one that comes with the OWL API is HermiT. However, You can use other reasoners, such as Fact++ or Pellet, by downloading their libraries and adding them to your project build path */ OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory(); OWLReasonerreasoner = reasonerFactory.createReasoner(yourOntology); /* Perform consistency check */ boolean consistency = reasoner.isConsistent(); 

Also check out the examples on the OWL API website.

Berkan

0
source

All Articles