Commit 589e589e authored by Maxime Lefrançois's avatar Maxime Lefrançois

solved exception when even the OWL reasoner doesn't want to read a certain ontology

parent c18780a6
Pipeline #3891 passed with stage
in 2 minutes and 2 seconds
......@@ -52,7 +52,7 @@ import fr.emse.gitlab.saref.managers.RepositoryManager;
public class Clause_9_6_4_Checker extends AbstractClauseChecker {
private static enum MESSAGE {
profile, consistent, satisfiable;
profile, consistent, satisfiable, exception;
}
private final SAREFExample example;
......@@ -89,25 +89,29 @@ public class Clause_9_6_4_Checker extends AbstractClauseChecker {
OntologyManager ontologyManager = pipeline.getOntologyManager();
Set<Explanation<OWLAxiom>> incExplanation = ontologyManager.getInconsistenceExplanations(ontology, errorLogger);
if (incExplanation != null && !incExplanation.isEmpty()) {
String explanation = incExplanation.stream().map(e -> e.getAxioms().toString())
.collect(Collectors.joining("\n- ", "\n\n- ", "\n\n"));
logError(getMessage(MESSAGE.consistent, explanation));
} else {
ExplanationGenerator<OWLAxiom> generator = ontologyManager.getExplanationGenerator(ontology);
ontology.classesInSignature(Imports.INCLUDED).forEach(c -> {
if(c.isOWLNothing()) {
return;
}
Set<Explanation<OWLAxiom>> incExplanation2 = ontologyManager.getIncoherenceExplanations(generator, c);
if (!incExplanation2.isEmpty()) {
String explanation = incExplanation2.stream().map(e -> e.getAxioms().toString())
.collect(Collectors.joining("\n- ", "\n\n- ", "\n\n"));
logError(getMessage(MESSAGE.satisfiable, c, explanation));
}
});
try {
Set<Explanation<OWLAxiom>> incExplanation = ontologyManager.getInconsistenceExplanations(ontology, errorLogger);
if (incExplanation != null && !incExplanation.isEmpty()) {
String explanation = incExplanation.stream().map(e -> e.getAxioms().toString())
.collect(Collectors.joining("\n- ", "\n\n- ", "\n\n"));
logError(getMessage(MESSAGE.consistent, explanation));
} else {
ExplanationGenerator<OWLAxiom> generator = ontologyManager.getExplanationGenerator(ontology);
ontology.classesInSignature(Imports.INCLUDED).forEach(c -> {
if(c.isOWLNothing()) {
return;
}
Set<Explanation<OWLAxiom>> incExplanation2 = ontologyManager.getIncoherenceExplanations(generator, c);
if (!incExplanation2.isEmpty()) {
String explanation = incExplanation2.stream().map(e -> e.getAxioms().toString())
.collect(Collectors.joining("\n- ", "\n\n- ", "\n\n"));
logError(getMessage(MESSAGE.satisfiable, c, explanation));
}
});
}
} catch (Exception ex) {
logError(getMessage(MESSAGE.exception), ex);
}
}
......
profile=The dataset in the example document shall satisfy the OWL2 DL profile. Violations are: %s
consistent=The dataset in the example document shall be Consistent. Violations are: %s
satisfiable=OWL Class %s declared in the example document should be satisfiable. Violations are: %s
exception=An exception occurred while trying to reason with the ontology.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment