prepatory work for switching into asynchronous reasoning mode when processing a tbox update.
This commit is contained in:
parent
5559ba5fed
commit
a8140fcde7
2 changed files with 31 additions and 21 deletions
|
@ -1373,7 +1373,7 @@ public class SimpleReasoner extends StatementListener {
|
|||
log.info("ABox inference model updated with mostSpecificType annotations");
|
||||
}
|
||||
|
||||
public boolean isABoxReasoningAsynchronous() {
|
||||
public boolean isABoxReasoningAsynchronous() {
|
||||
if (batchMode1 || batchMode2) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1381,6 +1381,27 @@ public class SimpleReasoner extends StatementListener {
|
|||
}
|
||||
}
|
||||
|
||||
protected void startBatchMode() {
|
||||
if (batchMode1 || batchMode2) {
|
||||
return;
|
||||
} else {
|
||||
batchMode1 = true;
|
||||
batchMode2 = false;
|
||||
aBoxDeltaModeler1.getRetractions().removeAll();
|
||||
log.info("started processing retractions in batch mode");
|
||||
}
|
||||
}
|
||||
|
||||
protected void endBatchMode() {
|
||||
|
||||
if (!batchMode1 && !batchMode2) {
|
||||
log.warn("SimpleReasoner received an end batch mode request when not currently in batch mode. No action was taken");
|
||||
return;
|
||||
}
|
||||
|
||||
new Thread(new DeltaComputer(),"DeltaComputer").start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void notifyEvent(Model model, Object event) {
|
||||
|
||||
|
@ -1388,19 +1409,10 @@ public class SimpleReasoner extends StatementListener {
|
|||
if (((BulkUpdateEvent) event).getBegin()) {
|
||||
|
||||
log.info("received BulkUpdateEvent(begin)");
|
||||
|
||||
if (batchMode1 || batchMode2) {
|
||||
log.info("received a BulkUpdateEvent(begin) while already in batch update mode; this event will be ignored (and processing in batch mode will continue until there are no pending updates)");
|
||||
return;
|
||||
} else {
|
||||
batchMode1 = true;
|
||||
batchMode2 = false;
|
||||
aBoxDeltaModeler1.getRetractions().removeAll();
|
||||
log.info("started processing retractions in batch mode");
|
||||
}
|
||||
startBatchMode();
|
||||
} else {
|
||||
log.info("received BulkUpdateEvent(end)");
|
||||
new Thread(new DeltaComputer(),"DeltaComputer").start();
|
||||
endBatchMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.reasoner.support;
|
||||
package edu.cornell.mannlib.vitro.webapp.reasoner;
|
||||
|
||||
import com.hp.hpl.jena.rdf.listeners.StatementListener;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner;
|
||||
|
||||
/**
|
||||
* Route notification of changes to TBox to the incremental ABox reasoner.
|
||||
* The incremental ABox reasoner needs to handle only subclass, superclass
|
||||
* The incremental ABox reasoner handles only subclass, superclass
|
||||
* and equivalent class axioms.
|
||||
*
|
||||
*/
|
||||
|
@ -18,22 +17,21 @@ public class SimpleReasonerTBoxListener extends StatementListener {
|
|||
|
||||
private SimpleReasoner simpleReasoner = null;
|
||||
|
||||
|
||||
public SimpleReasonerTBoxListener(SimpleReasoner simpleReasoner) {
|
||||
this.simpleReasoner = simpleReasoner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedStatement(Statement stmt) {
|
||||
|
||||
//simpleReasoner.startBatchMode();
|
||||
simpleReasoner.addedTBoxStatement(stmt);
|
||||
|
||||
//simpleReasoner.endBatchMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedStatement(Statement stmt) {
|
||||
|
||||
//simpleReasoner.startBatchMode();
|
||||
simpleReasoner.removedTBoxStatement(stmt);
|
||||
//simpleReasoner.endBatchMode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue