Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress logging for selected InvalidReferenceViolations #568

Merged
merged 2 commits into from
Sep 12, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions robot-core/src/main/java/org/obolibrary/robot/ReasonOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,47 @@ private static void checkReferenceViolations(OWLOntology ontology, Map<String, S
int maxDanglings = 10;
int danglings = 0;
for (InvalidReferenceViolation v : referenceViolations) {
// Don't log errors for:
// - annotations
// - subclass of ObsoleteClass
// - subproperty of ObsoleteProperty
// - rdf:type owl:Thing
if (v.getAxiom() instanceof OWLAnnotationAxiom) {
continue;
}
if (v.getAxiom() instanceof OWLSubClassOfAxiom) {
OWLSubClassOfAxiom sub = (OWLSubClassOfAxiom) v.getAxiom();
OWLClassExpression sup = sub.getSuperClass();
if (!sup.isAnonymous()
&& sup.asOWLClass()
.getIRI()
.toString()
.equals("http://www.geneontology.org/formats/oboInOwl#ObsoleteClass")) {
continue;
}
}
if (v.getAxiom() instanceof OWLSubObjectPropertyOfAxiom) {
OWLSubObjectPropertyOfAxiom sub = (OWLSubObjectPropertyOfAxiom) v.getAxiom();
OWLObjectPropertyExpression sup = sub.getSuperProperty();
if (!sup.isAnonymous()
&& sup.asOWLObjectProperty()
.getIRI()
.toString()
.equals("http://www.geneontology.org/formats/oboInOwl#ObsoleteProperty")) {
continue;
}
}
if (v.getAxiom() instanceof OWLClassAssertionAxiom) {
OWLClassAssertionAxiom sub = (OWLClassAssertionAxiom) v.getAxiom();
OWLClassExpression sup = sub.getClassExpression();
if (!sup.isAnonymous()
&& sup.asOWLClass()
.getIRI()
.toString()
.equals("http://www.w3.org/2002/07/owl#Thing")) {
continue;
}
}

if (v.getCategory().equals(InvalidReferenceViolation.Category.DANGLING)
&& danglings < maxDanglings) {
Expand Down