OpenWGA 6.3 - Query languages reference


The query type "hdbmodel" is a special query type that is available for OpenWGA content stores with enabled HDBModel support. It assists in creating specific queries for querying HDBModel relations. In the backend a "hdbmodel" query is actually a HQL query which is already predefined by OpenWGA, and can be extended by the user.

Different types of HDBModel queries are available. You choose them by extending the query type in <tml:query> attribute type by the HDBModel type and finally by the relation to query.


This query retrieves all possible relation targets for the given relation. The WebTML context under which the query is executed should either be a document of the class, for which the document is defined, or a parent document from which the creation of this document class is valid (which makes option "contentclass" mandatory, see below).

It is the same query which is used to automatically retrieve options for <tml:input>s that should store a HDBModel relation. Also it is the same query type that is executed via TMLScript method HDBModel.getRelationTargets().

You can execute the query without body to simply retrieve the documents. For example for a relation named "targetbuild":

<tml:query type="hdbmodel:relationtargets:targetbuild"/>

You can also extend the query by some HQL part in the body of the <tml:query> tag, for example if you wish to retrieve target contents with a certain title beginning:

<tml:param name="term"><tml:urlparameter name="term" encode="html"/>%</tml:param>

<tml:query type="hdbmodel:relationtargets:targetbuild">content.title like :term</tml:query>

As you see HDBModel queries may also retrieve query parameters just like HQL queries do. The default parameters of HQL queries are also available.

Relation target queries may be parametrized using the following native query options, to be used in <tml:query> attribute options:

Option Purpose
contentclass:contentclass If the document in WebTML context is not the content for which the relation is defined then you need to specify the content class of this content by this query option.
currenttarget:true|false By default this query type will always return the document which is currently targeted by the relation on the content document in context. If that is not desired you can switch it off by setting this query option to false.


This query retrieves all contents which target the current context document by a defined relation. The document in WebTML context must be the document which is targeted by these relations.

This query type can also be used via TMLScript with method HDBModel.getRelationSources().

It is mandatory for this query to specify the content class of the contents which own the relation as native query option. Otherwise you may leave the query body empty:

<tml:query type="hdbmodel:relationsources:targetbuild" options="contentclass:issue"/>

But here also you may add custom selection statements at your liking:

<tml:query type="hdbmodel:relationsources:targetbuild" options="contentclass:issue">content.items['closed'].boolean = 1</tml:query>