Context bContext = contextIndex.get(b);
bContext.getPred().store(s, concept);
// queue(A) := queue(A) u U{B'|B' in S(B)}.O^(s.B')
final IConceptSet sb = contextIndex.get(b).getS();
// Computes the minimal set of QueueEntries from s.a [ bb is in O
for (IntIterator itr = sb.iterator(); itr.hasNext();) {
final int bb = itr.next();
final ConcurrentMap<Integer, Collection<IConjunctionQueueEntry>> map = ontologyNF3.get(bb);
if (null != map) {
final Collection<IConjunctionQueueEntry> entries = map.get(s);
if (null != entries) {
conceptQueue.addAll(entries);
}
}
}
// Handle reflexive roles
if (reflexiveRoles.contains(s)) {
// check for (a,a) in R(s)
if (!pred.lookupConcept(s).contains(concept)) {
processNewEdgeTracking(s, concept);
}
// check for (b,b) in R(s)
Context tc = contextIndex.get(b);
if (!tc.getPred().lookupConcept(s).contains(b)) {
tc.processExternalEdge(s, b);
affectedContexts.add(tc);
tc.startTracking();
if (tc.activate()) {
parentTodo.add(tc);
}
}
}
final List<int[]> work = new ArrayList<int[]>();
for (final NF5 nf5 : ontologyNF5) {
if (s == nf5.getS()) {
final int t = nf5.getR();
final int u = nf5.getT();
final IConceptSet aTPrimes = pred.lookupConcept(t);
// Again in this case there is a dependency with the
// predecessors of an external context.
final IConceptSet bUPrimes =
contextIndex.get(b).getPred().lookupConcept(u);
for (final IntIterator itr = aTPrimes.iterator();
itr.hasNext();) {
final int aa = itr.next();
if (!bUPrimes.contains(aa)) {
work.add(new int[] { aa, u });
}
}
}
}
for (final int[] pair : work) {
if (pair[0] == concept) {
processNewEdgeTracking(pair[1], b);
} else {
Context tc = contextIndex.get(pair[0]);
tc.processExternalEdge(pair[1], b);
affectedContexts.add(tc);
tc.startTracking();
if (tc.activate()) {
parentTodo.add(tc);
}
}
}
work.clear();
for (final NF5 nf5 : ontologyNF5) {
if (s == nf5.getR()) {
final int t = nf5.getS();
final int u = nf5.getT();
// In this case there is a dependency with the
// successors of an external context.
final IConceptSet bTPrimes = contextIndex.get(b).getSucc()
.lookupConcept(t);
final IConceptSet aUPrimes = succ.lookupConcept(u);
for (final IntIterator itr = bTPrimes.iterator();
itr.hasNext();) {
final int bb = itr.next();
if (!aUPrimes.contains(bb)) {
work.add(new int[] { u, bb });
}
}
}