diff --git a/docs/examples/template-drop-axiom-filter.owl b/docs/examples/template-drop-axiom-filter.owl index 5c14a517a..b97fe2b01 100644 --- a/docs/examples/template-drop-axiom-filter.owl +++ b/docs/examples/template-drop-axiom-filter.owl @@ -52,6 +52,7 @@ Weight of a mouse or rat in kilograms (kg). Rebecca C Jackson weight in kilograms + diff --git a/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java b/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java index 106dbb472..6cc831f64 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java +++ b/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java @@ -1492,6 +1492,54 @@ private static Set getAxiomSubjects(OWLAxiom axiom) { for (OWLObjectPropertyExpression expr : spcAxiom.getPropertyChain()) { iris.addAll(getIRIsFromEntities(expr.getSignature())); } + } else if (axiom instanceof OWLObjectPropertyCharacteristicAxiom) { + OWLObjectPropertyCharacteristicAxiom chAxiom = (OWLObjectPropertyCharacteristicAxiom) axiom; + OWLObjectPropertyExpression subject = chAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLObjectProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLObjectPropertyDomainAxiom) { + OWLObjectPropertyDomainAxiom domainAxiom = (OWLObjectPropertyDomainAxiom) axiom; + OWLObjectPropertyExpression subject = domainAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLObjectProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLDataPropertyRangeAxiom) { + OWLDataPropertyRangeAxiom rangeAxiom = (OWLDataPropertyRangeAxiom) axiom; + OWLDataPropertyExpression subject = rangeAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLDataProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLObjectPropertyDomainAxiom) { + OWLObjectPropertyDomainAxiom domainAxiom = (OWLObjectPropertyDomainAxiom) axiom; + OWLObjectPropertyExpression subject = domainAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLObjectProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLDataPropertyRangeAxiom) { + OWLDataPropertyRangeAxiom rangeAxiom = (OWLDataPropertyRangeAxiom) axiom; + OWLDataPropertyExpression subject = rangeAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLDataProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLInverseObjectPropertiesAxiom) { + OWLInverseObjectPropertiesAxiom iopAxiom = (OWLInverseObjectPropertiesAxiom) axiom; + OWLObjectPropertyExpression subject = iopAxiom.getFirstProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLObjectProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } } else { logger.warn("Axiom type not supported: " + axiom.getClass().toString()); }