Skip to main content

Relate Data With Hierarchies

Hierarchy Collections in Conscia

Conscia's DX Graph enables not only relationships between Collections, but relationships between records within a single Collection. By defining a Collection as Hierarchical, any given record can be assigned as a Parent Record to another, enabling complex stem-and-leaf relationships to be modelled within the Graph.

What's more, as each Record is modified, the relationship paths for the entire Collection are re-established in real time. This means that if a node is moved from one branch of the tree to another, all branches and leaves beneath it are similarly transported alongside it to their new niche in the hierarchy.

Finally, the API payload for each Record in a Hierarchical Collection includes the "ancestors" of that Record (itself, its parent, and upward to a root node with no parent) and the "descendants" of that Record (itself, its children, and their children recursively to the furthest leaves). This data enables complex visualization of the DX Graph Hierarchy data by external services or tools.

Creating a Hierarchy Collection

In this example, we will instantiate and populate a simple Hierarchy Collection.

  1. From the main navigation, navigate to Settings -> Data Model.
  2. Select the + to create a new Collection. Note the Data Record Identifying Property (drip) that you establish during creation.
  3. Once created, right-click that Collection and Edit Schema.
  4. Add the drip String field and set it as Unique.
  5. Add a descriptor field (name in this example) and a field to store the parent's data record identifying property (parent_drip in this example).

A screenshot of the Schema Editor showing the minimum required fields for a Hierarchy

  1. Right-click the Collection again and select "Set as Hierarchical". Populate the following values:
FieldValue
Parent Fieldparent_drip
Node Name Fieldname
Hierarchy Path Fieldenter a field name of your choosing
Parent Field Titleenter a readable name of your choosing
Search FieldsSelect as many fields as you wish.
Display Propertyname
  1. Submit to save this change. The Schema will have updated to include _hierarchyNodeName (Hierarchy Path), a special field populated procedurally by Conscia, as well as removing parent_drip from the visible Schema:

A screenshot of the Schema Editor showing the Hierarchy Schema

Establish Records in the Hierarchy

Once we have a Hierarchical Collection (and have instantiated it to the Left Navigation) we can populate this Collection with Records!

To establish a Hierarchical relationship between Records, the parent record must be created first. So, we'll start by creating a Grandparent record, then work down the tree shown here to create a representational hierarchy. The data record identifiers are arbitrary; they just have to be unique.

Hierarchy Collection Records
dripnameparent_drip
100grandparent/
10parentgrandparent (or 100)
1childparent (or 10)
2siblingparent (or 10)
-10grandchildchild (or 1)

As you work, you will see the Hierarchy Path updating in real time. We've added the diagram for ease of interpretation. Once completed, it may look something like this: A depiction of the Hierarchy Collection Records

It's straightforward to adjust or manipulate records from this point. For instance, if the grandchild data was entered incorrectly and its parent is actually sibling, simply edit the record, remove the existing parent_drip, and populate a new one. The Hierarchy Path of the Grandchild will change, as will the _ancestor and _descendant arrays of Records throughout the Collection. We can even "disown" sibling, making it a root node, and see all-new Hierarchy Paths calculate in real-time!

A depiction of the adjusted Hierarchy Collection Records