Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLObjectAllValuesFrom


                    OWLObjectMaxCardinality card = (OWLObjectMaxCardinality) ce;
                    r = getIdentifier(card.getProperty());
                    cls2 = getIdentifier(card.getFiller());
                    max = card.getCardinality();
                } else if (ce instanceof OWLObjectAllValuesFrom) {
                    OWLObjectAllValuesFrom all = (OWLObjectAllValuesFrom) ce;
                    OWLClassExpression filler = all.getFiller();
                    if (filler instanceof OWLClass) {
                        r = getIdentifier(all.getProperty());
                        cls2 = getIdentifier(filler);
                        allOnly = Boolean.TRUE;
                    } else if (filler instanceof OWLObjectComplementOf) {
                        OWLObjectComplementOf restriction = (OWLObjectComplementOf) filler;
                        r = getIdentifier(all.getProperty());
                        cls2 = getIdentifier(restriction.getOperand());
                        exact = 0;
                    }
                } else if (ce instanceof OWLObjectIntersectionOf) {
                    // either a min-max or a some-all combination
                    Set<OWLClassExpression> operands = ((OWLObjectIntersectionOf) ce)
                            .getOperands();
                    if (operands.size() == 2) {
                        for (OWLClassExpression operand : operands) {
                            if (operand instanceof OWLObjectMinCardinality) {
                                OWLObjectMinCardinality card = (OWLObjectMinCardinality) operand;
                                r = getIdentifier(card.getProperty());
                                cls2 = getIdentifier(card.getFiller());
                                min = card.getCardinality();
                            } else if (operand instanceof OWLObjectMaxCardinality) {
                                OWLObjectMaxCardinality card = (OWLObjectMaxCardinality) operand;
                                r = getIdentifier(card.getProperty());
                                cls2 = getIdentifier(card.getFiller());
                                max = card.getCardinality();
                            } else if (operand instanceof OWLObjectAllValuesFrom) {
                                OWLObjectAllValuesFrom all = (OWLObjectAllValuesFrom) operand;
                                r = getIdentifier(all.getProperty());
                                cls2 = getIdentifier(all.getFiller());
                                allOnly = Boolean.TRUE;
                            } else if (operand instanceof OWLObjectSomeValuesFrom) {
                                OWLObjectSomeValuesFrom all = (OWLObjectSomeValuesFrom) operand;
                                r = getIdentifier(all.getProperty());
                                cls2 = getIdentifier(all.getFiller());
                                allSome = Boolean.TRUE;
                            }
                        }
                    }
                }
View Full Code Here


        // restriction, we need an OWLObjectOneOf class expression since male
        // and female are individuals We can just list as many individuals as we
        // need as the argument of the method.
        OWLObjectOneOf maleOrFemale = factory.getOWLObjectOneOf(male, female);
        // 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,
