merging changes from 14 branch
This commit is contained in:
parent
3e8b31fe7a
commit
9f39bdb4e6
1 changed files with 45 additions and 36 deletions
|
@ -132,16 +132,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ReasonerPlugin plugin : getPluginList()) {
|
doPlugins(ModelUpdate.Operation.ADD,stmt);
|
||||||
try {
|
|
||||||
if (plugin.isInterestedInAddedStatement(stmt)) {
|
|
||||||
plugin.addedABoxStatement(
|
|
||||||
stmt, aboxModel, inferenceModel, tboxModel);
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
log.error(t, t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// don't stop the edit if there's an exception
|
// don't stop the edit if there's an exception
|
||||||
log.error("Exception while computing inferences: " + e.getMessage());
|
log.error("Exception while computing inferences: " + e.getMessage());
|
||||||
|
@ -158,11 +150,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// The delta modeler could optionally record only statements relevant
|
if (!isInterestedInRemovedStatement(stmt)) return;
|
||||||
// to reasoning by checking the .isInterestedInRemovedStatement()
|
|
||||||
// methods on the plugins in addition to recording rdf:type
|
|
||||||
// statements. If property reasoning were uncommented, however,
|
|
||||||
// almost all statements would be relevant.
|
|
||||||
|
|
||||||
if (batchMode1) {
|
if (batchMode1) {
|
||||||
aBoxDeltaModeler1.removedStatement(stmt);
|
aBoxDeltaModeler1.removedStatement(stmt);
|
||||||
|
@ -174,16 +162,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ReasonerPlugin plugin : getPluginList()) {
|
doPlugins(ModelUpdate.Operation.RETRACT,stmt);
|
||||||
try {
|
|
||||||
if (plugin.isInterestedInRemovedStatement(stmt)) {
|
|
||||||
plugin.removedABoxStatement(
|
|
||||||
stmt, aboxModel, inferenceModel, tboxModel);
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
log.error(t, t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// don't stop the edit if there's an exception
|
// don't stop the edit if there's an exception
|
||||||
|
@ -1061,18 +1040,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
removedABoxTypeAssertion(stmt, inferenceModel);
|
if (stmt.getPredicate().equals(RDF.type)) {
|
||||||
for (ReasonerPlugin plugin : getPluginList()) {
|
removedABoxTypeAssertion(stmt, inferenceModel);
|
||||||
try {
|
}
|
||||||
if (plugin.isInterestedInRemovedStatement(stmt)) {
|
|
||||||
plugin.removedABoxStatement(
|
|
||||||
stmt, aboxModel, inferenceModel, tboxModel);
|
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
log.error(t, t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
|
doPlugins(ModelUpdate.Operation.RETRACT,stmt);
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
abort = true;
|
abort = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1183,6 +1155,43 @@ public class SimpleReasoner extends StatementListener {
|
||||||
return individuals;
|
return individuals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void doPlugins(ModelUpdate.Operation op, Statement stmt) {
|
||||||
|
|
||||||
|
for (ReasonerPlugin plugin : getPluginList()) {
|
||||||
|
try {
|
||||||
|
switch (op) {
|
||||||
|
case ADD:
|
||||||
|
if (plugin.isInterestedInAddedStatement(stmt)) {
|
||||||
|
plugin.addedABoxStatement(stmt, aboxModel, inferenceModel, tboxModel);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RETRACT:
|
||||||
|
if (plugin.isInterestedInRemovedStatement(stmt)) {
|
||||||
|
plugin.removedABoxStatement(stmt, aboxModel, inferenceModel, tboxModel);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.error("Exception while processing " + (op == ModelUpdate.Operation.ADD ? "an added" : "a removed") +
|
||||||
|
" statement in SimpleReasoner plugin:" + plugin.getClass().getName() + " -- " + t.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInterestedInRemovedStatement(Statement stmt) {
|
||||||
|
|
||||||
|
if (stmt.getPredicate().equals(RDF.type)) return true;
|
||||||
|
|
||||||
|
for (ReasonerPlugin plugin : getPluginList()) {
|
||||||
|
if (plugin.isInterestedInRemovedStatement(stmt)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called when the system shuts down.
|
* This is called when the system shuts down.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue