Structural Metadata: Tree Navigation
Introduction
Using the structural metadata for tree navigation one can fetch the (direct) children of a record or get the grandparents of a record.
Reference Codes & Has (Non Representation) Children
The metadata field
Structural.ReferenceCodes
is an ordered multi-item field (see Complex Fields) containing the record IDs from the parents, starting from the oldest / first.
{
"Structural": {
"ReferenceCodes": {
"Series": ["3e3b17c058b14ed79095c7fc9c4af88848bd7afbc5294c19a214625a5a5d3d7d"],
"Dossier": ["6b83485cfe1f48729ab493f912b2c7cc6336afdc597843e7bcaf664abd209043"],
"Document":["120b5fe7f7a346bca277e13988ed96224f40330432584955b6e33b524321dff5"]
}
}
}
Once a record obtains its first child the field
Structural.HasChildren
will be true for the parent. Even if the child is later permanently deleted, the fieldStructural.HasChildren
will betrue
forever on the parent.Data objects, e.g., the record type Media, always have `
Structural.HasChildren
set to true because it has direct (grand)children representations. In order to know whether the data object has other data objects that are children, e.g. emails with attachments, a new fieldHasNonRepresentationChildren
has been introduced in version23.4
.
Navigation
From child to parent
The metadata field
ParentRecordId
provides theRecordId
of its parent → Metadata FieldsFor representations, the metadata field
DataRecordId
provides theRecordId
of the data record to which it belongs
From child to grandparents
The field
ReferenceCodes
contains the full line of ancestors. The sub-fields are in the exact order of the grandparents from top to bottom with as key theRecordType
of the (grand)parent as value theRecordId
of the (grand)parentFor representations, the metadata field
DataRecordId
provides theRecordId
of the data record to which it belongs
From parent to direct children
Make a search request on the field
ParentRecordId
Form
+Structural.ParentRecordId:<my RecordId>
Example
+Structural.ParentRecordId:3e3b17...
From parent to all (grand)children
Make a search request using the matching sub-field of
ReferenceCodes
Form
+Structural.ReferenceCodes.<my RecordType>:<my RecordId>
Example all (grand)children of particular Series:
+Structural.ReferenceCodes.Series:3e3b17...