if (noInversePropertyWithAutomaton) {
automatonForLeafProperty=new Automaton();
State initial=automatonForLeafProperty.addState(true,false);
State accepting=automatonForLeafProperty.addState(false,true);
try {
automatonForLeafProperty.addTransition(new Transition(initial,propertyToBuildAutomatonFor,accepting));
}
catch (NoSuchStateException e) {
throw new IllegalArgumentException("Could not create automaton for property at the bottom of hierarchy (simple property).");
}
finalizeConstruction(completeAutomata,propertyToBuildAutomatonFor,automatonForLeafProperty,symmetricObjectProperties,transitiveProperties);
}
}
else {
if (propertyToBuildAutomatonFor.getInverseProperty().getSimplified().isAnonymous() && individualAutomata.containsKey(propertyToBuildAutomatonFor.getInverseProperty().getSimplified())) {
Automaton inversePropertyAutomaton=buildCompleteAutomataForProperties(propertyToBuildAutomatonFor.getInverseProperty().getSimplified(),inversePropertiesMap,individualAutomata,completeAutomata,inversedPropertyDependencyGraph,symmetricObjectProperties,transitiveProperties);
increaseAutomatonWithInversePropertyAutomaton(automatonForLeafProperty,getMirroredCopy(inversePropertyAutomaton));
if (!completeAutomata.containsKey(propertyToBuildAutomatonFor))
finalizeConstruction(completeAutomata,propertyToBuildAutomatonFor,automatonForLeafProperty,symmetricObjectProperties,transitiveProperties);
else
automatonForLeafProperty=completeAutomata.get(propertyToBuildAutomatonFor);
}
else {
increaseWithDefinedInverseIfNecessary(propertyToBuildAutomatonFor,automatonForLeafProperty,inversePropertiesMap,individualAutomata);
finalizeConstruction(completeAutomata,propertyToBuildAutomatonFor,automatonForLeafProperty,symmetricObjectProperties,transitiveProperties);
}
}
return automatonForLeafProperty;
}
else {
Automaton biggerPropertyAutomaton=individualAutomata.get(propertyToBuildAutomatonFor);
if (biggerPropertyAutomaton==null) {
biggerPropertyAutomaton=new Automaton();
State initialState=biggerPropertyAutomaton.addState(true,false);
State finalState=biggerPropertyAutomaton.addState(false,true);
Transition transition=new Transition(initialState,propertyToBuildAutomatonFor,finalState);
try {
biggerPropertyAutomaton.addTransition(transition);
}
catch (NoSuchStateException e) {
throw new IllegalArgumentException("Could not create automaton");
}
for (OWLObjectPropertyExpression smallerProperty : inversedPropertyDependencyGraph.getSuccessors(propertyToBuildAutomatonFor)) {
Automaton smallerPropertyAutomaton=buildCompleteAutomataForProperties(smallerProperty,inversePropertiesMap,individualAutomata,completeAutomata,inversedPropertyDependencyGraph,symmetricObjectProperties,transitiveProperties);
automataConnector(biggerPropertyAutomaton,smallerPropertyAutomaton,transition);
try {
biggerPropertyAutomaton.addTransition(new Transition(initialState,smallerProperty,finalState));
}
catch (NoSuchStateException e) {
throw new IllegalArgumentException("Could not create automaton");
}
}
if (propertyToBuildAutomatonFor.getInverseProperty().getSimplified().isAnonymous() && individualAutomata.containsKey(propertyToBuildAutomatonFor.getInverseProperty().getSimplified())) {
Automaton inversePropertyAutomaton=buildCompleteAutomataForProperties(propertyToBuildAutomatonFor.getInverseProperty().getSimplified(),inversePropertiesMap,individualAutomata,completeAutomata,inversedPropertyDependencyGraph,symmetricObjectProperties,transitiveProperties);
increaseAutomatonWithInversePropertyAutomaton(biggerPropertyAutomaton,getMirroredCopy(inversePropertyAutomaton));
if (!completeAutomata.containsKey(propertyToBuildAutomatonFor))
finalizeConstruction(completeAutomata,propertyToBuildAutomatonFor,biggerPropertyAutomaton,symmetricObjectProperties,transitiveProperties);
else
biggerPropertyAutomaton=completeAutomata.get(propertyToBuildAutomatonFor);
}
else {
increaseWithDefinedInverseIfNecessary(propertyToBuildAutomatonFor,biggerPropertyAutomaton,inversePropertiesMap,individualAutomata);
if (!completeAutomata.containsKey(propertyToBuildAutomatonFor))
finalizeConstruction(completeAutomata,propertyToBuildAutomatonFor,biggerPropertyAutomaton,symmetricObjectProperties,transitiveProperties);
else
biggerPropertyAutomaton=completeAutomata.get(propertyToBuildAutomatonFor);
}
}
else {
for (OWLObjectPropertyExpression smallerProperty : inversedPropertyDependencyGraph.getSuccessors(propertyToBuildAutomatonFor)) {
boolean someInternalTransitionMatched=false;
for (Object transitionObject : biggerPropertyAutomaton.delta()) {
Transition transition=(Transition)transitionObject;
if (transition.label()!=null && transition.label().equals(smallerProperty)) {
Automaton smallerPropertyAutomaton=buildCompleteAutomataForProperties(smallerProperty,inversePropertiesMap,individualAutomata,completeAutomata,inversedPropertyDependencyGraph,symmetricObjectProperties,transitiveProperties);
if (smallerPropertyAutomaton.delta().size()!=1)
automataConnector(biggerPropertyAutomaton,smallerPropertyAutomaton,transition);
someInternalTransitionMatched=true;
}
}
if (!someInternalTransitionMatched) {
Automaton smallerPropertyAutomaton=buildCompleteAutomataForProperties(smallerProperty,inversePropertiesMap,individualAutomata,completeAutomata,inversedPropertyDependencyGraph,symmetricObjectProperties,transitiveProperties);
Transition initial2TerminalTransition=(Transition)biggerPropertyAutomaton.deltaFrom((State)biggerPropertyAutomaton.initials().iterator().next(),(State)biggerPropertyAutomaton.terminals().iterator().next()).iterator().next();
automataConnector(biggerPropertyAutomaton,smallerPropertyAutomaton,initial2TerminalTransition);
}
}
}
if (propertyToBuildAutomatonFor.getInverseProperty().getSimplified().isAnonymous() && individualAutomata.containsKey(propertyToBuildAutomatonFor.getInverseProperty().getSimplified())) {