You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GroupPath: a utility to work with virtual Group hierarchies (#3613)
Groups can be used to store nodes in AiiDA, but do not have any builtin
hierarchy themselves. However, often it may be useful to think of groups
as folders on a filesystem and the nodes within them as the files.
Building this functionality directly on the database would require
significant changes, but a virtual hierarchy based on the group labels
can be readily provided. This is what the new utility class `GroupPath`
facilitates. It allows group labels to be interpreted as the hierarchy
of groups. Example: consider one has groups with the following labels
group/sub/a
group/sub/b
group/other/c
One could see this as the group `group` containing the sub groups `sub`
and `other`, with `sub` containing `a` and `b` itself. The `GroupPath`
class allows one to exploit this hierarchical naming::
path = GroupPath('group')
path.sub.a.get_group() # will return group with label `group/sub/a`
It can also be used to create groups that do not yet exist:
path = GroupPath()
path.some.group.get_or_create_group()
This will create a `Group` with the label `some/group`. The `GroupPath`
class implements many other useful methods to make the traversing and
manipulating of groups a lot easier.
0 commit comments