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();