Java 类org.semanticweb.owlapi.model.OWLObjectMaxCardinality 实例源码

项目:owltools    文件:CardinalityContraintsTools.java   
@Override
public HandlerResult visit(OWLObjectMaxCardinality ce) {
    if (ce.getCardinality() == 0) {
        // remove the ce if the max cardinality is zero
        return HandlerResult.remove();
    }
    final OWLClassExpression filler = ce.getFiller();
    final HandlerResult recursive = filler.accept(this);
    OWLObjectSomeValuesFrom newCE;
    if (recursive == null) {
        newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), filler);
    }
    else if (recursive.remove) {
        return HandlerResult.remove();
    }
    else {
        newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), recursive.modified);
    }
    return HandlerResult.modified(newCE);
}
项目:owlapi-gwt    文件:NNF.java   
@Override
public OWLClassExpression visit(OWLObjectMaxCardinality ce) {
    boolean neg = negated;
    int card = ce.getCardinality();
    if (negated) {
        card = ce.getCardinality() + 1;
    }
    negated = false;
    OWLClassExpression filler = ce.getFiller().accept(this);
    OWLClassExpression nnf = null;
    if (neg) {
        nnf = dataFactory.getOWLObjectMinCardinality(card,
                ce.getProperty(), filler);
    } else {
        nnf = dataFactory.getOWLObjectMaxCardinality(card,
                ce.getProperty(), filler);
    }
    negated = neg;
    return nnf;
}
项目:OntoBench    文件:OwlObjectMaxCardinalityOwlLiteAnd2RlFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMaxCardinalityProperty_LiteRL");
  OWLClass range = featurePool.getExclusiveClass(":ObjectMaxCardinalityRange_LiteRL");
  addToGenericDomainAndNewRange(property, range);

  OWLObjectMaxCardinality maxCardinality = factory.getOWLObjectMaxCardinality(1, property);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, maxCardinality));
}
项目:OntoBench    文件:OwlObjectMaxQualifiedCardinalityFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMaxQualifiedCardinalityProperty");
  OWLClass range = featurePool.getExclusiveClass(":ObjectMaxQualifiedCardinalityRange");
  addToGenericDomainAndNewRange(property, range);

  OWLClass qualifier = featurePool.getExclusiveClass(":ObjectMaxQualifiedCardinality_Qualifier");
  OWLObjectMaxCardinality maxCardinality = factory.getOWLObjectMaxCardinality(3, property, qualifier);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, maxCardinality));
}
项目:OntoBench    文件:OwlObjectMaxQualifiedCardinalityOwl2RlFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMaxQualifiedCardinalityProperty_RL");
  OWLClass range = featurePool.getExclusiveClass(":ObjectMaxQualifiedCardinalityRange_RL");
  addToGenericDomainAndNewRange(property, range);

  OWLClass qualifier = featurePool.getExclusiveClass(":ObjectMaxQualifiedCardinality_RL_Qualifier");
  OWLObjectMaxCardinality maxCardinality = factory.getOWLObjectMaxCardinality(0, property, qualifier);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, maxCardinality));
}
项目:OntoBench    文件:OwlObjectMaxCardinalityFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectMaxCardinalityProperty");
  OWLClass range = featurePool.getExclusiveClass(":ObjectMaxCardinalityRange");
  addToGenericDomainAndNewRange(property, range);

  OWLObjectMaxCardinality maxCardinality = factory.getOWLObjectMaxCardinality(8, property);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, maxCardinality));
}
项目:jopa    文件:IntegrityConstraintClassParser.java   
public void visit(OWLObjectMaxCardinality arg0) {
    try {
        OWLClass c = Utils.ensureClass(arg0.getFiller());
        OWLObjectProperty p = Utils.ensureObjectProperty(arg0.getProperty());

        integrityConstraints.add(integrityConstraintFactory
            .MaxObjectParticipationConstraint(subjClass, p, c,
                arg0.getCardinality()));
    } catch (UnsupportedICException e) {
        notSupported(arg0);
    }
}
项目:HermiT-android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectMaxCardinality object) {
    m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
    OWLClassExpression filler=object.getFiller();
    if (isSimple(filler))
        return object;
    else {
        OWLClassExpression complementDescription=m_expressionManager.getComplementNNF(filler);
        OWLClassExpression definition=getDefinitionFor(complementDescription,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),complementDescription });
        return m_factory.getOWLObjectMaxCardinality(object.getCardinality(),object.getProperty(),m_expressionManager.getComplementNNF(definition));
    }
}
项目:HermiT-android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (filler.isOWLNothing())
        return m_factory.getOWLThing();
    else if (d.getCardinality()<=0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else
        return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}
