Skip to content

Include SubObjectPropertyOf axioms when reducing. #1248

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

Merged

Conversation

gouttegd
Copy link
Contributor

@gouttegd gouttegd commented Mar 6, 2025

Resolves [#1014, #1208]

  • docs/ have been added/updated
  • tests have been added/updated
  • mvn verify says all tests pass
  • mvn site says all JavaDocs correct
  • CHANGELOG.md has been updated

This PR amends the Reduce code to include SubObjectPropertyOf and SubPropertyChainOf axioms in the graph used to evaluate redundant axioms.

By including SubObjectPropertyOf axioms, if we have something like

SubClassOf(C, P some D)
SubClassOf(C, Q some D)
SubObjectPropertyOf(Q, P)

then the first SubClassOf axiom can be considered redundant and removed (#1208).

By including SubPropertyChainOf axioms, if we have

SubClassOf(C, P some D)
SubClassOf(C, P some E)
SubClassOf(D, Q some E)
SubObjectPropertyOf(ObjectPropertyChain(P Q) P)

then the second SubClassOf axiom (SubClassOf(C, P some E)) can be considered redundant and removed (#1014).

When evaluating redundant SubClassOf axioms for the Reduce operation,
include SubObjectPropertyOf axioms in the graph, so that if we have

  SubClassOf(C, P1 some D)
  SubClassOf(C, P2 some D)
  SubObjectPropertyOf(P2, P1)

then the first SubClassOf axiom can be considered redundant and removed.

Also explicitly include SubPropertyChainOf axioms, so that similarly
redundant axioms when a property chain is involved can be removed as
well.
@gouttegd
Copy link
Contributor Author

gouttegd commented Mar 6, 2025

@cmungall Asking for your review since you wrote the original code for the Reduce operation (and you also wrote commit cdbb804, which restricted the types of axioms considered for evaluating redundancy).

@jamesaoverton Should the behaviour be configurable by a new command line option to reduce (something like --include-subproperty-axioms true or similar)?

Copy link
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is very consequential - and I am actually a bit surprised that this was not already happening.

I would, however, suggest to add a test for this change, as it has the potential for huge consequences on a lot of OBO (esp. ODK-managed) ontologies..

@gouttegd
Copy link
Contributor Author

gouttegd commented Mar 7, 2025

@matentzn I plan to add tests once I have confirmation the feature (which is more of a bug fix in my opinion, as I think reduce should always do that -- which is also why I didn't include an CLI switch) is wanted. :)

@matentzn
Copy link
Contributor

matentzn commented Mar 7, 2025

I personally agree that this is a bugfix, but best get @balhoff and @cmungall opinion on this as well.

@gouttegd
Copy link
Contributor Author

gouttegd commented Mar 7, 2025

I personally agree that this is a bugfix

For what it’s worth, the people who reported the #1208 issue (reduce ignoring SubPropertyOf axioms) and the #1014 issue (reduce ignore property chains) both thought it was a bug. :)

@cmungall
Copy link
Contributor

cmungall commented Mar 8, 2025

Why not just add a reduce configuration, and preserve the current default behavior?

Redundancy is not straightforward, see:

Apologies for any confusion caused. When I originally proposed this:

I suggested separate commands from removing redundancy (sensu OWL entailment) and graph transitive reduction, we probably should have stuck to that (with graph operations happening in a framework independent of the owlapi / owl reasoning), as these are really different concerns and use cases. But I think I may have overloaded them.

@gouttegd
Copy link
Contributor Author

gouttegd commented Mar 8, 2025

@cmungall I don’t mind making the behaviour configurable by a command-line option, but I defer to @jamesaoverton for the decision.

Personally, I think that, if the behaviour is to be made configurable, it should still be enabled by default, with an option to disable it. For two reasons:

(1) There is nothing in the description of reduce to suggest that it is normal for subproperties (and property chains) to be ignored when evaluating redundancy. As I mentioned, both the authors of the #1014 and #1208 tickets considered that to be a bug (and FWIW I agree with them).

(2) This would be consistent with the existing options --named-classes-only and --preserve-annotated-axioms: by default, reduce removes everything it can, unless its behaviour is restricted by an option.

Copy link
Contributor

@balhoff balhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it sounds good to have this feature, but it should be added as a non-default CLI option. We have been relying on the previous behavior, at least in GO, to materialize more standard relations from highly specific ones (e.g. 'part of' from 'bounding layer of') using a combination of materialize and reduce. My understanding is that this would stop working after this change.

Do not unconditionally take into account SubObjectPropertyOf axioms when
evaluating redundancy in the context of a Reduce operation. Only do so
when this is expressly asked for with a new command-line option, to
avoid breaking existing pipelines.

(For the record, I believe this should be enabled by default, and that
"existing pipelines" could use an option to disable it instead.)
Document the new --include-subproperties option to `reduce`. Show an
example command, which also (as usual throughout the ROBOT
documentation) acts as a test case.
@gouttegd
Copy link
Contributor Author

@balhoff Option tentatively added. :) I defer to @jamesaoverton for the decision as to whether it should be enabled or disabled by default (for now it’s disabled, it’s one line to change in ReduceOperation#getDefaultOptions() if we want to make it enabled by default).

@jamesaoverton
Copy link
Member

I agree with @balhoff: we should stick to the old behaviour by default, to maintain backwards compatibility, even if we agree that the old behaviour was buggy. (Sorry, but backwards compatibility is very important to the ROBOT project.)

Thanks very much!

@gouttegd
Copy link
Contributor Author

@jamesaoverton Fine with me. :) But for the record, I then plan to enable the option by default in ODK workflows (users would still have the possibility to disable it in their ODK configuration).

@cmungall
Copy link
Contributor

cmungall commented Mar 10, 2025 via email

@jamesaoverton jamesaoverton dismissed balhoff’s stale review May 9, 2025 14:52

This request has been implemented: the old behaviour remains the default.

@jamesaoverton jamesaoverton merged commit 739433d into ontodev:master May 9, 2025
3 checks passed
@gouttegd gouttegd deleted the make-reduce-work-over-subproperties branch May 9, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reduce not removing axioms where one relationship is a subproperty of another between the same two classes
5 participants