Skip to content

Enhance composability of ComponentSelector: add set operations, etc. #452

@GabrielKS

Description

@GabrielKS

I'd like to implement the Julia set operations union, intersect, setdiff, etc. on ComponentSelectors. I want the interface to look roughly like this:

selector_i = intersect(selector1, selector2, selector3; groupby = SOMETHING)

but I need to think through the grouping behavior in more detail. Here are some invariants I think I want for a default grouping behavior:

  • union of two selectors where none of the group names are the same and none of the components are the same: new groups = union of old groups, new components = union of old components
  • Any set operation on two selectors that each only have one group, and the group name is the same: new groups = that one group, new components = that set operation on old components
  • get_components(set_operation(selectors...)) should be the same as set_operation(get_components(selectors)...)

and then I guess the task is to parsimoniously fill in the gaps. One option to avoid this complexity would be to force the user to specify a groupby, but I want the union of two non-overlapping ListComponentSelectors to "just work." Another option is to error on the tricky cases, but it would be nice if the user could do this and be guaranteed that it won't error no matter the system.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions