Skip to content

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
deeplethe:devfrom
rudycelekli:reason-sub-property-ring-tail
Open

rudycelekli wants to merge 1 commit into
deeplethe:devfrom
rudycelekli:reason-sub-property-ring-tail

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Why

check_ontology finds 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 ⊑ r and r ⊑ 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_ontology stores 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_cycles already 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 new test, 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].
  • With the fix reverted the test fails: left: 01010101-… right: 02020202-… (the subject is the tail predicate 1).
  • cargo test -p utopia-reason --lib: 109 passed.
  • cargo fmt -p utopia-reason --check and cargo clippy -p utopia-reason --all-targets -- -D warnings pass.

Before review

  • Every commit is signed off (git commit -s)
  • cargo fmt --all --check, cargo clippy and cargo test pass for the touched crate

…q names the ring q, r instead of p, q, r

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
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.

1 participant