项目:HermiT-android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectExactCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (d.getCardinality()<0)
        return m_factory.getOWLNothing();
    else if (d.getCardinality()==0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else if (filler.isOWLNothing())
        return m_factory.getOWLNothing();
    else {
        OWLObjectMinCardinality minCardinality=m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        OWLObjectMaxCardinality maxCardinality=m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality);
    }
}
项目:elk-reasoner    文件:AbstractElkObjectConverter.java   
@Override
public OWLObjectMaxCardinality visit(
        ElkObjectMaxCardinalityQualified expression) {
    return owlFactory_.getOWLObjectMaxCardinality(
            expression.getCardinality(), convert(expression.getProperty()),
            convert(expression.getFiller()));
}
项目:elk-reasoner    文件:OwlConverter.java   
@SuppressWarnings("static-method")
public ElkObjectMaxCardinality convert(
        OWLObjectMaxCardinality owlObjectMaxCardinality) {
    if (owlObjectMaxCardinality.isQualified())
        return new ElkObjectMaxCardinalityQualifiedWrap<OWLObjectMaxCardinality>(
                owlObjectMaxCardinality);
    // else
    return new ElkObjectMaxCardinalityUnqualifiedWrap<OWLObjectMaxCardinality>(
            owlObjectMaxCardinality);
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectMaxCardinality object) {
    m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
    OWLClassExpression filler=object.getFiller();
    if (isSimple(filler))
        return object;
    else {
        OWLClassExpression complementDescription=m_expressionManager.getComplementNNF(filler);
        OWLClassExpression definition=getDefinitionFor(complementDescription,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),complementDescription });
        return m_factory.getOWLObjectMaxCardinality(object.getCardinality(),object.getProperty(),m_expressionManager.getComplementNNF(definition));
    }
}
项目:Hermit_1.3.8_android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (filler.isOWLNothing())
        return m_factory.getOWLThing();
    else if (d.getCardinality()<=0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else
        return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}
项目:Hermit_1.3.8_android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectExactCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (d.getCardinality()<0)
        return m_factory.getOWLNothing();
    else if (d.getCardinality()==0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else if (filler.isOWLNothing())
        return m_factory.getOWLNothing();
    else {
        OWLObjectMinCardinality minCardinality=m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        OWLObjectMaxCardinality maxCardinality=m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality);
    }
}
项目:owltools    文件:TBoxUnFoldingTool.java   
@Override
public OWLObjectMaxCardinality visit(OWLObjectMaxCardinality ce) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Unfolding max_cardinality: "+ce);
    }
    OWLClassExpression filler = ce.getFiller();
    if (filler != null) {
        OWLClassExpression unfold = filler.accept(this);
        if (unfold != null) {
            return factory.getOWLObjectMaxCardinality(ce.getCardinality(), ce.getProperty(), unfold);
        }
    }
    return null;
}
项目:Wolpertinger    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectMaxCardinality object) {
    m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
    OWLClassExpression filler=object.getFiller();
    if (isSimple(filler))
        return object;
    else {
        OWLClassExpression complementDescription=m_expressionManager.getComplementNNF(filler);
        OWLClassExpression definition=getDefinitionFor(complementDescription,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),complementDescription });
        return m_factory.getOWLObjectMaxCardinality(object.getCardinality(),object.getProperty(),m_expressionManager.getComplementNNF(definition));
    }
}
项目:Wolpertinger    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (filler.isOWLNothing())
        return m_factory.getOWLThing();
    else if (d.getCardinality()<=0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else
        return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}
项目:Wolpertinger    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectExactCardinality d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (d.getCardinality()<0)
        return m_factory.getOWLNothing();
    else if (d.getCardinality()==0)
        return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
    else if (filler.isOWLNothing())
        return m_factory.getOWLNothing();
    else {
        OWLObjectMinCardinality minCardinality=m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        OWLObjectMaxCardinality maxCardinality=m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
        return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality);
    }
}
项目:OWL2SPARQL    文件:OWLClassExpressionMinimizer.java   
@Override
public OWLClassExpression visit(OWLObjectMaxCardinality ce) {
    OWLClassExpression filler = ce.getFiller();
    OWLClassExpression shortenedFiller = filler.accept(this);
    if(shortenedFiller.isOWLNothing()){// <= n r.\bot \equiv \top
        return df.getOWLThing();
    } else if(beautify && ce.getCardinality() == 0) {// we rewrite <= 0 r C to \neg \exists r C - easier to read for humans
        return df.getOWLObjectComplementOf(df.getOWLObjectSomeValuesFrom(ce.getProperty(), shortenedFiller));
    } else if(!filler.equals(shortenedFiller)){
        return df.getOWLObjectMaxCardinality(ce.getCardinality(), ce.getProperty(), shortenedFiller);
    }
    return ce;
}
项目:owlapi-gwt    文件:HashCode.java   
@Override
public void visit(OWLObjectMaxCardinality ce) {
    hashCode = primes[44];
    hashCode = hashCode * MULT + ce.getProperty().hashCode();
    hashCode = hashCode * MULT + ce.getCardinality();
    hashCode = hashCode * MULT + ce.getFiller().hashCode();
}
项目:owlapi-gwt    文件:OWLClassExpressionCollector.java   
@Override
public Set<OWLClassExpression> visit(OWLObjectMaxCardinality ce) {
    Set<OWLClassExpression> result = new HashSet<>();
    result.add(ce);
    result.addAll(ce.getFiller().accept(this));
    return result;
}
项目:owlapi-gwt    文件:OWLObjectMaxCardinalityImpl.java   
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!super.equals(obj)) {
        return false;
    }
    return obj instanceof OWLObjectMaxCardinality;
}
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
/**
 * create axioms for class--objectproperty----individual relation.
 * 
 * @param src
 * @param objprop
 * @param dest
 * @return
 */
private void getClass2ObjectProperty2IndividualAxioms(OWLClass src, OWLObjectProperty objprop, OWLIndividual dest) {
    // Set<OWLAxiom> tmpaxioms = new HashSet<OWLAxiom>();
    OWLAxiom axiom;
    OWLObjectSomeValuesFrom owlObjectSomeValuesFrom;
    OWLObjectHasValue owlLObjectHasValue;
    OWLObjectMaxCardinality owlObjectMaxCardinality;
    OWLObjectOneOf owlObjectOneOf;

    // set domain and range
    // scoped domain
    if (editor.isGenerateDomainAxiom()) {
        owlLObjectHasValue = owlDataFactory.getOWLObjectHasValue(objprop, dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlLObjectHasValue, src);
        domainAndRangeAxioms.add(axiom);

        owlObjectSomeValuesFrom = owlDataFactory.getOWLObjectSomeValuesFrom(objprop, owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlObjectSomeValuesFrom, src);
        domainAndRangeAxioms.add(axiom);
    }

    // set existential restriction
    if (editor.isGenerateExistentialAxiom()) {
        owlObjectSomeValuesFrom = owlDataFactory.getOWLObjectSomeValuesFrom(objprop.getInverseProperty(), src);
        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlObjectOneOf, owlObjectSomeValuesFrom);
        existentialAxioms.add(axiom);

        owlLObjectHasValue = owlDataFactory.getOWLObjectHasValue(objprop, dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlLObjectHasValue);
        existentialAxioms.add(axiom);
    }

    // set cardinality restriction
    if (editor.isGenerateCardinalityAxiom()) {
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop,
                owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataFactory.getOWLThing(), owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop,
                owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop, owlObjectOneOf);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop, owlObjectOneOf);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataFactory.getOWLThing(), owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);
    }
    // return tmpaxioms;
}
项目:HermiT-android    文件:BuiltInPropertyManager.java   
public void visit(OWLObjectMaxCardinality object) {
    visitProperty(object.getProperty());
    object.getFiller().accept(this);
}
项目:HermiT-android    文件:OWLNormalization.java   
public Boolean visit(OWLObjectMaxCardinality object) {
    return object.getCardinality()>0 ? Boolean.TRUE : m_expressionManager.getComplementNNF(object.getFiller()).accept(this);
}
项目:HermiT-android    文件:OWLAxiomsExpressivity.java   
public void visit(OWLObjectMaxCardinality object) {
    m_hasAtMostRestrictions=true;
    visitProperty(object.getProperty());
    object.getFiller().accept(this);
}
项目:HermiT-android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getNNF(d.getFiller());
    return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}
项目:HermiT-android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getNNF(d.getFiller());
    return m_factory.getOWLObjectMinCardinality(d.getCardinality()+1,d.getProperty().getSimplified(),filler);
}
项目:HermiT-android    文件:OWLClausification.java   
public void visit(OWLObjectMaxCardinality object) {
    int cardinality=object.getCardinality();
    OWLObjectPropertyExpression onObjectProperty=object.getProperty();
    OWLClassExpression filler=object.getFiller();
    ensureYNotZero();
    boolean isPositive;
    AtomicConcept atomicConcept;
    if (filler instanceof OWLClass) {
        isPositive=true;
        atomicConcept=AtomicConcept.create(((OWLClass)filler).getIRI().toString());
        if (atomicConcept.isAlwaysTrue())
            atomicConcept=null;
    }
    else if (filler instanceof OWLObjectComplementOf) {
        OWLClassExpression internal=((OWLObjectComplementOf)filler).getOperand();
        if (!(internal instanceof OWLClass))
            throw new IllegalStateException("Internal error: Invalid ontology normal form.");
        isPositive=false;
        atomicConcept=AtomicConcept.create(((OWLClass)internal).getIRI().toString());
        if (atomicConcept.isAlwaysFalse())
            atomicConcept=null;
    }
    else
        throw new IllegalStateException("Internal error: Invalid ontology normal form.");
    Role onRole=getRole(onObjectProperty);
    LiteralConcept toConcept=getLiteralConcept(filler);
    AnnotatedEquality annotatedEquality=AnnotatedEquality.create(cardinality,onRole,toConcept);
    Variable[] yVars=new Variable[cardinality+1];
    for (int i=0;i<yVars.length;i++) {
        yVars[i]=nextY();
        m_bodyAtoms.add(getRoleAtom(onObjectProperty,X,yVars[i]));
        if (atomicConcept!=null) {
            Atom atom=Atom.create(atomicConcept,yVars[i]);
            if (isPositive)
                m_bodyAtoms.add(atom);
            else
                m_headAtoms.add(atom);
        }
    }
    // Node ID comparisons are not needed in case of functionality axioms,
    // as the effect of these is simulated by the way in which the rules are applied.
    if (yVars.length>2) {
        for (int i=0;i<yVars.length-1;i++)
            m_bodyAtoms.add(Atom.create(NodeIDLessEqualThan.INSTANCE,yVars[i],yVars[i+1]));
        m_bodyAtoms.add(Atom.create(NodeIDsAscendingOrEqual.create(yVars.length),yVars));
    }
    for (int i=0;i<yVars.length;i++)
        for (int j=i+1;j<yVars.length;j++)
            m_headAtoms.add(Atom.create(annotatedEquality,yVars[i],yVars[j],X));
}
项目:elk-reasoner    文件:AbstractElkObjectConverter.java   
@Override
public OWLObjectMaxCardinality visit(
        ElkObjectMaxCardinalityUnqualified expression) {
    return owlFactory_.getOWLObjectMaxCardinality(
            expression.getCardinality(), convert(expression.getProperty()));
}
项目:elk-reasoner    文件:OwlClassExpressionConverterVisitor.java   
@Override
public ElkObjectMaxCardinality visit(
        OWLObjectMaxCardinality owlObjectMaxCardinality) {
    return CONVERTER.convert(owlObjectMaxCardinality);
}
项目:Hermit_1.3.8_android    文件:BuiltInPropertyManager.java   
public void visit(OWLObjectMaxCardinality object) {
    visitProperty(object.getProperty());
    object.getFiller().accept(this);
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public Boolean visit(OWLObjectMaxCardinality object) {
    return object.getCardinality()>0 ? Boolean.TRUE : m_expressionManager.getComplementNNF(object.getFiller()).accept(this);
}
项目:Hermit_1.3.8_android    文件:OWLAxiomsExpressivity.java   
public void visit(OWLObjectMaxCardinality object) {
    m_hasAtMostRestrictions=true;
    visitProperty(object.getProperty());
    object.getFiller().accept(this);
}
项目:Hermit_1.3.8_android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getNNF(d.getFiller());
    return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}
