Skip to content
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

Support subclasses #568

Merged
merged 24 commits into from
Oct 7, 2020
Merged

Support subclasses #568

merged 24 commits into from
Oct 7, 2020

Conversation

heralden
Copy link
Member

@heralden heralden commented Oct 6, 2020

Bluegenes hasn't been very accomodating of the existence of subclasses in the model (particularly when specified as type constraints) which this PR aims to resolve.

The class hierarchy is specified using the extends key for each class in the model. Indirect relationships are not included under this key, so a complete hierarchy would need to be parsed to properly determine subclasses (i.e. descendants of a class). This is a nested linear operation of all the classes in a model, but doesn't need to be recomputed except when changing mines. Therefore it makes sense to compute this hierarchy once when fetching the model, and caching it in app-db.

Type constraints were previously present in the Query Builder, but only featured immediate subclasses and not indirect subclasses (the JSP webapp provides both). It also wasn't properly implemented which led to numerous bugs when building a query with type constraints, which have now been fixed.

Note that for subclasses to work correctly, a previous change removing empty classes from the model has been reversed, as otherwise a subclass lookup with imcljs.path/walk (depended on by many parts of the UI) would traverse nonexistent classes.

In addition, there have been other improvements to the Query Builder:

  • the display names of classes in the Query Editor have been fixed,
  • query errors are now displayed in the Preview,
  • the Model Browser toolbar has been revised based on usertesting observations.

Another aspect of supporting subclasses is having the Tool API display tools for subclasses of a class the tool supports. Details on this are documented in the bluegenes.utils/suitable-entities docstring. Tools that wish to support subclasses will have to make sure their query sets from to imEntity.X.class (where X is a class the tool supports, e.g. Gene).

This PR depends on changes to imcljs: intermine/imcljs#51

Finally, im-tables-3 will also need subclass support: intermine/im-tables-3#102

Fixes #459 fixes #508 fixes #522 fixes #539 fixes #550

Fixes intermine#508. There were three main problems:
- subclass was added to any child class of the class (e.g. ThreePrimeUTR
type constraint was added to Gene.UTRs.organism in addition to Gene.UTRs)
- only direct subclasses were selectable, not indirect (descendants)
- it was possible to create a subclass constraint to the original class
(e.g. type constraint for Gene.UTRs to be UTR, which it already is)
- When expanding query tree to a constrainted subclass, dropdown will
  show correct value
- Changing subclass will change it in query editor (when present) and
  fetch preview
- Fix various incorrect docstrings
- Fix bug creating multiple identical subclass constraints causing
  invalid query error
- Remove stale subclasses (resulting in empty class in query editor)
  when removing last view of a class
- Do not allow setting subclass constraint to the class itself (i.e. not
  a subclass)
Since you're able to set subclasses and drill down, without adding it to
:im-query.  Not sure if there's even done a full-path lookup in the
tree, but it's still good practice to make sure the model supports it.
This led to a crash in the query builder caused by setting a subclass
which was empty. The model should be kept complete, and trimming should
be done in the UI.
Now we make sure to add all parent subclasses for an attribute.
- Clear subclass descendants from :enhance-query
- Clear subclass descendant views from :order
- Add parent subclasses when summarizing view
- Couldn't summarize unique class descendant of non-added subclass
  (Flymine e.g. Gene -> Child Features [Binding Site] -> Factor)
- With im-path/walk fixes, subclass constraints changed contents of
  subclass dropdown (selecting dropdown item changed the dropdown)
- With im-path/walk fixes, constrained subclass was displayed in
  parentheses instead of superclass
- Class unique to parent subclass displayed a blank name in Query Editor
  (Flymine e.g. Gene -> Child Features [Binding Site] -> Factor)
Fixes intermine#550. I decided to keep the Summarise button, but add icons,
tooltips and better names.
For this to work properly, tools that wish to support subclasses will
have to make sure their query sets `from` to `imEntity.X.class`.
@heralden heralden added this to the 0.10.0 milestone Oct 6, 2020
@heralden heralden added this to In progress / Testing in Production Roadmap via automation Oct 6, 2020
@heralden heralden merged commit ce37972 into intermine:dev Oct 7, 2020
Production Roadmap automation moved this from In progress / Testing to Done Oct 7, 2020
@heralden heralden deleted the feature/subclasses branch November 26, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment