OpenWGA 7.9 - OpenWGA Concepts and Features

Design and development » HDBModel framework » Navigating and querying the HDBModel hierarchy

Parent relations

When a HDBModel content is stored "below" some parent content then HDBModel will automatically create content relations  on it pointing to those parents (see Content documents for an explanation of content relations).

For each "parent content" (there may be multiple as the hierarchy goes deeper) a separate parent relation is created pointing to the given parent content. The name of a parent relation is:

"parent-<contentclass>"

Where <contentclass> stands for the content class of the parent content.

You can use these relations to query for documents that lie below the given parent content. For example: Querying for all "task" contents on "project X" would only need the following query, run under the WebTML context of this project document:

<tml:query type="hql">

  content.contentclass='task' AND content.relations['parent-project'].target = :content

</tml:query>

Explained:

  • The first term selects only task documents, obviously
  • The second term selects "content.relations['parent-project'].target", so a relation to a parent content of class "project"
  • The second term filters that this relation goes to :content, which is a default query parameter always filled with the current WebTML context document, which as we said should be "Project X"

You can also use these relations in WebTML context expressions to directly change from child to parent content with the "relation:" expression. So going from a task to its project is as easy as:


<tml:range context="relation:parent-project">