OpenWGA 7.10 - OpenWGA Concepts and Features

Design and development » HDBModel framework » Relations in HDBModel

Special query types

There are two special query types for HDBModel which you may use to query for documents, which relations may point to, or for documents from which relations point to a given document.

Query type "hdbmodel:relationtargets:<relationname>" is the one which is active under the hood, when you specify a <tml:input type="select"> to choose a relation target and the possible targets get automatically retrieved. Using this WebTML query directly enables you to build your own form controls for choosing relation targets, for example by serving them via JSON requests.

See the following example of a WebTML page serving possible relation targets in JSON format, which already filters the returned contents by their title:

[
  <tml:collection>
    <tml:query type="hdbmodel:relationtargets:customer" options="contentclass:project, currenttarget:false">
      content.title like '<tml:urlparameter name="term"/>%'
    </tml:query>
    <tml:foreach divider=",">
      {
        "id": "<tml:meta name="structkey"/>",
        "label": "<tml:meta name="title" encode="javascript"/>",
        "value": "<tml:meta name="title" encode="javascript"/>"
      }
    </tml:foreach>
  </tml:collection>
]

Another special HDBModel query type is "hdbmodel:relationsources:<relationname>". It retrieves all "incoming relations" for the content document in WebTML context, which originate from special defined relation in the HBModel definition.

See the Query languages reference for these query types for explanations in deeper detail.