diff --git a/CHANGELOG.md b/CHANGELOG.md index c0623a9bf..2f9cd146f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Handle IRIs that are not entities in export [#1168] - Fix integration tests [#1181] - Invalid Xrefs test has been fixed to recognise invalid CURIEs correctly [#1127] +- Fix issue with correctly determining base entities [#1108] ## [1.9.5] - 2023-09-20 @@ -399,7 +400,9 @@ First official release of ROBOT! [#1152]: https://github.com/ontodev/robot/issues/1152 [#1148]: https://github.com/ontodev/robot/pull/1148 [#1135]: https://github.com/ontodev/robot/pull/1135 +[#1127]: https://github.com/ontodev/robot/pull/1127 [#1119]: https://github.com/ontodev/robot/pull/1119 +[#1108]: https://github.com/ontodev/robot/pull/1108 [#1104]: https://github.com/ontodev/robot/pull/1104 [#1100]: https://github.com/ontodev/robot/pull/1100 [#1091]: https://github.com/ontodev/robot/issues/1091 diff --git a/docs/examples/template-base-filter.owl b/docs/examples/template-base-filter.owl index a961903d0..e463796ab 100644 --- a/docs/examples/template-base-filter.owl +++ b/docs/examples/template-base-filter.owl @@ -58,6 +58,15 @@ Weight of a mouse or rat in kilograms (kg). Rebecca C Jackson weight in kilograms + + + + + + + + + diff --git a/docs/examples/template-base.owl b/docs/examples/template-base.owl index a961903d0..e463796ab 100644 --- a/docs/examples/template-base.owl +++ b/docs/examples/template-base.owl @@ -58,6 +58,15 @@ Weight of a mouse or rat in kilograms (kg). Rebecca C Jackson weight in kilograms + + + + + + + + + diff --git a/docs/examples/template-drop-axiom-filter.owl b/docs/examples/template-drop-axiom-filter.owl index 5c14a517a..283b621cd 100644 --- a/docs/examples/template-drop-axiom-filter.owl +++ b/docs/examples/template-drop-axiom-filter.owl @@ -52,6 +52,15 @@ Weight of a mouse or rat in kilograms (kg). Rebecca C Jackson weight in kilograms + + + + + + + + + @@ -126,5 +135,5 @@ - + diff --git a/docs/examples/template-drop-axiom-remove.owl b/docs/examples/template-drop-axiom-remove.owl index 5c14a517a..3fd4d36c8 100644 --- a/docs/examples/template-drop-axiom-remove.owl +++ b/docs/examples/template-drop-axiom-remove.owl @@ -52,6 +52,15 @@ 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..595153bc8 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java +++ b/robot-core/src/main/java/org/obolibrary/robot/RelatedObjectsHelper.java @@ -1417,6 +1417,14 @@ private static Set getAxiomSubjects(OWLAxiom axiom) { } else { iris.addAll(getIRIsFromEntities(subject.getSignature())); } + } else if (axiom instanceof OWLSubAnnotationPropertyOfAxiom) { + OWLSubAnnotationPropertyOfAxiom spAxiom = (OWLSubAnnotationPropertyOfAxiom) axiom; + OWLAnnotationProperty subject = spAxiom.getSubProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLAnnotationProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } } else if (axiom instanceof OWLEquivalentDataPropertiesAxiom) { OWLEquivalentDataPropertiesAxiom eqAxiom = (OWLEquivalentDataPropertiesAxiom) axiom; for (OWLSubDataPropertyOfAxiom spAxiom : eqAxiom.asSubDataPropertyOfAxioms()) { @@ -1492,6 +1500,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 OWLObjectPropertyRangeAxiom) { + OWLObjectPropertyRangeAxiom rangeAxiom = (OWLObjectPropertyRangeAxiom) axiom; + OWLObjectPropertyExpression subject = rangeAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLObjectProperty().getIRI()); + } else { + iris.addAll(getIRIsFromEntities(subject.getSignature())); + } + } else if (axiom instanceof OWLDataPropertyDomainAxiom) { + OWLDataPropertyDomainAxiom domainAxiom = (OWLDataPropertyDomainAxiom) axiom; + OWLDataPropertyExpression subject = domainAxiom.getProperty(); + if (!subject.isAnonymous()) { + return Sets.newHashSet(subject.asOWLDataProperty().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()); }