[VIVO-1755] - Better error handling when reasoner disabled (#137)
* Better error handling when reasoner disabled * Change reasoner error log message to debug * Extend reasoner status error handling * Improve reasoner error log message and extend to JenaAdminActions * Bump up log level for admin action to 'warn' and edit admin panel error message
This commit is contained in:
parent
7981d24da7
commit
edef9309ab
4 changed files with 57 additions and 33 deletions
|
@ -199,6 +199,7 @@ public class BaseSiteAdminController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
String error = null;
|
String error = null;
|
||||||
String explanation = null;
|
String explanation = null;
|
||||||
|
try {
|
||||||
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
||||||
if (!status.isConsistent()) {
|
if (!status.isConsistent()) {
|
||||||
error = "INCONSISTENT ONTOLOGY: reasoning halted.";
|
error = "INCONSISTENT ONTOLOGY: reasoning halted.";
|
||||||
|
@ -206,6 +207,10 @@ public class BaseSiteAdminController extends FreemarkerHttpServlet {
|
||||||
} else if ( status.isInErrorState() ) {
|
} else if ( status.isInErrorState() ) {
|
||||||
error = "An error occurred during reasoning. Reasoning has been halted. See error log for details.";
|
error = "An error occurred during reasoning. Reasoning has been halted. See error log for details.";
|
||||||
}
|
}
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
error = "The inferencing engine is disabled. Data entered manually may exhibit unexpected behavior prior to inferencing.";
|
||||||
|
log.debug("Status of reasoner could not be determined. It is likely disabled.", e);
|
||||||
|
}
|
||||||
|
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
Map<String, String> tboxReasonerStatus = new HashMap<String, String>();
|
Map<String, String> tboxReasonerStatus = new HashMap<String, String>();
|
||||||
|
|
|
@ -192,6 +192,7 @@ public class JenaAdminActions extends BaseEditController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printRestrictions() {
|
private void printRestrictions() {
|
||||||
|
try {
|
||||||
TBoxReasonerModule reasoner = ApplicationUtils.instance().getTBoxReasonerModule();
|
TBoxReasonerModule reasoner = ApplicationUtils.instance().getTBoxReasonerModule();
|
||||||
for (Restriction rest : reasoner.listRestrictions() ) {
|
for (Restriction rest : reasoner.listRestrictions() ) {
|
||||||
if (rest.isAllValuesFromRestriction()) {
|
if (rest.isAllValuesFromRestriction()) {
|
||||||
|
@ -213,7 +214,10 @@ public class JenaAdminActions extends BaseEditController {
|
||||||
for (Resource inst : rest.listInstances().toList() ) {
|
for (Resource inst : rest.listInstances().toList() ) {
|
||||||
log.trace(" "+inst.getURI());
|
log.trace(" "+inst.getURI());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalStateException e) {
|
||||||
|
log.warn("Status of reasoner could not be determined. It is likely disabled", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,8 +360,13 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean reasoningAvailable() {
|
protected boolean reasoningAvailable() {
|
||||||
|
try {
|
||||||
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
||||||
return status.isConsistent() && !status.isInErrorState();
|
return status.isConsistent() && !status.isInErrorState();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
log.debug("Status of reasoner could not be determined. It is likely disabled.", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRequiredDatatypeURI(Individual individual, DataProperty dataprop, List<String> vclassURIs) {
|
private String getRequiredDatatypeURI(Individual individual, DataProperty dataprop, List<String> vclassURIs) {
|
||||||
|
|
|
@ -8,6 +8,9 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
|
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||||
|
@ -17,6 +20,8 @@ import edu.cornell.mannlib.vitro.webapp.modules.tboxreasoner.TBoxReasonerStatus;
|
||||||
|
|
||||||
public class IndividualsViaVClassOptions implements FieldOptions {
|
public class IndividualsViaVClassOptions implements FieldOptions {
|
||||||
|
|
||||||
|
protected static final Log log = LogFactory.getLog(IndividualsViaVClassOptions.class.getName());
|
||||||
|
|
||||||
public static final String LEFT_BLANK = "";
|
public static final String LEFT_BLANK = "";
|
||||||
protected List<String> vclassURIs;
|
protected List<String> vclassURIs;
|
||||||
protected String defaultOptionLabel;
|
protected String defaultOptionLabel;
|
||||||
|
@ -102,8 +107,13 @@ public class IndividualsViaVClassOptions implements FieldOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isReasoningAvailable(){
|
protected boolean isReasoningAvailable(){
|
||||||
|
try {
|
||||||
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
TBoxReasonerStatus status = ApplicationUtils.instance().getTBoxReasonerModule().getStatus();
|
||||||
return status.isConsistent() && !status.isInErrorState();
|
return status.isConsistent() && !status.isInErrorState();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
log.debug("Status of reasoner could not be determined. It is likely disabled.", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, Individual> addWhenMissingInference( String classUri , WebappDaoFactory wDaoFact ){
|
protected Map<String, Individual> addWhenMissingInference( String classUri , WebappDaoFactory wDaoFact ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue