Object[] entities = ontologyTBox.getClassesInSignature().toArray();
Set<OWLAxiom> axiomsFromABox = ontologyABox.getAxioms();
for(OWLAxiom axiom: axiomsFromABox)
{
OWL.manager.applyChange( new AddAxiom( ontologyTBox, axiom ) );
}
PelletReasoner reasoner = com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.getInstance().createReasoner( ontologyTBox );
System.out.println("Entities:");
for(int i=0; i< entities.length; i++)
{
OWLClass obj = (OWLClass) entities[i];
String name = obj.toStringID();
System.out.println("Class: " + name.substring(name.indexOf("#")+1));
// get all instances of Person class
Set<OWLNamedIndividual> individuals = reasoner.getInstances( obj, false ).getFlattened();
for(OWLNamedIndividual ind : individuals) {
System.out.println("Individual: " + ind.toString());
}
System.out.println("---------------------------");
}
/*IncrementalClassifier classifier = new IncrementalClassifier( ontologyTBox );
classifier.classify()
classifier.getSubCl*/
//Object[] axioms = ontology.getAxioms().toArray();
/*System.out.println("Axioms:");
for(int i=0; i < 10; i++)
{
OWLAxiom axiom = (OWLAxiom) axioms[i];
System.out.println(axiom.toString());
}*/
// Get some entities
OWLClass headache = OWL.Class( NS + "Mesoscale" );
OWLClass pain = OWL.Class( NS + "SynopticScale" );
// Get an instance of the incremental classifier
IncrementalClassifier classifier = new IncrementalClassifier( ontologyTBox );
// We need some timing to show the performance of the classification
Timers timers = new Timers();
// We classify the ontology and use a specific timer to keep track of
// the time required for the classification
Timer t = timers.createTimer( "First classification" );
t.start();
classifier.classify();
t.stop();
System.out.println( "\nClassification time: " + t.getTotal() + "ms");
System.out.println( "Subclasses of " + pain + ": " + classifier.getSubClasses( pain, true ).getFlattened() + "\n");
// Now create a new OWL axiom, subClassOf(Headache, Pain)
OWLAxiom axiom = OWL.subClassOf( headache, pain );
// Add the axiom to the ontology, which creates a change event
OWL.manager.applyChange( new AddAxiom( ontologyTBox, axiom ) );
// Now we create a second timer to keep track of the performance of the
// second classification
t = timers.createTimer("Second classification");
t.start();