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

Extend RelatedObjectsHelper.getAxiomSubjects() to missing property axiom types #1187

Merged
merged 8 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [`merge`] and 'annotate' operations '--annotate-defined-by' excludes reserved OWL 2 vocabularies [#1171]
- Handle IRIs that are not entities in export [#1168]
- Fix integration tests [#1181]
- Fix issue with correctly determining base entities [#1108]

## [1.9.5] - 2023-09-20

Expand Down
9 changes: 9 additions & 0 deletions docs/examples/template-base-filter.owl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Weight of a mouse or rat in kilograms (kg).</obo:IAO_0000115>
<obo:IAO_0000117 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rebecca C Jackson</obo:IAO_0000117>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">weight in kilograms</rdfs:label>
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.com/B6C3F1"/>
<rdf:Description rdf:about="http://example.com/F344N"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#decimal"/>
</owl:DatatypeProperty>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://example.com/propery-1"/>
Expand Down
9 changes: 9 additions & 0 deletions docs/examples/template-base.owl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Weight of a mouse or rat in kilograms (kg).</obo:IAO_0000115>
<obo:IAO_0000117 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rebecca C Jackson</obo:IAO_0000117>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">weight in kilograms</rdfs:label>
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.com/B6C3F1"/>
<rdf:Description rdf:about="http://example.com/F344N"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#decimal"/>
</owl:DatatypeProperty>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://example.com/propery-1"/>
Expand Down
11 changes: 10 additions & 1 deletion docs/examples/template-drop-axiom-filter.owl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Weight of a mouse or rat in kilograms (kg).</obo:IAO_0000115>
<obo:IAO_0000117 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rebecca C Jackson</obo:IAO_0000117>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">weight in kilograms</rdfs:label>
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.com/B6C3F1"/>
<rdf:Description rdf:about="http://example.com/F344N"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#decimal"/>
</owl:DatatypeProperty>


Expand Down Expand Up @@ -126,5 +135,5 @@



<!-- Generated by the OWL API (version 4.5.6) https://github.com/owlcs/owlapi -->
<!-- Generated by the OWL API (version 4.5.26) https://github.com/owlcs/owlapi -->

9 changes: 9 additions & 0 deletions docs/examples/template-drop-axiom-remove.owl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Weight of a mouse or rat in kilograms (kg).</obo:IAO_0000115>
<obo:IAO_0000117 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Rebecca C Jackson</obo:IAO_0000117>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">weight in kilograms</rdfs:label>
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.com/B6C3F1"/>
<rdf:Description rdf:about="http://example.com/F344N"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#decimal"/>
</owl:DatatypeProperty>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,14 @@ private static Set<IRI> 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()) {
Expand Down Expand Up @@ -1492,6 +1500,54 @@ private static Set<IRI> 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());
}
Expand Down
Loading