Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction


                addQualifiers(c, ax.getAnnotations());
            } else if (sup instanceof OWLObjectCardinalityRestriction) {
                // OWLObjectExactCardinality
                // OWLObjectMinCardinality
                // OWLObjectMaxCardinality
                OWLObjectCardinalityRestriction cardinality = (OWLObjectCardinalityRestriction) sup;
                OWLClassExpression filler = cardinality.getFiller();
                if (filler.isBottomEntity() || filler.isTopEntity()) {
                    error(TOP_BOTTOM_NONTRANSLATEABLE, ax, false);
                    return;
                }
                String fillerId = getIdentifier(filler);
                if (fillerId == null) {
                    error(ax, true);
                    return;
                }
                f.addClause(createRelationshipClauseWithCardinality(
                        cardinality, fillerId, qvs, ax));
            } else if (sup instanceof OWLQuantifiedObjectRestriction) {
                // OWLObjectSomeValuesFrom
                // OWLObjectAllValuesFrom
                OWLQuantifiedObjectRestriction r = (OWLQuantifiedObjectRestriction) sup;
                OWLClassExpression filler = r.getFiller();
                if (filler.isBottomEntity() || filler.isTopEntity()) {
                    error(TOP_BOTTOM_NONTRANSLATEABLE, ax, false);
                    return;
                }
                String fillerId = getIdentifier(filler);
                if (fillerId == null) {
                    error(ax, true);
                    return;
                }
                f.addClause(createRelationshipClauseWithRestrictions(r,
                        fillerId, qvs, ax));
            } else if (sup instanceof OWLObjectIntersectionOf) {
                OWLObjectIntersectionOf i = (OWLObjectIntersectionOf) sup;
                List<Clause> clauses = new ArrayList<>();
                for (OWLClassExpression operand : i.getOperands()) {
                    if (operand instanceof OWLObjectCardinalityRestriction) {
                        OWLObjectCardinalityRestriction restriction = (OWLObjectCardinalityRestriction) operand;
                        OWLClassExpression filler = restriction.getFiller();
                        if (filler.isBottomEntity() || filler.isTopEntity()) {
                            error(TOP_BOTTOM_NONTRANSLATEABLE, ax, false);
                            return;
                        }
                        String fillerId = getIdentifier(filler);
                        if (fillerId == null) {
                            error(ax, true);
                            return;
                        }
                        clauses.add(createRelationshipClauseWithCardinality(
                                restriction, fillerId, new HashSet<>(qvs), ax));
                    } else if (operand instanceof OWLQuantifiedObjectRestriction) {
                        OWLQuantifiedObjectRestriction restriction = (OWLQuantifiedObjectRestriction) operand;
                        OWLClassExpression filler = restriction.getFiller();
                        if (filler.isBottomEntity() || filler.isTopEntity()) {
                            error(TOP_BOTTOM_NONTRANSLATEABLE, ax, false);
                            return;
                        }
                        String fillerId = getIdentifier(filler);
View Full Code Here


    @Test
    public void testCreationExactCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectExactCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        assertNotNull(restA);
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectExactCardinality(cardinality, prop, cls);
        assertNotNull(restB);
    }
View Full Code Here

    @Test
    public void testEqualsPositiveExactCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectExactCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectExactCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        assertEquals(restA, restB);
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restC = testSubject
                .getOWLObjectExactCardinality(cardinality, prop, cls);
        OWLObjectCardinalityRestriction restD = testSubject
                .getOWLObjectExactCardinality(cardinality, prop, cls);
        assertEquals(restC, restD);
    }
View Full Code Here

    @Test
    public void testEqualsNegativeExactCard() {
        OWLObjectProperty prop = OP(IRI());
        // Different cardinality
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectExactCardinality(3, prop,
                        testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectExactCardinality(4, prop,
                        testSubject.getOWLThing());
        assertFalse(restA.equals(restB));
        // Different property
        OWLObjectCardinalityRestriction restC = testSubject
                .getOWLObjectExactCardinality(3, OP(IRI()),
                        testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restD = testSubject
                .getOWLObjectExactCardinality(3, OP(IRI()),
                        testSubject.getOWLThing());
        assertFalse(restC.equals(restD));
        // Different filler
        OWLObjectCardinalityRestriction restE = testSubject
                .getOWLObjectExactCardinality(3, prop, C(IRI()));
        OWLObjectCardinalityRestriction restF = testSubject
                .getOWLObjectExactCardinality(3, prop, C(IRI()));
        assertFalse(restE.equals(restF));
    }
View Full Code Here

    @Test
    public void testHashCodeExactCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectExactCardinality(cardinality, prop, cls);
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectExactCardinality(cardinality, prop, cls);
        assertEquals(restA.hashCode(), restB.hashCode());
    }
View Full Code Here

    @Test
    public void testCreationMaxCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        assertNotNull(restA);
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop, cls);
        assertNotNull(restB);
    }
View Full Code Here

    @Test
    public void testEqualsPositiveMaxCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        assertEquals(restA, restB);
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restC = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop, cls);
        OWLObjectCardinalityRestriction restD = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop, cls);
        assertEquals(restC, restD);
    }
View Full Code Here

    @Test
    public void testEqualsNegativeMaxCard() {
        OWLObjectProperty prop = OP(IRI());
        // Different cardinality
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectMaxCardinality(3, prop, testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectMaxCardinality(4, prop, testSubject.getOWLThing());
        assertFalse(restA.equals(restB));
        // Different property
        OWLObjectCardinalityRestriction restC = testSubject
                .getOWLObjectMaxCardinality(3, OP(IRI()),
                        testSubject.getOWLThing());
        OWLObjectCardinalityRestriction restD = testSubject
                .getOWLObjectMaxCardinality(3, OP(IRI()),
                        testSubject.getOWLThing());
        assertFalse(restC.equals(restD));
        // Different filler
        OWLObjectCardinalityRestriction restE = testSubject
                .getOWLObjectMaxCardinality(3, prop, C(IRI()));
        OWLObjectCardinalityRestriction restF = testSubject
                .getOWLObjectMaxCardinality(3, prop, C(IRI()));
        assertFalse(restE.equals(restF));
    }
View Full Code Here

    @Test
    public void testHashCodeMaxCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop, cls);
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectMaxCardinality(cardinality, prop, cls);
        assertEquals(restA.hashCode(), restB.hashCode());
    }
View Full Code Here

    @Test
    public void testCreationMinCard() {
        OWLObjectProperty prop = OP(IRI());
        int cardinality = 3;
        OWLObjectCardinalityRestriction restA = testSubject
                .getOWLObjectMinCardinality(cardinality, prop,
                        testSubject.getOWLThing());
        assertNotNull(restA);
        OWLClassExpression cls = C(IRI());
        OWLObjectCardinalityRestriction restB = testSubject
                .getOWLObjectMinCardinality(cardinality, prop, cls);
        assertNotNull(restB);
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLObjectCardinalityRestriction

Copyright © 2018 www.massapicom. 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.