Skip to Content
v0.13.2: New interface + queries as text Download
DocumentationQuery Guide

Query Guide

In this guide, we build a first query on the Order Management dataset, which returns every order together with the event in which it was paid.

Loading an OCEL

Before using OCPQ, you first need to load an object-centric event log. OCPQ supports all OCEL 2.0 formats (XML, JSON, and SQLite), as well as CSV and ZIP bundles. Case-centric event logs in the XES format are also supported, where each case becomes an object of type Case. To get started, you can download publicly available OCEL 2.0 files from here.

For importing a file, click on the drop zone of the start page 1 or drag the file onto it.

Start page with the OCEL import

Opening the Query Editor

After the import, OCPQ shows the OCEL Info page, which lists the event and object types of the log and how they are related. From there, you can open the query editor using Queries in the sidebar 1.

OCEL Info page after the import

Creating a Query

As long as there are no queries yet, the editor offers to create one 1. Afterwards, further queries can be added using the New query button on the top right.

Empty query list

A new query starts with one empty box. In the header, you can rename the query 1 and add a description 2. The toolbar of the editor allows adding more boxes 3 and evaluating the query 4.

Shortcuts: Alt+N adds a box, and Ctrl+Enter evaluates the query.

Query editor with a new query

Adding Variables and Filters

Each box has a + button for each of its sections:

  1. Object variables 1
  2. Event variables 2
  3. Filters 3
  4. Labels 4, covered in the CEL Labels Guide
  5. Constraints 5, covered in the Constraint Guide
The sections of a box

Object Variables

To add an object variable, click on the + next to Object Variables. In the dialog, you can then set two options:

  1. The variable name 1, by which filters and constraints refer to the variable. We keep the suggested name o1.
  2. The object types the variable can take 2, together with the number of objects of each type in the log. For our example, we select orders. If several types are selected, the variable can be bound to an object of any of them.

Finally, Add 3 adds the variable to the box.

Adding an object variableThe box with the object variable

Event Variables

Event variables are added in the same way, using the + next to Event Variables. Here, we keep the name e1 1 and select the type pay order 2.

By default, the list only shows event types that are related to the variables already in the box (here, 4 of the 11 event types).

Below the types, OCPQ suggests how the new variable can be connected to the existing ones 3. In particular, it offers an event-to-object (E2O) relation between e1 and o1, which can be restricted to one relationship qualifier or kept as Any qualifier. Add and connect 4 then adds the variable together with the selected connections.

Adding an event variable

The box now contains both variables as well as an E2O filter between e1 and o1. As such, only pay order events involving the bound order are considered.

The box with both variables and the E2O filter

Additionally, the header of the query describes it in a sentence, which is updated as you edit the query:

Generated description of the query

Filters

Further filters can be added using the + next to Filters. The dialog lists all filter types 1 (e.g., relations between variables, attribute values, the time between events, or CEL expressions). Types that cannot be used in the box yet are greyed out. For example, Time Between Events requires two event variables. Using the Use as switch 2, the predicate can also be added as a constraint instead of a filter.

Choosing a filter type

Evaluating the Query

To evaluate the query, click on the play button 1 (or press Ctrl+Enter). Each box then shows its number of bindings 2, here one for each of the 2,000 paid orders. Clicking on that number opens the bindings as a table in the Inspector on the right 3, where clicking on an ID shows the details of that event or object. The header shows the share of bindings that violate the constraints of the query 4. As this query has no constraints, nothing is violated.

Evaluated query with its bindings

Last updated on