View Full Code Here

    }

    @Test
    public void shouldBuildObjectAllValuesFrom() {
        // given
        OWLObjectAllValuesFrom expected = df.getOWLObjectAllValuesFrom(op, ce);
        BuilderObjectAllValuesFrom builder = new BuilderObjectAllValuesFrom(
                expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
View Full Code Here

            jj_consume_token(SUBCLASSOF);
            rhs = parseClassDescription();
            if (lhs.isOWLThing()) {
                if (rhs instanceof OWLObjectAllValuesFrom) {
                    // Interpret as Range
                    OWLObjectAllValuesFrom restriction = (OWLObjectAllValuesFrom) rhs;
                    return factory.getOWLObjectPropertyRangeAxiom(
                            restriction.getProperty(), restriction.getFiller());
                }
                if (rhs instanceof OWLObjectMaxCardinality) {
                    OWLObjectMaxCardinality restriction = (OWLObjectMaxCardinality) rhs;
                    if (restriction.getCardinality() == 1
                            && restriction.getFiller().isOWLThing()) {
                        return factory
                                .getOWLFunctionalObjectPropertyAxiom(restriction
                                        .getProperty());
                    }
                }
            } else if (lhs instanceof OWLObjectSomeValuesFrom) {
                OWLObjectSomeValuesFrom restriction = (OWLObjectSomeValuesFrom) lhs;
                if (restriction.getFiller().isOWLThing()) {
                    return factory.getOWLObjectPropertyDomainAxiom(
                            restriction.getProperty(), rhs);
                }
            }
            if (rhs instanceof OWLObjectComplementOf && !rhs.isAnonymous()) {
                return factory.getOWLDisjointClassesAxiom(lhs,
                        ((OWLObjectComplementOf) rhs).getOperand());
View Full Code Here

    @Test
    public void testNegAllValuesFrom() {
        OWLObjectProperty property = ObjectProperty(iri("p"));
        OWLClass filler = Class(iri("A"));
        OWLObjectAllValuesFrom allValuesFrom = ObjectAllValuesFrom(property,
                filler);
        OWLClassExpression cls = allValuesFrom.getObjectComplementOf();
        OWLClassExpression nnf = ObjectSomeValuesFrom(property,
                filler.getObjectComplementOf());
        assertEquals(cls.getNNF(), nnf);
    }
View Full Code Here

                    OWLObjectPropertyExpression objectPropertyExpression=objectCardinalityRestriction.getProperty();
                    if (axioms.m_complexObjectPropertyExpressions.contains(objectPropertyExpression))
                        throw new IllegalArgumentException("Non-simple property '"+objectPropertyExpression+"' or its inverse appears in a number restriction '"+objectCardinalityRestriction+"'.");
                }
                if (classExpression instanceof OWLObjectAllValuesFrom) {
                    OWLObjectAllValuesFrom objectAll=(OWLObjectAllValuesFrom)classExpression;
                    if (!objectAll.getFiller().equals(dataFactory.getOWLThing())) {
                        OWLObjectPropertyExpression objectProperty=objectAll.getProperty();
                        if (m_automataByProperty.containsKey(objectProperty)) {
                            OWLClassExpression replacement=replacedDescriptions.get(objectAll);
                            if (replacement==null) {
                                replacement=dataFactory.getOWLClass(IRI.create("internal:all#"+(firstReplacementIndex++)));
                                if (objectAll.getFiller() instanceof OWLObjectComplementOf || objectAll.getFiller().equals(dataFactory.getOWLNothing()))
                                    replacement=replacement.getComplementNNF();
                                replacedDescriptions.put(objectAll,replacement);
                            }
                            inclusion[index]=replacement;
                        }
                    }
                }
            }
        }
        // Generate the automaton for each replacement
        for (Map.Entry<OWLObjectAllValuesFrom,OWLClassExpression> replacement : replacedDescriptions.entrySet()) {
            Automaton automaton=m_automataByProperty.get(replacement.getKey().getProperty());
            boolean isOfNegativePolarity=(replacement.getValue() instanceof OWLObjectComplementOf);
            // Generate states of the automaton
            Map<State,OWLClassExpression> statesToConcepts=new HashMap<State,OWLClassExpression>();
            for (Object stateObject : automaton.states()) {
                State state=(State)stateObject;
                if (state.isInitial())
                    statesToConcepts.put(state,replacement.getValue());
                else {
                    OWLClassExpression stateConcept=dataFactory.getOWLClass(IRI.create("internal:all#"+(firstReplacementIndex++)));
                    if (isOfNegativePolarity)
                        stateConcept=stateConcept.getComplementNNF();
                    statesToConcepts.put(state,stateConcept);
                }
            }
            // Generate the transitions
            for (Object transitionObject : automaton.delta()) {
                Transition transition=(Transition)transitionObject;
                OWLClassExpression fromStateConcept=statesToConcepts.get(transition.start()).getComplementNNF();
                OWLClassExpression toStateConcept=statesToConcepts.get(transition.end());
                if (transition.label()==null)
                    axioms.m_conceptInclusions.add(new OWLClassExpression[] { fromStateConcept,toStateConcept });
                else {
                    OWLObjectAllValuesFrom consequentAll=dataFactory.getOWLObjectAllValuesFrom((OWLObjectPropertyExpression)transition.label(),toStateConcept);
                    axioms.m_conceptInclusions.add(new OWLClassExpression[] { fromStateConcept,consequentAll });
                }
            }
            // Generate the final states
            OWLClassExpression filler=replacement.getKey().getFiller();
View Full Code Here

      jj_consume_token(SUBCLASSOF);
      rhs = parseClassDescription();
               if(lhs.isOWLThing()) {
                        if(rhs instanceof OWLObjectAllValuesFrom) {
                            // Interpret as Range
                            OWLObjectAllValuesFrom restriction = (OWLObjectAllValuesFrom) rhs;
                            {if (true) return factory.getOWLObjectPropertyRangeAxiom(restriction.getProperty(), restriction.getFiller());}
                        }
                        if(rhs instanceof OWLObjectMaxCardinality) {
                            OWLObjectMaxCardinality restriction = (OWLObjectMaxCardinality) rhs;
                            if(restriction.getCardinality() == 1 && restriction.getFiller().isOWLThing()) {
                                {if (true) return factory.getOWLFunctionalObjectPropertyAxiom(restriction.getProperty());}
                            }
                        }
                    }
                    else if(lhs instanceof OWLObjectSomeValuesFrom) {
                        OWLObjectSomeValuesFrom restriction = (OWLObjectSomeValuesFrom) lhs;
                        if(restriction.getFiller().isOWLThing()) {
                            {if (true) return factory.getOWLObjectPropertyDomainAxiom(restriction.getProperty(), rhs);}
                        }
                    }
                    if(rhs instanceof OWLObjectComplementOf && !rhs.isAnonymous()) {
                        {if (true) return factory.getOWLDisjointClassesAxiom(lhs, ((OWLObjectComplementOf) rhs).getOperand());}
                    }
View Full Code Here

TOP

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

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.