Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLObjectIntersectionOf


                    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);
View Full Code Here


    @Override
    protected void addAxioms(OWLClass entity, @Nonnull OWLReasoner reasoner,
            OWLDataFactory dataFactory, Set<OWLDisjointClassesAxiom> result) {
        for (OWLClass cls : getAllEntities(reasoner)) {
            if (!cls.equals(entity)) {
                OWLObjectIntersectionOf intersection = dataFactory
                        .getOWLObjectIntersectionOf(CollectionFactory
                                .createSet(entity, cls));
                if (!reasoner.isSatisfiable(intersection)) {
                    result.add(dataFactory.getOWLDisjointClassesAxiom(entity,
                            cls));
View Full Code Here

        // Now create the actual restriction
        OWLObjectAllValuesFrom hasGenderOnlyMaleFemale = factory
                .getOWLObjectAllValuesFrom(hasGender, maleOrFemale);
        // Finally, we bundle these restrictions up into an intersection, since
        // we want person to be a subclass of the intersection of them
        OWLObjectIntersectionOf intersection = factory
                .getOWLObjectIntersectionOf(hasAgeRestriction,
                        hasGenderRestriction, hasGenderOnlyMaleFemale);
        // And now we set this anonymous intersection class to be a superclass
        // of Person using a subclass axiom
        manager.addAxiom(ont,
View Full Code Here

    }

    @Test
    public void shouldBuildObjectIntersectionOf() {
        // given
        OWLObjectIntersectionOf expected = df
                .getOWLObjectIntersectionOf(classes);
        BuilderObjectIntersectionOf builder = new BuilderObjectIntersectionOf(
                expected, df);
        // when
        OWLObject built = builder.buildObject();
View Full Code Here

                        .getSubClassAxiomsForSubClass(child)) {
                    OWLClassExpression superCls = ax.getSuperClass();
                    if (!superCls.isAnonymous()) {
                        result.add(superCls.asOWLClass());
                    } else if (superCls instanceof OWLObjectIntersectionOf) {
                        OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) superCls;
                        for (OWLClassExpression conjunct : intersectionOf
                                .asConjunctSet()) {
                            if (!conjunct.isAnonymous()) {
                                result.add(conjunct.asOWLClass());
                            }
                        }
                    }
                }
                for (OWLEquivalentClassesAxiom ax : ont
                        .getEquivalentClassesAxioms(child)) {
                    for (OWLClassExpression ce : ax
                            .getClassExpressionsMinus(child)) {
                        if (!ce.isAnonymous()) {
                            result.add(ce.asOWLClass());
                        } else if (ce instanceof OWLObjectIntersectionOf) {
                            OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) ce;
                            for (OWLClassExpression conjunct : intersectionOf
                                    .asConjunctSet()) {
                                if (!conjunct.isAnonymous()) {
                                    result.add(conjunct.asOWLClass());
                                }
                            }
View Full Code Here

        checkIntersection(expression, "GO:0018901", "BFO:0000050", "GO:0055124");
    }

    private static void checkIntersection(OWLClassExpression expression,
            String genus, String relId, String differentia) {
        OWLObjectIntersectionOf intersection = (OWLObjectIntersectionOf) expression;
        List<OWLClassExpression> list = intersection.getOperandsAsList();
        OWLClass cls = (OWLClass) list.get(0);
        assertEquals(genus, OWLAPIOwl2Obo.getIdentifier(cls.getIRI()));
        OWLClassExpression rhs = list.get(1);
        OWLClass cls2 = rhs.getClassesInSignature().iterator().next();
        assertEquals(differentia, OWLAPIOwl2Obo.getIdentifier(cls2.getIRI()));
View Full Code Here

        assert descC != null;
        OWLClassExpression notC = dataFactory.getOWLObjectComplementOf(descC);
        OWLClassExpression descD = it.next();
        assert descD != null;
        OWLClassExpression notD = dataFactory.getOWLObjectComplementOf(descD);
        OWLObjectIntersectionOf left = dataFactory
                .getOWLObjectIntersectionOf(CollectionFactory.createSet(descC,
                        notD));
        OWLObjectIntersectionOf right = dataFactory
                .getOWLObjectIntersectionOf(CollectionFactory.createSet(notC,
                        descD));
        desc = dataFactory.getOWLObjectUnionOf(CollectionFactory.createSet(
                left, right));
    }
View Full Code Here

        OWLClassExpression descC = it.next();
        OWLClassExpression notC = dataFactory.getOWLObjectComplementOf(descC);
        OWLClassExpression descD = it.next();
        OWLClassExpression notD = dataFactory.getOWLObjectComplementOf(descD);

        OWLObjectIntersectionOf left = dataFactory.getOWLObjectIntersectionOf(CollectionFactory.createSet(descC, notD));
        OWLObjectIntersectionOf right = dataFactory.getOWLObjectIntersectionOf(CollectionFactory.createSet(notC, descD));
        desc = dataFactory.getOWLObjectUnionOf(CollectionFactory.createSet(left, right));
    }
View Full Code Here

                    OWLClassExpression superCls = ax.getSuperClass();
                    if (!superCls.isAnonymous()) {
                        result.add(superCls.asOWLClass());
                    }
                    else if (superCls instanceof OWLObjectIntersectionOf) {
                        OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) superCls;
                        for (OWLClassExpression conjunct : intersectionOf.asConjunctSet()) {
                            if (!conjunct.isAnonymous()) {
                                result.add(conjunct.asOWLClass());
                            }
                        }
                    }
                }
                for (OWLEquivalentClassesAxiom ax : ont.getEquivalentClassesAxioms(child)) {
                    for (OWLClassExpression ce : ax.getClassExpressionsMinus(child)) {
                        if (!ce.isAnonymous()) {
                            result.add(ce.asOWLClass());
                        }
                        else if (ce instanceof OWLObjectIntersectionOf) {
                            OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) ce;
                            for (OWLClassExpression conjunct : intersectionOf.asConjunctSet()) {
                                if (!conjunct.isAnonymous()) {
                                    result.add(conjunct.asOWLClass());
                                }
                            }
                        }
View Full Code Here

            }
            else if (equiv instanceof OWLRestriction) {
                /* OBO equivalence must be of the form "A and p some B and ..."
                 * if this class is equiv to a restriction, put this into an intersection with owlapi:Thing as the named class
                 */
                OWLObjectIntersectionOf intersection = getOWLOntologyManager().getOWLDataFactory().getOWLObjectIntersectionOf(owlThing, equiv);
                handleIntersection(cls, intersection, tvpList);
            }
            else {
                // TODO handle datatype restrictions
                exceptions.add(new OBOStorageException(cls, equiv, "Cannot answer equivalent class that is not intersection or union"));
View Full Code Here

TOP

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

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.