// for all edges (z, r, y) add an edge (z, r, x)
EdgeList inEdges = y.getInEdges();
for (int e = 0; e < inEdges.size(); e++) {
Edge edge = inEdges.edgeAt(e);
Individual z = edge.getFrom();
Role r = edge.getRole();
DependencySet finalDS = ds.union(edge.getDepends(), abox.doExplanation());
// if y has a self edge then x should have the same self edge
if (y.equals(z)) {
addEdge(x, r, x, finalDS);
}
// if z is already a successor of x add the reverse edge
else if (x.hasSuccessor(z)) {
// FIXME what if there were no inverses in this expressitivity
addEdge(x, r.getInverse(), z, finalDS);
}
else {
addEdge(z, r, x, finalDS);
}
// only remove the edge from z and keep a copy in y for a
// possible restore operation in the future
z.removeEdge(edge);
// add to effected list of queue
// if( abox.getBranch() >= 0 && PelletOptions.USE_COMPLETION_QUEUE ) {
// abox.getCompletionQueue().addEffected( abox.getBranch(), z.getName() );
// }
if (abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS) {
abox.getBranchEffectTracker().add(abox.getBranch(), z.getName());
}
}
// for all z such that y != z set x != z
x.inheritDifferents(y, ds);
// we want to prune y early due to an implementation issue about literals
// if y has an outgoing edge to a literal with concrete value
y.prune(ds);
// for all edges (y, r, z) where z is a nominal add an edge (x, r, z)
EdgeList outEdges = y.getOutEdges();
for (int e = 0; e < outEdges.size(); e++) {
Edge edge = outEdges.edgeAt(e);
Node z = edge.getTo();
if (z.isNominal() && !y.equals(z)) {
Role r = edge.getRole();
DependencySet finalDS = ds.union(edge.getDepends(), abox.doExplanation());
addEdge(x, r, z, finalDS);
// add to effected list
if (abox.getBranch() >= 0 && PelletOptions.TRACK_BRANCH_EFFECTS) {
abox.getBranchEffectTracker().add(abox.getBranch(), z.getName());
}
// do not remove edge here because prune will take care of that
}
}