ReduceOperation { public static void reduce(OWLOntology ontology, OWLReasonerFactory reasonerFactory) throws OWLOntologyCreationException { reduce(ontology, reasonerFactory, getDefaultOptions()); }  static Map<String, String> getDefaultOptions(); static void reduce(OWLOntology ontology, OWLReasonerFactory reasonerFactory); static void reduce(
      OWLOntology ontology, OWLReasonerFactory reasonerFactory, Map<String, String> options);  }
@Test public void testRemoveRedundantSubClassAxiomsPreserveAnnotated() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/redundant_subclasses.owl"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); options.put("preserve-annotated-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/without_redundant_subclasses.owl", reasoned); OWLOntology reasoned2 = loadOntology("/redundant_subclasses.owl"); Map<String, String> options2 = new HashMap<String, String>(); options2.put("remove-redundant-subclass-axioms", "true"); options2.put("preserve-annotated-axioms", "true"); options2.put("named-classes-only", "true"); ReduceOperation.reduce(reasoned2, reasonerFactory, options2); assertIdentical("/without_redundant_subclasses.owl", reasoned2); }
@Test public void testRemoveRedundantSubClassAxiomsComplete() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/redundant_subclasses.owl"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); options.put("preserve-annotated-axioms", "false"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/without_redundant_subclasses2.owl", reasoned); }
@Test public void testRemoveRedundantSubClassExpressionAxioms() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/redundant_expr.obo"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/redundant_expr_reduced.obo", reasoned); }
@Test public void testReduceWithReflexivity() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/reduce_reflexivity_test.obo"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/reduce_reflexivity_test_reduced.obo", reasoned); }
@Test public void testReduceGci() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/reduce_gci_test.obo"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/reduce_gci_reduced.obo", reasoned); }
@Test public void testReduceWithEquiv() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/equiv_reduce_test.obo"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/equiv_reduce_test_reduced.obo", reasoned); }
@Test public void testReduceEdgeCase() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/reduce-edgecase-cnd.obo"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); options.put("remove-redundant-subclass-axioms", "true"); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/reduce-edgecase-cnd-reduced.obo", reasoned); }
@Test public void testReduceDomainCase() throws IOException, OWLOntologyCreationException { OWLOntology reasoned = loadOntology("/reduce-domain-test.owl"); OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); Map<String, String> options = new HashMap<String, String>(); ReduceOperation.reduce(reasoned, reasonerFactory, options); assertIdentical("/reduce-domain-test.owl", reasoned); }
@Test public void testReducedNamedOnly() throws OWLOntologyCreationException, IOException { OWLReasonerFactory reasonerFactory = new org.semanticweb.elk.owlapi.ElkReasonerFactory(); OWLOntology ontologyA = loadOntology("/reduce-named-only-test.ofn"); Map<String, String> optionsA = new HashMap<String, String>(); optionsA.put("named-classes-only", "true"); ReduceOperation.reduce(ontologyA, reasonerFactory, optionsA); assertIdentical("/reduce-named-only-test-named-only-true-reduced.ofn", ontologyA); OWLOntology ontologyB = loadOntology("/reduce-named-only-test.ofn"); Map<String, String> optionsB = new HashMap<String, String>(); optionsB.put("named-classes-only", "false"); ReduceOperation.reduce(ontologyB, reasonerFactory, optionsB); assertIdentical("/reduce-named-only-test-named-only-false-reduced.ofn", ontologyB); }