Examples of OWLEquivalentClassesAxiom


Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    }

    @Test
    public void shouldBuildEquivalentClasses() {
        // given
        OWLEquivalentClassesAxiom expected = df.getOWLEquivalentClassesAxiom(
                classes, annotations);
        BuilderEquivalentClasses builder = new BuilderEquivalentClasses(
                expected, df);
        // when
        OWLObject built = builder.buildObject();
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

        // First create the class Person and hasAge some int[>=13, <20]
        OWLClassExpression teenagePerson = factory.getOWLObjectIntersectionOf(
                person, teenagerAgeRestriction);
        OWLClass teenager = factory.getOWLClass(IRI.create(ontologyIRI
                + "#Teenager"));
        OWLEquivalentClassesAxiom teenagerDefinition = factory
                .getOWLEquivalentClassesAxiom(teenager, teenagePerson);
        manager.addAxiom(ont, teenagerDefinition);
        // Do the same for Adult that has an age greater than 21
        OWLDataRange geq21 = factory.getOWLDatatypeRestriction(integerDatatype,
                factory.getOWLFacetRestriction(MIN_INCLUSIVE, 21));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

                        if (conjuncts.contains(parent)) {
                            result.add(sca.getSubClass().asOWLClass());
                        }
                    }
                } else if (ax instanceof OWLEquivalentClassesAxiom) {
                    OWLEquivalentClassesAxiom eca = (OWLEquivalentClassesAxiom) ax;
                    for (OWLClassExpression ce : eca.getClassExpressions()) {
                        if (ce.containsConjunct(parent)) {
                            for (OWLClassExpression sub : eca
                                    .getClassExpressions()) {
                                if (!sub.isAnonymous() && !sub.equals(ce)) {
                                    result.add(sub.asOWLClass());
                                }
                            }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

            // remove axioms that differ only because of n-ary equivalence
            // axioms
            // http://www.w3.org/TR/owl2-mapping-to-rdf/#Axioms_that_are_Translated_to_Multiple_Triples
            for (OWLAxiom ax : new ArrayList<>(axioms1)) {
                if (ax instanceof OWLEquivalentClassesAxiom) {
                    OWLEquivalentClassesAxiom ax2 = (OWLEquivalentClassesAxiom) ax;
                    if (ax2.getClassExpressions().size() > 2) {
                        Set<OWLEquivalentClassesAxiom> pairs = ax2
                                .splitToAnnotatedPairs();
                        if (removeIfContainsAll(axioms2, pairs, destination)) {
                            axioms1.remove(ax);
                            axioms2.removeAll(pairs);
                        }
                    }
                } else if (ax instanceof OWLEquivalentDataPropertiesAxiom) {
                    OWLEquivalentDataPropertiesAxiom ax2 = (OWLEquivalentDataPropertiesAxiom) ax;
                    if (ax2.getProperties().size() > 2) {
                        Set<OWLEquivalentDataPropertiesAxiom> pairs = ax2
                                .splitToAnnotatedPairs();
                        if (removeIfContainsAll(axioms2, pairs, destination)) {
                            axioms1.remove(ax);
                            axioms2.removeAll(pairs);
                        }
                    }
                } else if (ax instanceof OWLEquivalentObjectPropertiesAxiom) {
                    OWLEquivalentObjectPropertiesAxiom ax2 = (OWLEquivalentObjectPropertiesAxiom) ax;
                    if (ax2.getProperties().size() > 2) {
                        Set<OWLEquivalentObjectPropertiesAxiom> pairs = ax2
                                .splitToAnnotatedPairs();
                        if (removeIfContainsAll(axioms2, pairs, destination)) {
                            axioms1.remove(ax);
                            axioms2.removeAll(pairs);
                        }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty propP = ObjectProperty(iri("p"));
        OWLClassExpression desc = ObjectSomeValuesFrom(propP, clsB);
        OWLClassExpression desc2 = ObjectSomeValuesFrom(propP, clsA);
        OWLEquivalentClassesAxiom ax = EquivalentClasses(clsA, desc);
        assertTrue(ax.containsNamedEquivalentClass());
        OWLEquivalentClassesAxiom ax2 = EquivalentClasses(desc, desc2);
        assertFalse(ax2.containsNamedEquivalentClass());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    public void testGetNamedClasses() {
        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty propP = ObjectProperty(iri("p"));
        OWLClassExpression desc = ObjectSomeValuesFrom(propP, clsB);
        OWLEquivalentClassesAxiom ax = EquivalentClasses(clsA, desc);
        Set<OWLClass> clses = ax.getNamedClasses();
        assertEquals(1, clses.size());
        assertTrue(clses.contains(clsA));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    @Test
    public void testGetNamedClassesWithNothing() {
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty propP = ObjectProperty(iri("p"));
        OWLClassExpression desc = ObjectSomeValuesFrom(propP, clsB);
        OWLEquivalentClassesAxiom ax = EquivalentClasses(OWLNothing(), desc);
        Set<OWLClass> clses = ax.getNamedClasses();
        assertTrue(clses.isEmpty());
        assertFalse(ax.containsOWLThing());
        assertTrue(ax.containsOWLNothing());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    @Test
    public void testGetNamedClassesWithThing() {
        OWLClass clsB = Class(iri("B"));
        OWLObjectProperty propP = ObjectProperty(iri("p"));
        OWLClassExpression desc = ObjectSomeValuesFrom(propP, clsB);
        OWLEquivalentClassesAxiom ax = EquivalentClasses(OWLThing(), desc);
        Set<OWLClass> clses = ax.getNamedClasses();
        assertTrue(clses.isEmpty());
        assertFalse(ax.containsOWLNothing());
        assertTrue(ax.containsOWLThing());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    @Test
    public void testSplit() {
        OWLClass clsA = Class(iri("A"));
        OWLClass clsB = Class(iri("B"));
        OWLClass clsC = Class(iri("C"));
        OWLEquivalentClassesAxiom ax = EquivalentClasses(clsA, clsB, clsC);
        Set<OWLSubClassOfAxiom> scas = ax.asOWLSubClassOfAxioms();
        assertEquals(6, scas.size());
        assertTrue(scas.contains(SubClassOf(clsA, clsB)));
        assertTrue(scas.contains(SubClassOf(clsB, clsA)));
        assertTrue(scas.contains(SubClassOf(clsA, clsC)));
        assertTrue(scas.contains(SubClassOf(clsC, clsA)));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom

    }

    @Test
    public void testAsSubAxiomsEquivalentClasses() {
        OWLClassExpression[] classExpressions = { C(IRI()), C(IRI()) };
        OWLEquivalentClassesAxiom objA = testSubject
                .getOWLEquivalentClassesAxiom(classExpressions);
        assertEquals(2, objA.asOWLSubClassOfAxioms().size());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.