Skip to content

Commit

Permalink
Merge pull request #1226 from ontodev/improve-1203
Browse files Browse the repository at this point in the history
Improve disambiguation of properties in QuotedEntityChecker
  • Loading branch information
jamesaoverton authored Nov 14, 2024
2 parents 662ff99 + bc86200 commit 0e688c1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

## Fixed
- Improve disambiguation of properties in QuotedEntityChecker [#1226]
- Skip "non-robot" columns in templates for the purposes of axiom annotations [#1216]
- Add missing filter for deprecated in lowercase_definition check [#1220]
- Bug was fixed that caused logical axioms with axiom annotations not to be processed correctly when merging axiom annotations [#1223]
Expand Down Expand Up @@ -417,6 +418,7 @@ First official release of ROBOT!
[`validate`]: http://robot.obolibrary.org/validate
[`verify`]: http://robot.obolibrary.org/verify

[#1226]: https://github.com/ontodev/robot/pull/1226
[#1223]: https://github.com/ontodev/robot/pull/1223
[#1221]: https://github.com/ontodev/robot/pull/1221
[#1220]: https://github.com/ontodev/robot/issues/1220
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,22 @@ public OWLDataProperty getOWLDataProperty(@Nonnull String name) {
if (iri != null) {
return dataFactory.getOWLDataProperty(iri);
}
// prevent punning
if (!objectProperties.containsKey(name)) {
if (ioHelper != null) {
iri = ioHelper.createIRI(name);
if (iri != null) {
OWLDataProperty owlDataProperty = dataFactory.getOWLDataProperty(iri);
dataProperties.put(name, iri);
return owlDataProperty;
}
if (ioHelper != null) {
// When the Manchester parser sees "R some X"
// it can't tell whether R is a DataProperty or an ObjectProperty,
// so it tries getOWLDataProperty() first,
// then getOWLObjectProperty().
// We have to check that this name is not an ObjectProperty
// before we create a new DataProperty.
// We check both the name and the IRI.
iri = ioHelper.createIRI(name);
if (objectProperties.containsKey(name) || objectProperties.containsValue(iri)) {
return null;
}
if (iri != null) {
OWLDataProperty owlDataProperty = dataFactory.getOWLDataProperty(iri);
dataProperties.put(name, iri);
return owlDataProperty;
}
}
return null;
Expand Down Expand Up @@ -473,15 +480,21 @@ public OWLObjectProperty getOWLObjectProperty(@Nonnull String name) {
if (iri != null) {
return dataFactory.getOWLObjectProperty(iri);
}
// prevent punning
if (!dataProperties.containsKey(name)) {
if (ioHelper != null) {
iri = ioHelper.createIRI(name);
if (iri != null) {
OWLObjectProperty owlObjectProperty = dataFactory.getOWLObjectProperty(iri);
objectProperties.put(name, iri);
return owlObjectProperty;
}
if (ioHelper != null) {
// When the Manchester parser sees "R some X"
// it can't tell whether R is a DataProperty or an ObjectProperty,
// so it tries getOWLDataProperty() first,
// then getOWLObjectProperty().
// To be safe, we first check that this name is not a DataProperty.
// We check both the name and the IRI.
iri = ioHelper.createIRI(name);
if (dataProperties.containsKey(name) || dataProperties.containsValue(iri)) {
return null;
}
if (iri != null) {
OWLObjectProperty owlObjectProperty = dataFactory.getOWLObjectProperty(iri);
objectProperties.put(name, iri);
return owlObjectProperty;
}
}
return null;
Expand Down

0 comments on commit 0e688c1

Please sign in to comment.