Data Extraction Guide
In practice, process data is often not available as an OCEL file, but stored in tables of a database or in CSV, Excel, or Parquet files. Data extraction blueprints describe how the rows of such tables are turned into events, objects, and their relations. OCPQ executes the blueprint and loads the resulting OCEL, which can then be queried as usual.
In this guide, we use the publicly available Northwind sample database as a SQLite file.
To follow along, you can download northwind.db (25 MB).
The database contains the orders of a fictional trading company, together with their customers, employees, products, and shippers.
As a first example, we turn each row of the Orders table into a place order event, related to the customer who placed the order and the employee who handled it.
Creating a Blueprint
First, open Extraction in the sidebar 1 and create a new blueprint 2.
Data extraction does not require a loaded OCEL.

Connecting a Source
In the new blueprint, click on Connect a source and then on Open a file....
There, select the source type 1 (here, SQLite) and enter the path to the database file 2.
In the desktop app, Browse... opens a file picker instead.
Besides SQLite databases, blueprints can also read CSV, Excel, and Parquet files, or connect to a PostgreSQL server.
OCPQ saves each blueprint together with its connected sources, so they are still there the next time you open it.

Mapping a Table
Add table lists the tables of all connected sources, from which we select Orders 1.

The dialog then asks what the rows of the table should be turned into 1, i.e., events, objects, E2O or O2O relations, or the result of a transformation (filter, join, or union).
We keep Event, such that each row of Orders produces one event.
For events, you can set their type 2 and their timestamp 3. Each value can come from
- a column,
- a template combining several columns (e.g.,
{OrderID}-{ProductID}), - a constant, or
- the first non-empty value of several options (coalesce).
For our example, we use the constant type
place orderand the columnOrderDateas the timestamp.

Further down, Link an object relates the event to objects referenced in the same row 1.
Each related object requires an ID 2 (here, the column CustomerID) and an object type 3 (here, customer).
Similarly, a second link relates each event to the employee in the EmployeeID column, as an object of type employee.

Add Event then places the mapping next to its table on the canvas.
The blueprint is validated while you edit it, and its status is shown next to Extract OCEL 1.

Extracting the OCEL
Extract OCEL executes the blueprint.
Afterwards, a report lists for each mapping how many rows were read and how many events, objects, and relations were produced.

The extracted OCEL replaces the currently loaded one and can be used in all other views of OCPQ.
For example, the OCEL Info page shows its event and object types, and it can be exported as an OCEL 2.0 file in the JSON, XML, or SQLite format.

