feat(ontology): add Cohort Discovery rule deletion, fix stale URIs and SWRL raw-editor sync - #176
Open
benoitcayladbx wants to merge 1 commit into
Open
benoitcayladbx wants to merge 1 commit into
benoitcayladbx wants to merge 1 commit into
Conversation
…d SWRL raw-editor sync query-cohorts.js now tracks the loaded ontology's base_uri and reconstructs any class/property URI from its local name against it, instead of trusting the uri/iri/id field on the object (which can be stale after the domain is re-based — see the companion reasoning/generation PRs for the same root cause elsewhere). Previously nothing reconstructed these URIs on this screen, so a re-based domain could make an apparently well-configured Cohort Discovery rule show 0 members/edges. Adds a "Delete rule" button to the Cohort Discovery designer (JS wiring in query-cohorts.js, markup in _ontology_cohorts.html). The backend delete endpoint already existed; there was simply no way to trigger it from the design screen. ontology-axioms.js now prefers an element's simple name over its stored URI when populating the class/property dropdowns of the Expressions & Axioms editor (previously the reverse). The backend (OntologyGenerator._resolve_uri) always rebuilds the correct URI from a simple name against the current Base URI, so this avoids axioms carrying forward a stale stored URI. ontology-swrl.js: the entity filter for the SWRL rule graph now also includes direct subclasses of entities that participate in a business relationship, even when the subclass itself has none — previously such a subclass could not be referenced or typed against in a rule. The raw-text editor's auto-sync from the visual graph selection is now suppressed while the editor is in raw mode, so typing an atom that has no corresponding graph node (e.g. a derived class in a THEN clause) is no longer silently overwritten. Also switches the D3.js CDN from d3js.org to jsdelivr (see the companion frontend PR for the full rationale).
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.
Reopened against
0.9.0afterdevelopwas deleted. GitHub cannot reopen #148 (closed PR + missing base), so this is a successor of #148 with the same commits. Original author: @jeremiaspf. Please rebase onto current0.9.0before review — expect conflicts.What
Three unrelated fixes in the Ontology Designer's Cohort Discovery, Expressions & Axioms, and SWRL screens, grouped together because they're small and touch neighboring code.
Cohort Discovery had no way to delete a rule from the UI. The backend delete endpoint already existed;
query-cohorts.jsgets_syncDeleteBtn/deleteActiveRuleand_ontology_cohorts.htmlgets the "Delete rule" button (next to "Save rule", disabled until a rule is loaded) to actually call it.Cohort Discovery also had the same stale-URI problem described in the reasoning/generation PRs, but more visibly: nothing on this screen reconstructed a class/property URI from its current Base URI, so a re-based domain could make an apparently correctly-configured rule show 0 members/0 edges with no obvious cause. Adds base-URI tracking and a
_currentUri()helper, used everywhere the screen previously readuri/iri/iddirectly (class selection, lookup-by-URI, available data properties, compatible relationship properties between two entities, each hop's dropdown).Expressions & Axioms editor now prefers an element's simple name over its stored URI when populating class/property dropdowns (previously the reverse). The backend (
OntologyGenerator._resolve_uri, see the companion generation PR) already rebuilds the correct URI from a simple name against the current Base URI — sending the name instead of a potentially-stale URI avoids axioms carrying a stale URI forward in the first place.SWRL rule editor: the entity filter for the rule graph now also includes direct subclasses of entities that participate in a business relationship, even when the subclass itself has none — previously such a subclass couldn't be referenced or typed against in a rule, despite being a reasonable thing to do. The raw-text editor's auto-sync from the visual graph selection is now suppressed while the editor is in raw mode, so typing an atom with no corresponding graph node (e.g. a derived class in a
THENclause) is no longer silently overwritten. Also switches the D3.js CDN to jsdelivr (same change as the companion frontend PR — this file needed other edits too, so it's included here rather than split further).Why
The delete-rule gap and the stale-URI issue both make Cohort Discovery awkward to actually use day to day. The axioms/SWRL fixes are UX papercuts that were easy to fix alongside the above while in the same area of the codebase.
How to test