MidPoint Query Mechanisms

Last modified 15 Nov 2021 09:32 +01:00

MidPoint repository implements an abstraction of an object-oriented data store. The data may be stored in several types of relational databases (with even more possibility for future). Yet, the repository always presents the data in the same form, regardless of the actual storage mechanism.

However, data processing means much more than just a storage of data. One of the most important aspects is how to query the data, how to search for objects. This too has to be done in a way that is independent of the underlying storage mechanism.

As the query is such as important aspect, midPoint has its own Query API. The API supports query specification in multiple languages so it can be used both by midPoint user (Axiom, XML) or a programmer (Java API, which can also be used in configuration scripts, e.g. in Groovy).

Query can be used in various contexts:

  • for querying objects in the repository,

  • querying remote objects on the resources,

  • for collections of objects in-memory - this is more important for a programmer than for midPoint administrators.

Each of the contexts may have some natural limitations which are described in details in Query API. Queries are often used in Tasks to specify the set of objects to work on.

Query Languages

MidPoint has two query languages. Axiom query language is a new language, based on concepts of Axiom data modeling. This language is mostly user-friendly. Then there is an older XML-based query language. This goes back to the times when midPoint was completely XML-based. The languages are summarized in the following table:

Language Summary Available since Example

Axiom query language

User-friendly, text-based query language

MidPoint 4.3 (experimental)

name = "jack"

XML-based query language

Pure XML, deep element hierarchy

MidPoint 1.7

<q:equal>
  <q:path>name</q:path>
  <q:value>jack</q:value>
</q:equal>

Axiom query language is a relative new development, introduced in midPoint 4.3. It is expected to be fully supported in midPoint 4.4 LTS, where it should become a recommended option. The Axiom query language should replace the XML-based language as soon as possible. The XML-based language will be still supported for several years, but it will be dropped eventually.

Query API

MidPoint code deals with data queries all the time. There is a special API designed to represent the queries as data structures internally. The API can also be used to construct the queries programmatically in a fluent style (chained method calls). Programmatic query construction can be used not only in midPoint code, but also in Script expressions.

Please see an extensive Query API document for further details about the supported query constructs, available types of filters and examples how to write queries in various languages. The document also specifies what Query API features work in various contexts, that is repository, provisioning or in-memory.