src/test/java/tests/abstraction/AbstracterTest.java
/**
     * Simple test that shows how abstracter works
     **/
Simple test that shows how abstracter works
Simple test that shows how abstracter works
@Test
    public void test0() throws OWLOntologyCreationException {
        IRI base = IRI.create("http://example.org#");
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLDataFactory factory = manager.getOWLDataFactory();
        OWLOntology o = manager.createOntology(base);
        OWLClass A = factory.getOWLClass(base + "A");
        OWLClass B = factory.getOWLClass(base + "B");
        OWLObjectProperty p = factory.getOWLObjectProperty(base + "p");
        o.add(factory.getOWLDeclarationAxiom(A));
        o.add(factory.getOWLDeclarationAxiom(B));
        o.add(factory.getOWLDeclarationAxiom(p));
        o.add(factory.getOWLEquivalentClassesAxiom(A,
                factory.getOWLObjectSomeValuesFrom(p, B)));
        Abstracter abstracter = new AbstracterImpl(o);
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLNamedIndividual b = factory.getOWLNamedIndividual(base + "b");
        OWLNamedIndividual event = factory.getOWLNamedIndividual(base + "a");
        axioms.add(factory.getOWLObjectPropertyAssertionAxiom(p, event, b));
        axioms.add(factory.getOWLClassAssertionAxiom(B, b));
        Set<OWLClass> types = abstracter.lift(o, event);
        Set<OWLClass> expected_types = new HashSet<>();
        expected_types.add(A);
        expected_types.add(OWL.Thing);
        assertEquals(types.size(), 2);
        assertTrue(types.containsAll(expected_types));
    }
@ Test public void test0 ( ) throws OWLOntologyCreationException { IRI base = IRI . create ( "http://example.org#" ) ; OWLOntologyManager manager = OWLManager . createOWLOntologyManager ( ) ; OWLDataFactory factory = manager . getOWLDataFactory ( ) ; OWLOntology o = manager . createOntology ( base ) ; OWLClass A = factory . getOWLClass ( base + "A" ) ; OWLClass B = factory . getOWLClass ( base + "B" ) ; OWLObjectProperty p = factory . getOWLObjectProperty ( base + "p" ) ; o . add ( factory . getOWLDeclarationAxiom ( A ) ) ; o . add ( factory . getOWLDeclarationAxiom ( B ) ) ; o . add ( factory . getOWLDeclarationAxiom ( p ) ) ; o . add ( factory . getOWLEquivalentClassesAxiom ( A , factory . getOWLObjectSomeValuesFrom ( p , B ) ) ) ; Abstracter abstracter = new AbstracterImpl ( o ) ; Set < OWLAxiom > axioms = new HashSet < > ( ) ; OWLNamedIndividual b = factory . getOWLNamedIndividual ( base + "b" ) ; OWLNamedIndividual event = factory . getOWLNamedIndividual ( base + "a" ) ; axioms . add ( factory . getOWLObjectPropertyAssertionAxiom ( p , event , b ) ) ; axioms . add ( factory . getOWLClassAssertionAxiom ( B , b ) ) ; Set < OWLClass > types = abstracter . lift ( o , event ) ; Set < OWLClass > expected_types = new HashSet < > ( ) ; expected_types . add ( A ) ; expected_types . add ( OWL . Thing ) ; assertEquals ( types . size ( ) , 2 ) ; assertTrue ( types . containsAll ( expected_types ) ) ; }
Simple test that shows how abstracter works
Simple test that shows how abstracter works
// add the axioms