Repository navigation
A sub-property ring is reported from its own members, so p ⊑ q ⊑ r ⊑ q names the ring q, r instead of p, q, r - #1443
Open
rudycelekli wants to merge 1 commit into
Conversation
…q names the ring q, r instead of p, q, r Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
check_ontologyfinds subPropertyOf rings by walking up from each predicate in sorted order and stopping when it meets a predicate it has already seen. It reports whatever it walked as the ring, with the starting predicate as its subject. That is only right when the walk comes back to where it started.When a predicate leads into a ring without being on it, the walk still meets a repeat and reports it. With
p ⊑ q,q ⊑ randr ⊑ q, the ring is q and r. If p sorts first, the defect says subject p, path [p, q, r]. Then all three are marked reported, so the real ring is never reported from its own members.utopia_store::reasoning::check_ontologystores the defect keyed on that subject, so the Review page tells the reader to fix p, which is the one declaration that is not part of the ring.subclass_cyclesalready has the right rule: it only reports a ring when the walk returns to its start.What changes
When the walk meets a repeat that is not its start, it stops without reporting or marking anything. The ring is then reported by the first of its own members in sorted order, with only the ring in its path. A walk that returns to its start behaves exactly as before.
How it was checked
a_predicate_that_leads_into_a_ring_is_not_on_it, builds 1 ⊑ 2 ⊑ 3 ⊑ 2 and expects one ring, subject 2, path [2, 3].left: 01010101-… right: 02020202-…(the subject is the tail predicate 1).cargo test -p utopia-reason --lib: 109 passed.cargo fmt -p utopia-reason --checkandcargo clippy -p utopia-reason --all-targets -- -D warningspass.Before review
git commit -s)cargo fmt --all --check,cargo clippyandcargo testpass for the touched crate