Complete Example
Next, we present a complete blueprint, which extracts a larger OCEL from the same Northwind database, with six object types, four event types, as well as relations between objects.
The SQLite file used here is an extended version of the classic Northwind database, with 16,282 orders between 2012 and 2023 (instead of the original 830).
Objects
Five tables become objects, each with a few of their columns as attributes.
For orders and employees, the attribute values are timestamped with the OrderDate and HireDate, respectively.
| Table | Object type | ID | Attributes |
|---|---|---|---|
Orders | order | OrderID | freight, ship country |
Order Details | order line | OrderID and ProductID | quantity, unit price, discount |
Customers | customer | CustomerID | company, country |
Products | product | ProductID | name, list price |
Employees | employee | EmployeeID | name, title |
Shippers | shipper | ShipperID | company |
Events
Four columns of the database contain timestamps of activities, each of which becomes an event type. The related objects of each event are listed with their qualifier in parentheses.
| Event type | Table | Timestamp | Related objects |
|---|---|---|---|
place order | Orders | OrderDate | order (order), customer (customer), employee (sales rep) |
order due | Orders | RequiredDate | order (order) |
ship order | Orders, filtered | ShippedDate | order (order), shipper in ShipVia (carrier) |
hire employee | Employees | HireDate | employee (employee) |
Two of these need a short explanation:
order duemarks the date requested by the customer. Of course, this is a deadline and not an actual activity, but it allows checking which orders were shipped late (3,755 of them).ship orderreads from a filter transformation, which keeps only orders with aShippedDate(all but 21 orders).
Object-to-Object Relations
| Table | Source | Target | Qualifier |
|---|---|---|---|
Order Details | order | order line | contains |
Order Details | order line | product | product |
Employees | employee | employee in ReportsTo | reports to |
For the one employee without a manager, the reports to relation has no target, and the row is skipped (reported as No usable id).
Northwind blueprint. You can copy it using the button on the right or download it as a file. The blueprint reads the Northwind SQLite file, which can be downloaded here (25 MB).
Show the JSON
{
"version": 1,
"id_rendering": "type-prefixed",
"on_missing_endpoint": "create",
"on_duplicate_object": "first-wins",
"nodes": [
{
"id": "orders",
"label": "Orders",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Orders"
}
},
{
"id": "order_details",
"label": "Order Details",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Order Details"
}
},
{
"id": "customers",
"label": "Customers",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Customers"
}
},
{
"id": "employees",
"label": "Employees",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Employees"
}
},
{
"id": "products",
"label": "Products",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Products"
}
},
{
"id": "shippers",
"label": "Shippers",
"op": {
"type": "source",
"source_id": "northwind",
"table": "Shippers"
}
},
{
"id": "shipped_orders",
"label": "Shipped orders",
"op": {
"type": "filter",
"input": "orders",
"condition": {
"type": "not",
"condition": {
"type": "is-null",
"column": "ShippedDate"
}
}
}
}
],
"mappings": [
{
"type": "single",
"label": "Customers",
"node": "customers",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "customer"
},
"id": {
"type": "column",
"column": "CustomerID"
},
"attributes": [
{
"name": "company",
"source_column": "CompanyName"
},
{
"name": "country",
"source_column": "Country"
}
]
}
},
{
"type": "single",
"label": "Employees",
"node": "employees",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "employee"
},
"id": {
"type": "column",
"column": "EmployeeID"
},
"attributes": [
{
"name": "name",
"source_column": "LastName"
},
{
"name": "title",
"source_column": "Title"
}
],
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "HireDate"
}
}
}
},
{
"type": "single",
"label": "Products",
"node": "products",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "product"
},
"id": {
"type": "column",
"column": "ProductID"
},
"attributes": [
{
"name": "name",
"source_column": "ProductName"
},
{
"name": "list price",
"source_column": "UnitPrice",
"value_type": "Float"
}
]
}
},
{
"type": "single",
"label": "Shippers",
"node": "shippers",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "shipper"
},
"id": {
"type": "column",
"column": "ShipperID"
},
"attributes": [
{
"name": "company",
"source_column": "CompanyName"
}
]
}
},
{
"type": "single",
"label": "Orders",
"node": "orders",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "order"
},
"id": {
"type": "column",
"column": "OrderID"
},
"attributes": [
{
"name": "freight",
"source_column": "Freight",
"value_type": "Float"
},
{
"name": "ship country",
"source_column": "ShipCountry"
}
],
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "OrderDate"
}
}
}
},
{
"type": "single",
"label": "Reports to",
"node": "employees",
"target": {
"type": "o2o",
"source": {
"id": {
"type": "column",
"column": "EmployeeID"
},
"object_type": {
"type": "constant",
"value": "employee"
}
},
"target": {
"id": {
"type": "column",
"column": "ReportsTo"
},
"object_type": {
"type": "constant",
"value": "employee"
}
},
"qualifier": {
"type": "constant",
"value": "reports to"
}
}
},
{
"type": "single",
"label": "Order lines",
"node": "order_details",
"target": {
"type": "object",
"object_type": {
"type": "constant",
"value": "order line"
},
"id": {
"type": "template",
"template": "{OrderID}-{ProductID}"
},
"attributes": [
{
"name": "quantity",
"source_column": "Quantity",
"value_type": "Integer"
},
{
"name": "unit price",
"source_column": "UnitPrice",
"value_type": "Float"
},
{
"name": "discount",
"source_column": "Discount",
"value_type": "Float"
}
]
}
},
{
"type": "single",
"label": "Order has line",
"node": "order_details",
"target": {
"type": "o2o",
"source": {
"id": {
"type": "column",
"column": "OrderID"
},
"object_type": {
"type": "constant",
"value": "order"
}
},
"target": {
"id": {
"type": "template",
"template": "{OrderID}-{ProductID}"
},
"object_type": {
"type": "constant",
"value": "order line"
}
},
"qualifier": {
"type": "constant",
"value": "contains"
}
}
},
{
"type": "single",
"label": "Line of product",
"node": "order_details",
"target": {
"type": "o2o",
"source": {
"id": {
"type": "template",
"template": "{OrderID}-{ProductID}"
},
"object_type": {
"type": "constant",
"value": "order line"
}
},
"target": {
"id": {
"type": "column",
"column": "ProductID"
},
"object_type": {
"type": "constant",
"value": "product"
}
},
"qualifier": {
"type": "constant",
"value": "product"
}
}
},
{
"type": "single",
"label": "Place order",
"node": "orders",
"target": {
"type": "event",
"event_type": {
"type": "constant",
"value": "place order"
},
"id": {
"type": "template",
"template": "{OrderID}"
},
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "OrderDate"
}
},
"objects": [
{
"object": {
"id": {
"type": "column",
"column": "OrderID"
},
"object_type": {
"type": "constant",
"value": "order"
}
},
"qualifier": {
"type": "constant",
"value": "order"
}
},
{
"object": {
"id": {
"type": "column",
"column": "CustomerID"
},
"object_type": {
"type": "constant",
"value": "customer"
}
},
"qualifier": {
"type": "constant",
"value": "customer"
}
},
{
"object": {
"id": {
"type": "column",
"column": "EmployeeID"
},
"object_type": {
"type": "constant",
"value": "employee"
}
},
"qualifier": {
"type": "constant",
"value": "sales rep"
}
}
]
}
},
{
"type": "single",
"label": "Order due",
"node": "orders",
"target": {
"type": "event",
"event_type": {
"type": "constant",
"value": "order due"
},
"id": {
"type": "template",
"template": "{OrderID}"
},
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "RequiredDate"
}
},
"objects": [
{
"object": {
"id": {
"type": "column",
"column": "OrderID"
},
"object_type": {
"type": "constant",
"value": "order"
}
},
"qualifier": {
"type": "constant",
"value": "order"
}
}
]
}
},
{
"type": "single",
"label": "Hire employee",
"node": "employees",
"target": {
"type": "event",
"event_type": {
"type": "constant",
"value": "hire employee"
},
"id": {
"type": "template",
"template": "{EmployeeID}"
},
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "HireDate"
}
},
"objects": [
{
"object": {
"id": {
"type": "column",
"column": "EmployeeID"
},
"object_type": {
"type": "constant",
"value": "employee"
}
},
"qualifier": {
"type": "constant",
"value": "employee"
}
}
]
}
},
{
"type": "single",
"label": "Ship order",
"node": "shipped_orders",
"target": {
"type": "event",
"event_type": {
"type": "constant",
"value": "ship order"
},
"id": {
"type": "template",
"template": "{OrderID}"
},
"timestamp": {
"type": "value",
"source": {
"type": "column",
"column": "ShippedDate"
}
},
"objects": [
{
"object": {
"id": {
"type": "column",
"column": "OrderID"
},
"object_type": {
"type": "constant",
"value": "order"
}
},
"qualifier": {
"type": "constant",
"value": "order"
}
},
{
"object": {
"id": {
"type": "column",
"column": "ShipVia"
},
"object_type": {
"type": "constant",
"value": "shipper"
}
},
"qualifier": {
"type": "constant",
"value": "carrier"
}
}
]
}
}
]
}
Loading the Blueprint
For loading the blueprint, create a new blueprint and click on File.
In the Load tab 1, paste the JSON 2 and click on Load 3.
Alternatively, Choose a file... loads the downloaded file.

