NIHVIVO-2577
This commit is contained in:
parent
3ba088e8e9
commit
ae9012421b
1 changed files with 5 additions and 32 deletions
|
@ -670,54 +670,27 @@ public class SimpleReasoner extends StatementListener {
|
||||||
* inference models.
|
* inference models.
|
||||||
*/
|
*/
|
||||||
public synchronized void recomputeABox() {
|
public synchronized void recomputeABox() {
|
||||||
|
|
||||||
// recompute the ABox inferences
|
// recompute the inferences
|
||||||
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
||||||
aboxModel.enterCriticalSection(Lock.READ);
|
aboxModel.enterCriticalSection(Lock.READ);
|
||||||
tboxModel.enterCriticalSection(Lock.READ);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
inferenceRebuildModel.removeAll();
|
inferenceRebuildModel.removeAll();
|
||||||
|
|
||||||
// compute the class-based inferences
|
|
||||||
log.info("Computing class-based ABox inferences");
|
|
||||||
|
|
||||||
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
addedABoxTypeAssertion(stmt, inferenceRebuildModel);
|
addedABoxTypeAssertion(stmt, inferenceRebuildModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute the property-based inferences
|
|
||||||
log.info("Computing property-based ABox inferences");
|
|
||||||
iter = tboxModel.listStatements((Resource) null, RDFS.subPropertyOf, (RDFNode) null);
|
|
||||||
int numStmts = 0;
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
numStmts++;
|
|
||||||
if ((numStmts % 400) == 0) {
|
|
||||||
log.info("Still computing property-based ABox inferences...");
|
|
||||||
}
|
|
||||||
|
|
||||||
Statement stmt = iter.next();
|
|
||||||
addedTBoxStatement(stmt, inferenceRebuildModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
iter = tboxModel.listStatements((Resource) null, OWL.equivalentProperty, (RDFNode) null);
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Statement stmt = iter.next();
|
|
||||||
addedTBoxStatement(stmt, inferenceRebuildModel);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while recomputing ABox inference model", e);
|
log.error("Exception while recomputing ABox inference model", e);
|
||||||
} finally {
|
} finally {
|
||||||
aboxModel.leaveCriticalSection();
|
aboxModel.leaveCriticalSection();
|
||||||
tboxModel.leaveCriticalSection();
|
inferenceRebuildModel.leaveCriticalSection();
|
||||||
inferenceRebuildModel.leaveCriticalSection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// reflect the recomputed inferences into the application inference
|
// reflect the recomputed inferences into the application inference
|
||||||
// model.
|
// model.
|
||||||
inferenceRebuildModel.enterCriticalSection(Lock.READ);
|
inferenceRebuildModel.enterCriticalSection(Lock.READ);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue