order[getTryNext()] = minIndex;
}
}
}
Node node = this.node.getSame();
for(; getTryNext() < getTryCount(); tryNext++) {
ATermAppl d = disj[getTryNext()];
if(PelletOptions.USE_SEMANTIC_BRANCHING) {
for(int m = 0; m < getTryNext(); m++)
strategy.addType(node, ATermUtils.negate( disj[m] ), prevDS[m]);
}
DependencySet ds = null;
if(getTryNext() == getTryCount() - 1 && !PelletOptions.SATURATE_TABLEAU) {
ds = getTermDepends();
for(int m = 0; m < getTryNext(); m++)
ds = ds.union(prevDS[m], abox.doExplanation());
//CHW - added for incremental reasoning and rollback through deletions
if(PelletOptions.USE_INCREMENTAL_DELETION)
ds.setExplain( getTermDepends().getExplain() );
else
ds.remove(getBranch());
}
else {
//CHW - Changed for tracing purposes
if(PelletOptions.USE_INCREMENTAL_DELETION)
ds = getTermDepends().union(new DependencySet(getBranch()), abox.doExplanation());
else{
ds = new DependencySet(getBranch());
//added for tracing
Set<ATermAppl> explain = new HashSet<ATermAppl>();
explain.addAll(getTermDepends().getExplain());
ds.setExplain( explain );
}
}
if( log.isLoggable( Level.FINE ) )
log.fine( getDebugMsg() );
ATermAppl notD = ATermUtils.negate(d);
DependencySet clashDepends = PelletOptions.SATURATE_TABLEAU ? null : node.getDepends(notD);
if(clashDepends == null) {
strategy.addType(node, d, ds);
// we may still find a clash if concept is allValuesFrom
// and there are some conflicting edges
if(abox.isClosed())
clashDepends = abox.getClash().getDepends();
}
else {
clashDepends = clashDepends.union(ds, abox.doExplanation());
}
// if there is a clash
if(clashDepends != null) {
if( log.isLoggable( Level.FINE ) ) {
Clash clash = abox.isClosed() ? abox.getClash() : Clash.atomic(node, clashDepends, d);
log.fine("CLASH: Branch " + getBranch() + " " + clash + "!" + " " + clashDepends.getExplain());
}
if( PelletOptions.USE_DISJUNCT_SORTING ) {
if(stats == null) {
stats = new int[disj.length];
for(int i = 0; i < disj.length; i++)
stats[i] = 0;
abox.getDisjBranchStats().put(disjunction, stats);
}
stats[order[getTryNext()]]++;
}
// do not restore if we do not have any more branches to try. after
// backtrack the correct branch will restore it anyway. more
// importantly restore clears the clash info causing exceptions
if(getTryNext() < getTryCount() - 1 && clashDepends.contains(getBranch())) {
// do not restore if we find the problem without adding the concepts
if(abox.isClosed()) {
if( node.isLiteral() ) {
abox.setClash( null );
node.restore( branch );
}
else {
// restoring a single node is not enough here because one of the disjuncts could be an
// all(r,C) that changed the r-neighbors
strategy.restoreLocal((Individual) node, this);