The Save tab of the same dialog allows copying or downloading your own blueprints.
As connection strings might contain passwords, they are only included if you explicitly enable it.
Connecting the Source
Blueprint files name their sources (here, northwind), but by default do not include where they are located (see the Save tab above).
Thus, after loading the blueprint, open Connections and click on Connect 1 next to northwind.

In the form that opens, select SQLite 1 and enter the path to your copy of northwind.db 2.
The source id 3 is already set to northwind, matching the name used in the blueprint.

As soon as the file can be read, OCPQ lists its tables, and you can browse their columns and rows.
Done closes the dialog.

Once the source is connected, the canvas shows each table on the left and the mappings reading from it on the right.

Extracting the OCEL
Extract OCEL executes all thirteen mappings.
Notably, the Order Details table alone yields 609,283 order lines, each related to its order and its product.

The resulting OCEL contains 48,834 events and 625,747 objects.
On the OCEL Info page, the type relations show all four event types and six object types, as well as the object-to-object relations as dashed edges.

Querying the Result
The extracted OCEL can be queried like any other OCEL in OCPQ.
For example, the following constraint considers small orders and states that every order with at most 3 order lines should be shipped at most one week after it was placed.
In the Northwind data, 541 of the 1,232 small orders (43.9%) take longer.
You can copy the query using the button on the right and paste it into the query editor with Ctrl+V.