项目:Hermit_1.3.8_android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getNNF(d.getFiller());
    return m_factory.getOWLObjectMinCardinality(d.getCardinality()+1,d.getProperty().getSimplified(),filler);
}
项目:Hermit_1.3.8_android    文件:OWLClausification.java   
public void visit(OWLObjectMaxCardinality object) {
    int cardinality=object.getCardinality();
    OWLObjectPropertyExpression onObjectProperty=object.getProperty();
    OWLClassExpression filler=object.getFiller();
    ensureYNotZero();
    boolean isPositive;
    AtomicConcept atomicConcept;
    if (filler instanceof OWLClass) {
        isPositive=true;
        atomicConcept=AtomicConcept.create(((OWLClass)filler).getIRI().toString());
        if (atomicConcept.isAlwaysTrue())
            atomicConcept=null;
    }
    else if (filler instanceof OWLObjectComplementOf) {
        OWLClassExpression internal=((OWLObjectComplementOf)filler).getOperand();
        if (!(internal instanceof OWLClass))
            throw new IllegalStateException("Internal error: Invalid ontology normal form.");
        isPositive=false;
        atomicConcept=AtomicConcept.create(((OWLClass)internal).getIRI().toString());
        if (atomicConcept.isAlwaysFalse())
            atomicConcept=null;
    }
    else
        throw new IllegalStateException("Internal error: Invalid ontology normal form.");
    Role onRole=getRole(onObjectProperty);
    LiteralConcept toConcept=getLiteralConcept(filler);
    AnnotatedEquality annotatedEquality=AnnotatedEquality.create(cardinality,onRole,toConcept);
    Variable[] yVars=new Variable[cardinality+1];
    for (int i=0;i<yVars.length;i++) {
        yVars[i]=nextY();
        m_bodyAtoms.add(getRoleAtom(onObjectProperty,X,yVars[i]));
        if (atomicConcept!=null) {
            Atom atom=Atom.create(atomicConcept,yVars[i]);
            if (isPositive)
                m_bodyAtoms.add(atom);
            else
                m_headAtoms.add(atom);
        }
    }
    // Node ID comparisons are not needed in case of functionality axioms,
    // as the effect of these is simulated by the way in which the rules are applied.
    if (yVars.length>2) {
        for (int i=0;i<yVars.length-1;i++)
            m_bodyAtoms.add(Atom.create(NodeIDLessEqualThan.INSTANCE,yVars[i],yVars[i+1]));
        m_bodyAtoms.add(Atom.create(NodeIDsAscendingOrEqual.create(yVars.length),yVars));
    }
    for (int i=0;i<yVars.length;i++)
        for (int j=i+1;j<yVars.length;j++)
            m_headAtoms.add(Atom.create(annotatedEquality,yVars[i],yVars[j],X));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public Boolean visit(OWLObjectMaxCardinality object) {
    return object.getCardinality()>0 ? Boolean.TRUE : m_expressionManager.getComplementNNF(object.getFiller()).accept(this);
}
项目:Wolpertinger    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectMaxCardinality d) {
    OWLClassExpression filler=getNNF(d.getFiller());
    return m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
}