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");
|
log.info("ABox inference model updated with mostSpecificType annotations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isABoxReasoningAsynchronous() {
|
public boolean isABoxReasoningAsynchronous() {
|
||||||
if (batchMode1 || batchMode2) {
|
if (batchMode1 || batchMode2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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
|
@Override
|
||||||
public synchronized void notifyEvent(Model model, Object event) {
|
public synchronized void notifyEvent(Model model, Object event) {
|
||||||
|
|
||||||
|
@ -1388,19 +1409,10 @@ public class SimpleReasoner extends StatementListener {
|
||||||
if (((BulkUpdateEvent) event).getBegin()) {
|
if (((BulkUpdateEvent) event).getBegin()) {
|
||||||
|
|
||||||
log.info("received BulkUpdateEvent(begin)");
|
log.info("received BulkUpdateEvent(begin)");
|
||||||
|
startBatchMode();
|
||||||
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");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
log.info("received BulkUpdateEvent(end)");
|
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$ */
|
/* $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.listeners.StatementListener;
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
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.
|
* 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.
|
* and equivalent class axioms.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -18,22 +17,21 @@ public class SimpleReasonerTBoxListener extends StatementListener {
|
||||||
|
|
||||||
private SimpleReasoner simpleReasoner = null;
|
private SimpleReasoner simpleReasoner = null;
|
||||||
|
|
||||||
|
|
||||||
public SimpleReasonerTBoxListener(SimpleReasoner simpleReasoner) {
|
public SimpleReasonerTBoxListener(SimpleReasoner simpleReasoner) {
|
||||||
this.simpleReasoner = simpleReasoner;
|
this.simpleReasoner = simpleReasoner;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addedStatement(Statement stmt) {
|
public void addedStatement(Statement stmt) {
|
||||||
|
//simpleReasoner.startBatchMode();
|
||||||
simpleReasoner.addedTBoxStatement(stmt);
|
simpleReasoner.addedTBoxStatement(stmt);
|
||||||
|
//simpleReasoner.endBatchMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removedStatement(Statement stmt) {
|
public void removedStatement(Statement stmt) {
|
||||||
|
//simpleReasoner.startBatchMode();
|
||||||
simpleReasoner.removedTBoxStatement(stmt);
|
simpleReasoner.removedTBoxStatement(stmt);
|
||||||
|
//simpleReasoner.endBatchMode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue