Source:
<code>private static void checkReferenceViolations(OWLOntology ontology, Map<String, String> options) throws InvalidReferenceException { Set<InvalidReferenceViolation> referenceViolations = InvalidReferenceChecker.getInvalidReferenceViolations(ontology, false); if (referenceViolations.size() > 0) { logger.error( "Reference violations found: " + referenceViolations.size() + " - reasoning may be incomplete"); int maxDanglings = 10; int danglings = 0; for (InvalidReferenceViolation v : referenceViolations) { 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("<LINK_0>")) { continue; } } if (v.getAxiom() instanceof OWLSubObjectPropertyOfAxiom) { OWLSubObjectPropertyOfAxiom sub = (OWLSubObjectPropertyOfAxiom) v.getAxiom(); OWLObjectPropertyExpression sup = sub.getSuperProperty(); if (!sup.isAnonymous() && sup.asOWLObjectProperty() .getIRI() .toString() .equals("<LINK_2>")) { continue; } } if (v.getAxiom() instanceof OWLClassAssertionAxiom) { OWLClassAssertionAxiom sub = (OWLClassAssertionAxiom) v.getAxiom(); OWLClassExpression sup = sub.getClassExpression(); <START> if (!sup.isAnonymous() <END> && sup.asOWLClass() .getIRI() .toString() .equals("<LINK_1>")) { continue; } } if (v.getCategory().equals(InvalidReferenceViolation.Category.DANGLING) && danglings < maxDanglings) { logger.error("Reference violation: " + v); danglings++; } else if (!v.getCategory().equals(InvalidReferenceViolation.Category.DANGLING)) { logger.error("Reference violation: " + v); } } if (OptionsHelper.optionIsTrue(options, "prevent-invalid-references")) { throw new InvalidReferenceException(referenceViolations); } } }</code><technical_language>Minor: OWLClassExpression::isOWLThing() here</technical_language>

Target:
private static void checkReferenceViolations(OWLOntology ontology, Map<String, String> options) throws InvalidReferenceException { Set<InvalidReferenceViolation> referenceViolations = InvalidReferenceChecker.getInvalidReferenceViolations(ontology, false); Set<InvalidReferenceViolation> filteredViolations = new HashSet(); if (referenceViolations.size() > 0) { for (InvalidReferenceViolation v : referenceViolations) { 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("<LINK_0>")) { continue; } } if (v.getAxiom() instanceof OWLSubObjectPropertyOfAxiom) { OWLSubObjectPropertyOfAxiom sub = (OWLSubObjectPropertyOfAxiom) v.getAxiom(); OWLObjectPropertyExpression sup = sub.getSuperProperty(); if (!sup.isAnonymous() && sup.asOWLObjectProperty() .getIRI() .toString() .equals("<LINK_2>")) { continue; } } if (v.getAxiom() instanceof OWLClassAssertionAxiom) { OWLClassAssertionAxiom sub = (OWLClassAssertionAxiom) v.getAxiom(); if (sub.getClassExpression().isOWLThing()) { continue; } } filteredViolations.add(v); } } if (filteredViolations.size() > 0) { logger.error( "Reference violations found: " + filteredViolations.size() + " - reasoning may be incomplete"); int maxDanglings = 10; int danglings = 0; for (InvalidReferenceViolation v : filteredViolations) { if (v.getCategory().equals(InvalidReferenceViolation.Category.DANGLING) && danglings < maxDanglings) { logger.error("Reference violation: " + v); danglings++; } else if (!v.getCategory().equals(InvalidReferenceViolation.Category.DANGLING)) { logger.error("Reference violation: " + v); } } if (OptionsHelper.optionIsTrue(options, "prevent-invalid-references")) { throw new InvalidReferenceException(referenceViolations); } } }