Using the HDBModel unique name and name parts
HDBModel automatically creates unique names for each content and storage created which represent the hierarchy position of the given document.
The unique name of a document consists of:
- the HDBModel document ID of the current document
- Which is the storage id, if the document is a storage
- Or the content id (!= content key, struct key), if the document is a content. This is a custom id of every content that is automatically generated by default (as a random 32-char string), but may also be determined by the contents data via custom code
- preceded with all the HDBModel document IDs of the documents up the hierarchy.
- All single IDs in the unique name are divided by point characters ".". Also all IDs are lowercased automatically and "dangerous" characters inside them (like "." and "/") are replaced with underscores "_".
This gives the root storages a very simple, navigable, ID. The name of the "projects" storage from the example data (on page HDBModel framework) would simply be:
When we assume that the content IDs of "project" documents equal their project title, then the unique name of the document "Project X" should be:
When we further assume the same for "document" contents then the document "Concept" should have the unique name:
How does this help you in navigating the hierarchy? At first you may use the unique names in WebTML context expressions using the "name:" expression. So you could navigate the WebTML context to the "projects" storage simply by:
On this context you could use a simple WebTML navigator to iterate through all project documents.
Another notable context expression for HDBModel navigation is the namepart expression "np:". It lets you navigate to a document whose unique name consists of the name of the current context document plus some additional namepart.
As the unique names of all HDBModel documents consist of the name of their parent document plus their own document ID you can use this expression together with HDBModel document IDs navigate down from parent to child documents in a controlled manner.
Assume the WebTML context is positioned on the "Project X" content document and you want to navigate to its "bills" storage, so you can iterate over the bills contained there. You can do this simply by:
This will navigate to the document with unique name: "projects.project x.bills". The expression already assumes the dot "." character as divider between parts, so this does not need to get specified
The HDBModel uses the unique name of content documents which in current OpenWGA versions is not recommended for authoring use and normally not editable in OpenWGA content manager. For your own usage you can still utilize the unique names of pages as HDBModel does not use these.