NIHVIVO-2869 batch retracted statements for inferencing at the end

This commit is contained in:
stellamit 2011-07-12 19:19:02 +00:00
parent 21c8f4990d
commit b9b5cb208a

View file

@ -1244,6 +1244,7 @@ public class SimpleReasoner extends StatementListener {
@Override @Override
public void run() { public void run() {
log.info("starting DeltaComputer.run");
Model retractions = aBoxDeltaModeler1.getRetractions(); Model retractions = aBoxDeltaModeler1.getRetractions();
boolean finished = (retractions.size() == 0); boolean finished = (retractions.size() == 0);
String qualifier = "(1)"; String qualifier = "(1)";
@ -1252,7 +1253,7 @@ public class SimpleReasoner extends StatementListener {
retractions.enterCriticalSection(Lock.READ); retractions.enterCriticalSection(Lock.READ);
try { try {
log.info("started computing inferences for batch " + qualifier + " update"); log.info("run: started computing inferences for batch " + qualifier + " update");
StmtIterator iter = retractions.listStatements(); StmtIterator iter = retractions.listStatements();
int num = 0; int num = 0;
@ -1260,7 +1261,9 @@ public class SimpleReasoner extends StatementListener {
Statement stmt = iter.next(); Statement stmt = iter.next();
try { try {
removedStatement(stmt); removedABoxTypeAssertion(stmt, inferenceModel);
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
//TODO update this part when subproperty inferencing is added.
} catch (Exception e) { } catch (Exception e) {
log.error("exception while computing inferences for batch " + qualifier + " update: " + e.getMessage()); log.error("exception while computing inferences for batch " + qualifier + " update: " + e.getMessage());
} }
@ -1269,7 +1272,6 @@ public class SimpleReasoner extends StatementListener {
if ((num % 6000) == 0) { if ((num % 6000) == 0) {
log.info("still computing inferences for batch " + qualifier + " update..."); log.info("still computing inferences for batch " + qualifier + " update...");
} }
} }
} finally { } finally {
retractions.removeAll(); retractions.removeAll();
@ -1292,6 +1294,8 @@ public class SimpleReasoner extends StatementListener {
log.info("switching from batch mode 2 to batch mode 1"); log.info("switching from batch mode 2 to batch mode 1");
} else { } else {
finished = true; finished = true;
batchMode1 = false;
batchMode2 = false;
log.info("finished processing retractions in batch mode"); log.info("finished processing retractions in batch mode");
} }
} }
@ -1306,10 +1310,13 @@ public class SimpleReasoner extends StatementListener {
aBoxDeltaModeler2.getRetractions().removeAll(); aBoxDeltaModeler2.getRetractions().removeAll();
} }
if (batchMode1 || batchMode2) {
log.warn("Unexpected condition at the end of DeltaComputer.run method: batchMode1=" + batchMode1 + ", batchMode2 =" + batchMode2 + ". (both should be false)" );
batchMode1 = false; batchMode1 = false;
batchMode2 = false; batchMode2 = false;
} }
} }
}
public static String stmtString(Statement statement) { public static String stmtString(Statement statement) {
return " [subject = " + statement.getSubject().getURI() + return " [subject = " + statement.getSubject().getURI() +