NIHVIVO-2766 (abox recompute in separate thread)
This commit is contained in:
parent
94ae938900
commit
c492a4c397
3 changed files with 100 additions and 42 deletions
|
@ -134,9 +134,6 @@ xmlns:vitro="&vitro;"
|
||||||
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#shortDef">
|
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#shortDef">
|
||||||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AnnotationProperty"/>
|
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AnnotationProperty"/>
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#DependentResource">
|
|
||||||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
|
|
||||||
</rdf:Description>
|
|
||||||
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#publicDescriptionAnnot">
|
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#publicDescriptionAnnot">
|
||||||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AnnotationProperty"/>
|
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AnnotationProperty"/>
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
|
|
|
@ -100,8 +100,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (stmt.getPredicate().equals(RDF.type)) {
|
if (stmt.getPredicate().equals(RDF.type)) {
|
||||||
addedABoxTypeAssertion(stmt, inferenceModel);
|
addedABoxTypeAssertion(stmt, inferenceModel, new HashSet<String>());
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceModel);
|
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
|
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
|
||||||
else {
|
else {
|
||||||
|
@ -110,7 +110,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
*/
|
*/
|
||||||
} 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 adding inferences: ", e);
|
log.error("Exception while adding inferences: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
try {
|
try {
|
||||||
if (stmt.getPredicate().equals(RDF.type)) {
|
if (stmt.getPredicate().equals(RDF.type)) {
|
||||||
removedABoxTypeAssertion(stmt, inferenceModel);
|
removedABoxTypeAssertion(stmt, inferenceModel);
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceModel);
|
setMostSpecificTypes(stmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
|
/* uncomment this to enable subproperty/equivalent property inferencing. sjm222 5/13/2011
|
||||||
else {
|
else {
|
||||||
|
@ -134,7 +134,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
*/
|
*/
|
||||||
} 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 retracting inferences: ", e);
|
log.error("Exception while retracting inferences: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
} 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 adding inference(s): ", e);
|
log.error("Exception while adding inference(s): " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
*/
|
*/
|
||||||
} 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 removing inference(s): ", e);
|
log.error("Exception while removing inference(s): " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,9 +288,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
* A assert that B is of that type.
|
* A assert that B is of that type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addedABoxTypeAssertion(Statement stmt, Model inferenceModel) {
|
public void addedABoxTypeAssertion(Statement stmt, Model inferenceModel, HashSet<String> unknownTypes) {
|
||||||
|
|
||||||
//System.out.println("sjm: addedABoxTypeAssertion: " + stmtString(stmt));
|
|
||||||
tboxModel.enterCriticalSection(Lock.READ);
|
tboxModel.enterCriticalSection(Lock.READ);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -298,9 +297,9 @@ public class SimpleReasoner extends StatementListener {
|
||||||
OntClass cls = null;
|
OntClass cls = null;
|
||||||
|
|
||||||
if ( (stmt.getObject().asResource()).getURI() != null ) {
|
if ( (stmt.getObject().asResource()).getURI() != null ) {
|
||||||
cls = tboxModel.getOntClass(stmt.getObject().asResource().getURI());
|
|
||||||
|
|
||||||
if (cls != null) {
|
cls = tboxModel.getOntClass(stmt.getObject().asResource().getURI());
|
||||||
|
if (cls != null) {
|
||||||
|
|
||||||
List<OntClass> parents = (cls.listSuperClasses(false)).toList();
|
List<OntClass> parents = (cls.listSuperClasses(false)).toList();
|
||||||
parents.addAll((cls.listEquivalentClasses()).toList());
|
parents.addAll((cls.listEquivalentClasses()).toList());
|
||||||
|
@ -327,8 +326,13 @@ public class SimpleReasoner extends StatementListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( !(stmt.getObject().asResource().getNameSpace()).equals(OWL.NS))
|
if ( !(stmt.getObject().asResource().getNameSpace()).equals(OWL.NS)) {
|
||||||
log.warn("Didn't find target class (the object of the added rdf:type statement) in the TBox");
|
if (!unknownTypes.contains(stmt.getObject().asResource().getURI())) {
|
||||||
|
unknownTypes.add(stmt.getObject().asResource().getURI());
|
||||||
|
log.warn("Didn't find the target class (the object of an added rdf:type statement) in the TBox: " +
|
||||||
|
(stmt.getObject().asResource()).getURI() + ". No class subsumption reasoning will be done based on type assertions of this type.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("The object of this rdf:type assertion has a null URI: " + stmtString(stmt));
|
log.warn("The object of this rdf:type assertion has a null URI: " + stmtString(stmt));
|
||||||
|
@ -406,8 +410,6 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
public void removedABoxTypeAssertion(Statement stmt, Model inferenceModel) {
|
public void removedABoxTypeAssertion(Statement stmt, Model inferenceModel) {
|
||||||
|
|
||||||
//System.out.println("sjm: removedABoxTypeAssertion: " + stmtString(stmt));
|
|
||||||
|
|
||||||
tboxModel.enterCriticalSection(Lock.READ);
|
tboxModel.enterCriticalSection(Lock.READ);
|
||||||
|
|
||||||
// convert this method to use generic resources - not get ontclass, not cls.listSuperClasses...
|
// convert this method to use generic resources - not get ontclass, not cls.listSuperClasses...
|
||||||
|
@ -454,7 +456,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("Didn't find target class (the object of the removed rdf:type statement) in the TBox: " + ((Resource)stmt.getObject()).getURI());
|
log.warn("Didn't find target class (the object of the removed rdf:type statement) in the TBox: "
|
||||||
|
+ ((Resource)stmt.getObject()).getURI() + ". No class subsumption reasoning will be performed based on the removal of this assertion.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("The object of this rdf:type assertion has a null URI: " + stmtString(stmt));
|
log.warn("The object of this rdf:type assertion has a null URI: " + stmtString(stmt));
|
||||||
|
@ -598,7 +601,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
if (!inferenceModel.contains(infStmt)) {
|
if (!inferenceModel.contains(infStmt)) {
|
||||||
inferenceModel.add(infStmt);
|
inferenceModel.add(infStmt);
|
||||||
setMostSpecificTypes(infStmt.getSubject(), inferenceModel);
|
setMostSpecificTypes(infStmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -641,7 +644,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
if (inferenceModel.contains(infStmt)) {
|
if (inferenceModel.contains(infStmt)) {
|
||||||
inferenceModel.remove(infStmt);
|
inferenceModel.remove(infStmt);
|
||||||
setMostSpecificTypes(infStmt.getSubject(), inferenceModel);
|
setMostSpecificTypes(infStmt.getSubject(), inferenceModel, new HashSet<String>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -744,9 +747,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
* indicate them for the individual with the core:mostSpecificType
|
* indicate them for the individual with the core:mostSpecificType
|
||||||
* annotation.
|
* annotation.
|
||||||
*/
|
*/
|
||||||
public void setMostSpecificTypes(Resource individual, Model inferenceModel) {
|
public void setMostSpecificTypes(Resource individual, Model inferenceModel, HashSet<String> unknownTypes) {
|
||||||
|
|
||||||
//System.out.println("sjm: setMostSpecificTypes called for individual " + individual.getURI());
|
|
||||||
inferenceModel.enterCriticalSection(Lock.WRITE);
|
inferenceModel.enterCriticalSection(Lock.WRITE);
|
||||||
aboxModel.enterCriticalSection(Lock.READ);
|
aboxModel.enterCriticalSection(Lock.READ);
|
||||||
tboxModel.enterCriticalSection(Lock.READ);
|
tboxModel.enterCriticalSection(Lock.READ);
|
||||||
|
@ -780,8 +782,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
if (ontClass == null) {
|
if (ontClass == null) {
|
||||||
if ( !(stmt.getObject().asResource().getNameSpace()).equals(OWL.NS)) {
|
if ( !(stmt.getObject().asResource().getNameSpace()).equals(OWL.NS)) {
|
||||||
log.warn("(setMostSpecificType) Didn't find target class (the object of the added rdf:type statement) in the TBox: " +
|
if (!unknownTypes.contains(stmt.getObject().asResource().getURI())) {
|
||||||
(stmt.getObject().asResource()).getURI() + "\nstatement is: " + stmtString(stmt));
|
unknownTypes.add(stmt.getObject().asResource().getURI());
|
||||||
|
log.warn("Didn't find the target class (the object of an added rdf:type statement) in the TBox: " +
|
||||||
|
(stmt.getObject().asResource()).getURI() + ". No mostSpecificType computation will be done based on type assertions of this type.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -914,20 +919,29 @@ public class SimpleReasoner extends StatementListener {
|
||||||
*/
|
*/
|
||||||
public synchronized void recomputeABox() {
|
public synchronized void recomputeABox() {
|
||||||
|
|
||||||
|
HashSet<String> unknownTypes = new HashSet<String>();
|
||||||
|
|
||||||
// recompute the inferences
|
// recompute the inferences
|
||||||
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
||||||
aboxModel.enterCriticalSection(Lock.WRITE);
|
aboxModel.enterCriticalSection(Lock.WRITE);
|
||||||
tboxModel.enterCriticalSection(Lock.READ);
|
tboxModel.enterCriticalSection(Lock.READ);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
log.info("Computing class-based ABox inferences");
|
||||||
inferenceRebuildModel.removeAll();
|
inferenceRebuildModel.removeAll();
|
||||||
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
||||||
|
|
||||||
log.info("Computing class-based ABox inferences");
|
int numStmts = 0;
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
addedABoxTypeAssertion(stmt, inferenceRebuildModel);
|
addedABoxTypeAssertion(stmt, inferenceRebuildModel, unknownTypes);
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceRebuildModel);
|
setMostSpecificTypes(stmt.getSubject(), inferenceRebuildModel, unknownTypes);
|
||||||
|
|
||||||
|
numStmts++;
|
||||||
|
if ((numStmts % 8000) == 0) {
|
||||||
|
log.info("Still computing class-based ABox inferences...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -984,6 +998,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
inferenceRebuildModel.leaveCriticalSection();
|
inferenceRebuildModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("Finished computing class-based ABox inferences");
|
||||||
|
|
||||||
// reflect the recomputed inferences into the application inference
|
// reflect the recomputed inferences into the application inference
|
||||||
// model.
|
// model.
|
||||||
|
@ -992,6 +1007,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
log.info("Updating ABox inference model");
|
log.info("Updating ABox inference model");
|
||||||
// Remove everything from the current inference model that is not
|
// Remove everything from the current inference model that is not
|
||||||
// in the recomputed inference model
|
// in the recomputed inference model
|
||||||
|
int num = 0;
|
||||||
try {
|
try {
|
||||||
inferenceModel.enterCriticalSection(Lock.READ);
|
inferenceModel.enterCriticalSection(Lock.READ);
|
||||||
|
|
||||||
|
@ -1004,6 +1020,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
if (!inferenceRebuildModel.contains(stmt)) {
|
if (!inferenceRebuildModel.contains(stmt)) {
|
||||||
scratchpadModel.add(stmt);
|
scratchpadModel.add(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num++;
|
||||||
|
if ((num % 8000) == 0) {
|
||||||
|
log.info("Still updating ABox inference model (removing outdated inferences)...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
||||||
|
@ -1033,6 +1054,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
if (!inferenceModel.contains(stmt)) {
|
if (!inferenceModel.contains(stmt)) {
|
||||||
scratchpadModel.add(stmt);
|
scratchpadModel.add(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
num++;
|
||||||
|
if ((num % 8000) == 0) {
|
||||||
|
log.info("Still updating ABox inference model (adding new inferences)...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
||||||
|
@ -1063,6 +1089,8 @@ public class SimpleReasoner extends StatementListener {
|
||||||
*/
|
*/
|
||||||
public synchronized void recomputeMostSpecificType() {
|
public synchronized void recomputeMostSpecificType() {
|
||||||
|
|
||||||
|
HashSet<String> unknownTypes = new HashSet<String>();
|
||||||
|
|
||||||
// recompute the inferences
|
// recompute the inferences
|
||||||
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
||||||
aboxModel.enterCriticalSection(Lock.WRITE);
|
aboxModel.enterCriticalSection(Lock.WRITE);
|
||||||
|
@ -1073,9 +1101,16 @@ public class SimpleReasoner extends StatementListener {
|
||||||
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, (RDFNode) null);
|
||||||
|
|
||||||
log.info("Computing mostSpecificType annotations");
|
log.info("Computing mostSpecificType annotations");
|
||||||
|
int numStmts = 0;
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
setMostSpecificTypes(stmt.getSubject(), inferenceRebuildModel);
|
setMostSpecificTypes(stmt.getSubject(), inferenceRebuildModel, unknownTypes);
|
||||||
|
|
||||||
|
numStmts++;
|
||||||
|
if ((numStmts % 8000) == 0) {
|
||||||
|
log.info("Still computing mostSpecificType annotations...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while recomputing ABox inference model", e);
|
log.error("Exception while recomputing ABox inference model", e);
|
||||||
|
@ -1088,12 +1123,13 @@ public class SimpleReasoner extends StatementListener {
|
||||||
inferenceRebuildModel.leaveCriticalSection();
|
inferenceRebuildModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("Finished computing mostSpecificType annotations");
|
||||||
|
|
||||||
// reflect the recomputed inferences into the application inference
|
// reflect the recomputed inferences into the application inference
|
||||||
// model.
|
// model.
|
||||||
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
inferenceRebuildModel.enterCriticalSection(Lock.WRITE);
|
||||||
scratchpadModel.enterCriticalSection(Lock.WRITE);
|
scratchpadModel.enterCriticalSection(Lock.WRITE);
|
||||||
log.info("Updating ABox inference model");
|
log.info("Updating ABox inference model with mostSpecificType annotations");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Add everything from the recomputed inference model that is not already
|
// Add everything from the recomputed inference model that is not already
|
||||||
|
@ -1104,11 +1140,18 @@ public class SimpleReasoner extends StatementListener {
|
||||||
scratchpadModel.removeAll();
|
scratchpadModel.removeAll();
|
||||||
StmtIterator iter = inferenceRebuildModel.listStatements();
|
StmtIterator iter = inferenceRebuildModel.listStatements();
|
||||||
|
|
||||||
|
int numStmts = 0;
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
if (!inferenceModel.contains(stmt)) {
|
if (!inferenceModel.contains(stmt)) {
|
||||||
scratchpadModel.add(stmt);
|
scratchpadModel.add(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numStmts++;
|
||||||
|
if ((numStmts % 8000) == 0) {
|
||||||
|
log.info("Still updating ABox inference model with mostSpecificType annotations...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
log.error("Exception while reconciling the current and recomputed ABox inference models", e);
|
||||||
|
@ -1131,7 +1174,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
scratchpadModel.leaveCriticalSection();
|
scratchpadModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("ABox inference model updated");
|
log.info("ABox inference model updated with mostSpecificType annotations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SimpleReasoner getSimpleReasonerFromServletContext(ServletContext ctx) {
|
public static SimpleReasoner getSimpleReasonerFromServletContext(ServletContext ctx) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ public class SimpleReasonerSetup implements ServletContextListener {
|
||||||
try {
|
try {
|
||||||
// set up Pellet reasoning for the TBox
|
// set up Pellet reasoning for the TBox
|
||||||
|
|
||||||
|
|
||||||
OntModelSelector assertionsOms = ModelContext.getBaseOntModelSelector(sce.getServletContext());
|
OntModelSelector assertionsOms = ModelContext.getBaseOntModelSelector(sce.getServletContext());
|
||||||
OntModelSelector inferencesOms = ModelContext.getInferenceOntModelSelector(sce.getServletContext());
|
OntModelSelector inferencesOms = ModelContext.getInferenceOntModelSelector(sce.getServletContext());
|
||||||
OntModelSelector unionOms = ModelContext.getUnionOntModelSelector(sce.getServletContext());
|
OntModelSelector unionOms = ModelContext.getUnionOntModelSelector(sce.getServletContext());
|
||||||
|
@ -110,9 +109,9 @@ public class SimpleReasonerSetup implements ServletContextListener {
|
||||||
sleeps++;
|
sleeps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
simpleReasoner.recompute();
|
new Thread(new ABoxRecomputer(simpleReasoner,false)).start();
|
||||||
} else if ( isMSTComputeRequired(sce.getServletContext()) ) {
|
} else if ( isMSTComputeRequired(sce.getServletContext()) ) {
|
||||||
log.info("most specific type computation required");
|
log.info("mostSpecificType computation required");
|
||||||
|
|
||||||
int sleeps = 0;
|
int sleeps = 0;
|
||||||
while (sleeps < 1000 && pelletListener.isReasoning()) {
|
while (sleeps < 1000 && pelletListener.isReasoning()) {
|
||||||
|
@ -123,7 +122,7 @@ public class SimpleReasonerSetup implements ServletContextListener {
|
||||||
sleeps++;
|
sleeps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
simpleReasoner.recomputeMostSpecificType();
|
new Thread(new ABoxRecomputer(simpleReasoner,true)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
assertionsOms.getTBoxModel().register(new SimpleReasonerTBoxListener(simpleReasoner));
|
assertionsOms.getTBoxModel().register(new SimpleReasonerTBoxListener(simpleReasoner));
|
||||||
|
@ -163,4 +162,23 @@ public class SimpleReasonerSetup implements ServletContextListener {
|
||||||
private static boolean isMSTComputeRequired(ServletContext ctx) {
|
private static boolean isMSTComputeRequired(ServletContext ctx) {
|
||||||
return (ctx.getAttribute(MSTCOMPUTE_REQUIRED_ATTR) != null);
|
return (ctx.getAttribute(MSTCOMPUTE_REQUIRED_ATTR) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ABoxRecomputer implements Runnable {
|
||||||
|
|
||||||
|
private SimpleReasoner simpleReasoner;
|
||||||
|
private boolean justMST;
|
||||||
|
|
||||||
|
public ABoxRecomputer(SimpleReasoner simpleReasoner, boolean justMST) {
|
||||||
|
this.simpleReasoner = simpleReasoner;
|
||||||
|
this.justMST = justMST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (justMST) {
|
||||||
|
simpleReasoner.recomputeMostSpecificType();
|
||||||
|
} else {
|
||||||
|
simpleReasoner.recompute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue