NIHVIVO-1572 inference recomputing controller
This commit is contained in:
parent
bf48d5d616
commit
35933a9ae6
2 changed files with 18 additions and 2 deletions
|
@ -42,10 +42,10 @@ public class SimpleReasonerRecomputeController extends FreemarkerHttpServlet {
|
||||||
} else {
|
} else {
|
||||||
if (simpleReasoner.isRecomputing()) {
|
if (simpleReasoner.isRecomputing()) {
|
||||||
messageStr =
|
messageStr =
|
||||||
"The SimpleReasoner is already in the process of " +
|
"The SimpleReasoner is currently in the process of " +
|
||||||
"recomputing inferences.";
|
"recomputing inferences.";
|
||||||
} else {
|
} else {
|
||||||
simpleReasoner.recompute();
|
new Thread(new Recomputer(simpleReasoner)).start();
|
||||||
messageStr = "Recomputation of inferences started";
|
messageStr = "Recomputation of inferences started";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,4 +63,18 @@ public class SimpleReasonerRecomputeController extends FreemarkerHttpServlet {
|
||||||
return new TemplateResponseValues(Template.MESSAGE.toString(), body);
|
return new TemplateResponseValues(Template.MESSAGE.toString(), body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class Recomputer implements Runnable {
|
||||||
|
|
||||||
|
private SimpleReasoner simpleReasoner;
|
||||||
|
|
||||||
|
public Recomputer(SimpleReasoner simpleReasoner) {
|
||||||
|
this.simpleReasoner = simpleReasoner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
simpleReasoner.recompute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,6 +501,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
inferenceRebuildModel.leaveCriticalSection();
|
inferenceRebuildModel.leaveCriticalSection();
|
||||||
scratchpadModel.leaveCriticalSection();
|
scratchpadModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("ABox inferences recomputed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following three methods aren't currently called; the default behavior of VIVO is to not materialize such inferences.
|
// The following three methods aren't currently called; the default behavior of VIVO is to not materialize such inferences.
|
||||||
|
|
Loading…
Add table
Reference in a new issue