use of org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator in project goci by EBISPOT.
the class DefaultGWASOWLPublisher method saveGWASDataInferredView.
public void saveGWASDataInferredView(OWLReasoner reasoner, File outputFile) throws OWLConversionException {
try {
// create new ontology to hold inferred axioms
OWLOntology inferredOntology = getConverter().createConversionOntology();
getLog().info("Saving inferred view...");
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
// we require all inferred stuff except for disjoints...
gens.add(new InferredClassAssertionAxiomGenerator());
gens.add(new InferredDataPropertyCharacteristicAxiomGenerator());
gens.add(new InferredEquivalentClassAxiomGenerator());
gens.add(new InferredEquivalentDataPropertiesAxiomGenerator());
gens.add(new InferredEquivalentObjectPropertyAxiomGenerator());
gens.add(new InferredInverseObjectPropertiesAxiomGenerator());
gens.add(new InferredObjectPropertyCharacteristicAxiomGenerator());
gens.add(new InferredPropertyAssertionGenerator());
gens.add(new InferredSubClassAxiomGenerator());
gens.add(new InferredSubDataPropertyAxiomGenerator());
gens.add(new InferredSubObjectPropertyAxiomGenerator());
// now create the target ontology and save
OWLOntologyManager inferredManager = inferredOntology.getOWLOntologyManager();
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens);
iog.fillOntology(inferredManager, inferredOntology);
inferredManager.saveOntology(inferredOntology, IRI.create(outputFile));
getLog().info("Inferred view saved ok");
} catch (OWLOntologyStorageException e) {
throw new OWLConversionException("Failed to save GWAS data (inferred view)", e);
}
}
use of org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator in project stanbol by apache.
the class HermitReasoningServiceTest method testRun.
private void testRun(String testID, String expectedID) {
log.info("Testing the run() method");
OWLOntologyManager manager = TestData.manager;
// We prepare the input ontology
try {
OWLOntology testOntology = manager.createOntology();
OWLOntologyID testOntologyID = testOntology.getOntologyID();
log.debug("Created test ontology with ID: {}", testOntologyID);
AddImport addImport = new AddImport(testOntology, TestData.factory.getOWLImportsDeclaration(IRI.create(testID)));
manager.applyChange(addImport);
// We just test class assertions
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
gens.add(new InferredClassAssertionAxiomGenerator());
// Maybe we want to see what is in before
if (log.isDebugEnabled())
TestUtils.debug(manager.getOntology(testOntologyID), log);
// Now we test the method
log.debug("Running HermiT");
Set<OWLAxiom> inferred = this.theinstance.run(manager.getOntology(testOntologyID), gens);
// Maybe we want to see the inferred axiom list
if (log.isDebugEnabled()) {
TestUtils.debug(inferred, log);
}
// These are the set of expected axioms
Set<OWLLogicalAxiom> expectedAxioms = manager.getOntology(IRI.create(expectedID)).getLogicalAxioms();
Set<OWLAxiom> missing = new HashSet<OWLAxiom>();
for (OWLAxiom expected : expectedAxioms) {
if (!inferred.contains(expected)) {
log.error("missing expected axiom: {}", expected);
missing.add(expected);
}
}
log.info("Are all expected axioms in the result (true)? {}", missing.isEmpty());
assertTrue(missing.isEmpty());
// We want to remove the ontology from the manager
manager.removeOntology(testOntology);
} catch (OWLOntologyCreationException e) {
log.error("An {} have been thrown while creating the input ontology for test", e.getClass());
assertTrue(false);
} catch (org.apache.stanbol.reasoners.servicesapi.ReasoningServiceException e) {
log.error("An {} have been thrown while executing the reasoning", e.getClass());
assertTrue(false);
} catch (org.apache.stanbol.reasoners.servicesapi.InconsistentInputException e) {
log.error("An {} have been thrown while executing the reasoning", e.getClass());
assertTrue(false);
}
}
use of org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator in project stanbol by apache.
the class AbstractOWLApiReasoningService method getClassifyAxiomGenerators.
/**
* {@see InferredAxiomGenerator}s to use for the classify() reasoning method.
*
* Subclasses may want to change this.
*
* @return
*/
protected List<InferredAxiomGenerator<? extends OWLAxiom>> getClassifyAxiomGenerators() {
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
gens.add(new InferredClassAssertionAxiomGenerator());
gens.add(new InferredSubClassAxiomGenerator());
gens.add(new InferredEquivalentClassAxiomGenerator());
gens.add(new InferredDisjointClassesAxiomGenerator());
return gens;
}
use of org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator in project stanbol by apache.
the class AbstractOWLApiReasoningService method getEnrichAxiomGenerators.
/**
* {@see InferredAxiomGenerator}s to use for the enrich() reasoning method.
*
* Subclasses may want to change this.
*
* @return
*/
protected List<InferredAxiomGenerator<? extends OWLAxiom>> getEnrichAxiomGenerators() {
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
// Classes
gens.add(new InferredClassAssertionAxiomGenerator());
gens.add(new InferredSubClassAxiomGenerator());
gens.add(new InferredEquivalentClassAxiomGenerator());
gens.add(new InferredDisjointClassesAxiomGenerator());
// data properties
gens.add(new InferredDataPropertyCharacteristicAxiomGenerator());
gens.add(new InferredEquivalentDataPropertiesAxiomGenerator());
gens.add(new InferredSubDataPropertyAxiomGenerator());
// object properties
gens.add(new InferredEquivalentObjectPropertyAxiomGenerator());
gens.add(new InferredInverseObjectPropertiesAxiomGenerator());
gens.add(new InferredObjectPropertyCharacteristicAxiomGenerator());
gens.add(new InferredSubObjectPropertyAxiomGenerator());
// individuals
gens.add(new InferredClassAssertionAxiomGenerator());
gens.add(new InferredPropertyAssertionGenerator());
return gens;
}
Aggregations