# Rust4PM Python Bindings -- Full Reference (v0.5.5) > High-performance process mining built in Rust, accessed from Python via `r4pm`. This file is a complete reference of every exposed function in version 0.5.5, generated from the same binding metadata that powers https://rust4pm.aarkue.eu. ## Usage ```python import r4pm import r4pm.bindings as b ``` Functions are listed below by their Rust module path. In Python they are flattened under `r4pm` / `r4pm.bindings` -- call them by name (e.g. `b.locel_new()`), not by the full Rust path. ## Function Index ### `process_mining::analysis::case_centric::dotted_chart` - `get_dotted_chart` -- Generate dotted chart data from an event log. ### `process_mining::analysis::case_centric::event_timestamp_histogram` - `get_event_timestamps` -- Aggregate event timestamps into a fixed number of bins, grouped by activity. ### `process_mining::analysis::object_centric::object_attribute_changes` - `get_object_attribute_changes` -- Extract the attribute change history for a specific object. ### `process_mining::bindings` - `index_link_ocel` -- Convert an [`OCEL`] to an [`IndexLinkedOCEL`] - `num_events` -- Get the number of events in an [`OCEL`] - `num_objects` -- Get the number of objects in an [`OCEL`] - `ocel_type_stats` -- Compute statistics on object/event types in the OCEL - `slim_link_ocel` -- Convert an [`OCEL`] to an [`SlimLinkedOCEL`] - `test_some_inputs` -- This is a test function. ### `process_mining::bindings::slim_ocel_bindings` - `locel_add_e2o` -- Add an E2O (event-to-object) relationship with the given qualifier. - `locel_add_event` -- Add an event and return its [`EventIndex`]. - `locel_add_event_type` -- Add an event type with the given ordered attribute declarations. - `locel_add_o2o` -- Add a directed O2O (object-to-object) relationship from `from_obj` to `to_obj` with the given qualifier. - `locel_add_object` -- Add an object and return its [`ObjectIndex`]. - `locel_add_object_type` -- Add an object type with the given ordered attribute declarations. - `locel_construct_ocel` -- Reconstruct a full [`OCEL`] from a [`SlimLinkedOCEL`]. Can be expensive for large logs. - `locel_delete_e2o` -- Remove all E2O relationships between the given event and object (across every qualifier). - `locel_delete_o2o` -- Remove all O2O relationships from `from_obj` to `to_obj` (across every qualifier). - `locel_get_e2o` -- Get the E2O relationships of an event as `(qualifier, object_index)` pairs. - `locel_get_e2o_rev` -- Get the reverse E2O relationships of an object (events relating to it) as `(qualifier, event_index)` pairs. - `locel_get_ev_attr_val` -- Get the value of an event attribute by name. `None` if the attribute does not exist. - `locel_get_ev_by_id` -- Look up an event by its ID string. `None` if not found. - `locel_get_ev_id` -- Get the ID string of an event. Panics if the index is out of bounds. - `locel_get_ev_time` -- Get the timestamp of an event. Panics if the index is out of bounds. - `locel_get_ev_type` -- Get the event type specification (name + attributes), or `None` if unknown. - `locel_get_ev_type_of` -- Get the event type (activity) of an event. Panics if the index is out of bounds. - `locel_get_ev_types` -- Get all declared event type names, in declaration order. - `locel_get_evs_of_type` -- Get all event indices of the given event type. Empty if unknown. - `locel_get_full_ev` -- Get the full [`OCELEvent`] (resolved type name, named attributes, string object IDs). - `locel_get_full_ob` -- Get the full [`OCELObject`] (resolved type name, named time-indexed attributes, string object IDs). - `locel_get_o2o` -- Get the outgoing O2O relationships of an object as `(qualifier, object_index)` pairs. - `locel_get_o2o_rev` -- Get the reverse O2O relationships of an object (objects with an O2O to it) as `(qualifier, object_index)` pairs. - `locel_get_ob_attr_vals` -- Get the time-indexed history of an object attribute by name as `(timestamp, value)` pairs. Empty if absent. - `locel_get_ob_by_id` -- Look up an object by its ID string. `None` if not found. - `locel_get_ob_id` -- Get the ID string of an object. Panics if the index is out of bounds. - `locel_get_ob_type` -- Get the object type specification (name + attributes), or `None` if unknown. - `locel_get_ob_type_of` -- Get the object type of an object. Panics if the index is out of bounds. - `locel_get_ob_types` -- Get all declared object type names, in declaration order. - `locel_get_obs_of_type` -- Get all object indices of the given object type. Empty if unknown. - `locel_new` -- Create a new empty [`SlimLinkedOCEL`]. ### `process_mining::conformance::object_centric::oc_declare` - `oc_declare_conformance` -- Returns the confidence conformance of an OC-DECLARE arc on the given OCEL ### `process_mining::core::event_data::case_centric::utils::activity_projection` - `log_to_activity_projection` -- Convert an [`EventLog`] into an [`EventLogActivityProjection`] ### `process_mining::core::event_data::object_centric::utils::flatten` - `flatten_ocel_on` -- Flatten an OCEL on a specific object type, resulting in a case-centric Event Log ### `process_mining::core::event_data::object_centric::utils::init_exit_events` - `add_init_exit_events_to_ocel` -- Add artificial init/exit events to an OCEL ### `process_mining::core::process_models::case_centric::dfg::image_export` - `export_dfg_image_png` -- Export the image of a [`DirectlyFollowsGraph`] as a PNG file - `export_dfg_image_svg` -- Export the image of a [`DirectlyFollowsGraph`] as a SVG file ### `process_mining::core::process_models::case_centric::dfg::image_export::private` - `export_dfg_png` ### `process_mining::core::process_models::case_centric::petri_net::image_export` - `export_petri_net_image_png` -- Export the image of a [`PetriNet`] as a PNG file - `export_petri_net_image_svg` -- Export the image of a [`PetriNet`] as a SVG file ### `process_mining::core::process_models::object_centric::ocdfg::object_centric_dfg_struct` - `discover_dfg_from_ocel` -- Construct an [`OCDirectlyFollowsGraph`] from an OCEL ### `process_mining::discovery::case_centric::alphappp::full` - `discover_alpha+++` -- Discover a [`PetriNet`] using the Alpha+++ Process Discovery algorithm ### `process_mining::discovery::case_centric::dfg` - `discover_dfg` -- Discover [`DirectlyFollowsGraph`] with default classifier ### `process_mining::discovery::object_centric::oc_declare` - `discover_oc_declare` -- Discover behavioral OC-DECLARE constraints from the given OCEL ## Functions ### Module: `process_mining::analysis::case_centric::dotted_chart` #### `get_dotted_chart(xes: EventLog, options: DottedChartOptions = None) -> DottedChartData` Generate dotted chart data from an event log. Traces are sorted by the timestamp of their first event. Each event produces one dot with coordinates determined by the configured axes. **Arguments:** - `xes` (EventLog) - `options` (DottedChartOptions, optional) -- Options for [`get_dotted_chart`]. **Returns:** DottedChartData Result of [`get_dotted_chart`], containing the plotted points grouped by color. **Source:** [`process_mining/src/analysis/case_centric/dotted_chart.rs:200`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/analysis/case_centric/dotted_chart.rs#L200) --- ### Module: `process_mining::analysis::case_centric::event_timestamp_histogram` #### `get_event_timestamps(log: EventLog, options: EventTimestampOptions = None) -> AggregatedEventTimestamps` Aggregate event timestamps into a fixed number of bins, grouped by activity. Events without a valid timestamp are skipped; events without a recognized activity are counted under `"UNKNOWN"`. **Arguments:** - `log` (EventLog) - `options` (EventTimestampOptions, optional) -- Options for [`get_event_timestamps`]. **Returns:** AggregatedEventTimestamps Aggregated event counts per timestamp bin, grouped by activity. **Source:** [`process_mining/src/analysis/case_centric/event_timestamp_histogram.rs:54`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/analysis/case_centric/event_timestamp_histogram.rs#L54) --- ### Module: `process_mining::analysis::object_centric::object_attribute_changes` #### `get_object_attribute_changes(ocel: SlimLinkedOCEL, object_id: str) -> ObjectAttributeChanges` Extract the attribute change history for a specific object. Returns one trace per attribute, each containing the timestamped values in the order they appear in the log. Returns an error if the object ID is not found. **Arguments:** - `ocel` (SlimLinkedOCEL) - `object_id` (str) **Returns:** ObjectAttributeChanges Time-stamped attribute change history for a single OCEL object. **Source:** [`process_mining/src/analysis/object_centric/object_attribute_changes.rs:38`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/analysis/object_centric/object_attribute_changes.rs#L38) --- ### Module: `process_mining::bindings` #### `index_link_ocel(ocel: OCEL) -> IndexLinkedOCEL` Convert an [`OCEL`] to an [`IndexLinkedOCEL`] **Arguments:** - `ocel` (OCEL) **Returns:** IndexLinkedOCEL **Source:** [`process_mining/src/bindings/mod.rs:613`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L613) --- #### `num_events(ocel: SlimLinkedOCEL) -> uint` Get the number of events in an [`OCEL`] **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** uint **Source:** [`process_mining/src/bindings/mod.rs:583`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L583) --- #### `num_objects(ocel: SlimLinkedOCEL) -> uint` Get the number of objects in an [`OCEL`] **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** uint **Source:** [`process_mining/src/bindings/mod.rs:578`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L578) --- #### `ocel_type_stats(ocel: SlimLinkedOCEL) -> OCELTypeStats` Compute statistics on object/event types in the OCEL **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** OCELTypeStats Statistics on the event and object types of an OCEL **Source:** [`process_mining/src/bindings/mod.rs:597`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L597) --- #### `slim_link_ocel(ocel: OCEL) -> SlimLinkedOCEL` Convert an [`OCEL`] to an [`SlimLinkedOCEL`] **Arguments:** - `ocel` (OCEL) **Returns:** SlimLinkedOCEL **Source:** [`process_mining/src/bindings/mod.rs:619`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L619) --- #### `test_some_inputs(s: str, n: uint, i: int32, f: double, b: bool) -> str` This is a test function. **This should be bold**, *this is italic*, `and this code`. **Arguments:** - `s` (str) - `n` (uint) - `i` (int32) - `f` (double) - `b` (bool) **Returns:** str **Source:** [`process_mining/src/bindings/mod.rs:624`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/mod.rs#L624) --- ### Module: `process_mining::bindings::slim_ocel_bindings` #### `locel_add_e2o(ocel: SlimLinkedOCEL, event: EventIndex, object: ObjectIndex, qualifier: str) -> bool` Add an E2O (event-to-object) relationship with the given qualifier. Multiple qualifiers between the same `(event, object)` pair are allowed; re-adding the exact same `(event, object, qualifier)` triple is a no-op. Returns `true` on success, `false` if either index is out of bounds (with a stderr warning). **Arguments:** - `ocel` (SlimLinkedOCEL) - `event` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL - `object` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL - `qualifier` (str) **Returns:** bool **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:103`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L103) --- #### `locel_add_event(ocel: SlimLinkedOCEL, event_type: str, time: DateTime, id: Optional[str] = None, attributes: list[OCELAttributeValue] = None, relationships: list[tuple[str, ObjectIndex]] = None) -> Optional[EventIndex]` Add an event and return its [`EventIndex`]. The event type must have been declared via [`locel_add_event_type`] first; otherwise this returns `None`. `id`: If `None`, a UUID is assigned. Returns `None` if the id is already taken. `attributes`: Positional values in the declared attribute order. Padded with `Null` or truncated on length mismatch (with a warning). `relationships`: E2O relationships as `(qualifier, object_index)` pairs (can also be added later via [`locel_add_e2o`]). **Arguments:** - `ocel` (SlimLinkedOCEL) - `event_type` (str) - `time` (DateTime) - `id` (Optional[str], optional) - `attributes` (list[OCELAttributeValue], optional) - `relationships` (list[tuple[str, ObjectIndex]], optional) **Returns:** Optional[EventIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:65`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L65) --- #### `locel_add_event_type(ocel: SlimLinkedOCEL, event_type: str, attributes: list[OCELTypeAttribute] = None) -> None` Add an event type with the given ordered attribute declarations. No-op if the event type already exists. **Arguments:** - `ocel` (SlimLinkedOCEL) - `event_type` (str) - `attributes` (list[OCELTypeAttribute], optional) **Returns:** None **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:34`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L34) --- #### `locel_add_o2o(ocel: SlimLinkedOCEL, from_obj: ObjectIndex, to_obj: ObjectIndex, qualifier: str) -> bool` Add a directed O2O (object-to-object) relationship from `from_obj` to `to_obj` with the given qualifier. Multiple qualifiers between the same `(from_obj, to_obj)` pair are allowed; re-adding the exact same `(from_obj, to_obj, qualifier)` triple is a no-op. Returns `true` on success, `false` if either index is out of bounds (with a stderr warning). **Arguments:** - `ocel` (SlimLinkedOCEL) - `from_obj` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL - `to_obj` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL - `qualifier` (str) **Returns:** bool **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:118`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L118) --- #### `locel_add_object(ocel: SlimLinkedOCEL, object_type: str, id: Optional[str] = None, attributes: list[list[tuple[DateTime, OCELAttributeValue]]] = None, relationships: list[tuple[str, ObjectIndex]] = None) -> Optional[ObjectIndex]` Add an object and return its [`ObjectIndex`]. The object type must have been declared via [`locel_add_object_type`] first; otherwise this returns `None`. `id`: If `None`, a UUID is assigned. Returns `None` if the id is already taken. `attributes`: Positional list of time-indexed attribute histories (one `(timestamp, value)` list per declared attribute, in order). Use `1970-01-01T00:00:00Z` for constant/initial values. Padded with empty lists or truncated on length mismatch (with a warning). `relationships`: Outgoing O2O relationships as `(qualifier, object_index)` pairs (can also be added later via [`locel_add_o2o`]). **Arguments:** - `ocel` (SlimLinkedOCEL) - `object_type` (str) - `id` (Optional[str], optional) - `attributes` (list[list[tuple[DateTime, OCELAttributeValue]]], optional) - `relationships` (list[tuple[str, ObjectIndex]], optional) **Returns:** Optional[ObjectIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:85`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L85) --- #### `locel_add_object_type(ocel: SlimLinkedOCEL, object_type: str, attributes: list[OCELTypeAttribute] = None) -> None` Add an object type with the given ordered attribute declarations. No-op if the object type already exists. **Arguments:** - `ocel` (SlimLinkedOCEL) - `object_type` (str) - `attributes` (list[OCELTypeAttribute], optional) **Returns:** None **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:46`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L46) --- #### `locel_construct_ocel(ocel: SlimLinkedOCEL) -> OCEL` Reconstruct a full [`OCEL`] from a [`SlimLinkedOCEL`]. Can be expensive for large logs. **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** OCEL **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:301`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L301) --- #### `locel_delete_e2o(ocel: SlimLinkedOCEL, event: EventIndex, object: ObjectIndex) -> bool` Remove all E2O relationships between the given event and object (across every qualifier). Returns `true` on success, `false` if either index is out of bounds (with a stderr warning). **Arguments:** - `ocel` (SlimLinkedOCEL) - `event` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL - `object` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** bool **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:131`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L131) --- #### `locel_delete_o2o(ocel: SlimLinkedOCEL, from_obj: ObjectIndex, to_obj: ObjectIndex) -> bool` Remove all O2O relationships from `from_obj` to `to_obj` (across every qualifier). Returns `true` on success, `false` if either index is out of bounds (with a stderr warning). **Arguments:** - `ocel` (SlimLinkedOCEL) - `from_obj` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL - `to_obj` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** bool **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:139`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L139) --- #### `locel_get_e2o(ocel: SlimLinkedOCEL, ev: EventIndex) -> list[tuple[str, ObjectIndex]]` Get the E2O relationships of an event as `(qualifier, object_index)` pairs. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL **Returns:** list[tuple[str, ObjectIndex]] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:225`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L225) --- #### `locel_get_e2o_rev(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> list[tuple[str, EventIndex]]` Get the reverse E2O relationships of an object (events relating to it) as `(qualifier, event_index)` pairs. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** list[tuple[str, EventIndex]] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:233`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L233) --- #### `locel_get_ev_attr_val(ocel: SlimLinkedOCEL, ev: EventIndex, attr_name: str) -> Optional[OCELAttributeValue]` Get the value of an event attribute by name. `None` if the attribute does not exist. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL - `attr_name` (str) **Returns:** Optional[OCELAttributeValue] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:277`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L277) --- #### `locel_get_ev_by_id(ocel: SlimLinkedOCEL, ev_id: str) -> Optional[EventIndex]` Look up an event by its ID string. `None` if not found. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev_id` (str) **Returns:** Optional[EventIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:183`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L183) --- #### `locel_get_ev_id(ocel: SlimLinkedOCEL, ev: EventIndex) -> str` Get the ID string of an event. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL **Returns:** str **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:195`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L195) --- #### `locel_get_ev_time(ocel: SlimLinkedOCEL, ev: EventIndex) -> DateTime` Get the timestamp of an event. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL **Returns:** DateTime **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:219`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L219) --- #### `locel_get_ev_type(ocel: SlimLinkedOCEL, ev_type: str) -> Optional[OCELType]` Get the event type specification (name + attributes), or `None` if unknown. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev_type` (str) **Returns:** Optional[OCELType] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:159`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L159) --- #### `locel_get_ev_type_of(ocel: SlimLinkedOCEL, ev: EventIndex) -> str` Get the event type (activity) of an event. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL **Returns:** str **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:207`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L207) --- #### `locel_get_ev_types(ocel: SlimLinkedOCEL) -> list[str]` Get all declared event type names, in declaration order. **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** list[str] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:147`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L147) --- #### `locel_get_evs_of_type(ocel: SlimLinkedOCEL, ev_type: str) -> list[EventIndex]` Get all event indices of the given event type. Empty if unknown. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev_type` (str) **Returns:** list[EventIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:171`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L171) --- #### `locel_get_full_ev(ocel: SlimLinkedOCEL, ev: EventIndex) -> OCELEvent` Get the full [`OCELEvent`] (resolved type name, named attributes, string object IDs). Allocates; prefer the specific `locel_get_ev_*` accessors for single fields. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ev` (EventIndex) -- An Event Index Points to an event in the context of a given OCEL **Returns:** OCELEvent OCEL Event **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:260`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L260) --- #### `locel_get_full_ob(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> OCELObject` Get the full [`OCELObject`] (resolved type name, named time-indexed attributes, string object IDs). Allocates; prefer the specific `locel_get_ob_*` accessors for single fields. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** OCELObject OCEL Object **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:269`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L269) --- #### `locel_get_o2o(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> list[tuple[str, ObjectIndex]]` Get the outgoing O2O relationships of an object as `(qualifier, object_index)` pairs. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** list[tuple[str, ObjectIndex]] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:241`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L241) --- #### `locel_get_o2o_rev(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> list[tuple[str, ObjectIndex]]` Get the reverse O2O relationships of an object (objects with an O2O to it) as `(qualifier, object_index)` pairs. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** list[tuple[str, ObjectIndex]] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:249`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L249) --- #### `locel_get_ob_attr_vals(ocel: SlimLinkedOCEL, ob: ObjectIndex, attr_name: str) -> list[tuple[DateTime, OCELAttributeValue]]` Get the time-indexed history of an object attribute by name as `(timestamp, value)` pairs. Empty if absent. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL - `attr_name` (str) **Returns:** list[tuple[DateTime, OCELAttributeValue]] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:289`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L289) --- #### `locel_get_ob_by_id(ocel: SlimLinkedOCEL, ob_id: str) -> Optional[ObjectIndex]` Look up an object by its ID string. `None` if not found. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob_id` (str) **Returns:** Optional[ObjectIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:189`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L189) --- #### `locel_get_ob_id(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> str` Get the ID string of an object. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** str **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:201`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L201) --- #### `locel_get_ob_type(ocel: SlimLinkedOCEL, ob_type: str) -> Optional[OCELType]` Get the object type specification (name + attributes), or `None` if unknown. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob_type` (str) **Returns:** Optional[OCELType] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:165`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L165) --- #### `locel_get_ob_type_of(ocel: SlimLinkedOCEL, ob: ObjectIndex) -> str` Get the object type of an object. Panics if the index is out of bounds. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob` (ObjectIndex) -- An Object Index Points to an object in the context of a given OCEL **Returns:** str **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:213`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L213) --- #### `locel_get_ob_types(ocel: SlimLinkedOCEL) -> list[str]` Get all declared object type names, in declaration order. **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** list[str] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:153`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L153) --- #### `locel_get_obs_of_type(ocel: SlimLinkedOCEL, ob_type: str) -> list[ObjectIndex]` Get all object indices of the given object type. Empty if unknown. **Arguments:** - `ocel` (SlimLinkedOCEL) - `ob_type` (str) **Returns:** list[ObjectIndex] **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:177`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L177) --- #### `locel_new() -> SlimLinkedOCEL` Create a new empty [`SlimLinkedOCEL`]. A [`SlimLinkedOCEL`] is an object-centric event log where events and objects are referenced by integer indices ([`EventIndex`] / [`ObjectIndex`]) returned from the `add_*` calls, and each indexed event/object is an instance of an event/object type (activity / object class) declared beforehand with an ordered list of attributes. **Returns:** SlimLinkedOCEL **Source:** [`process_mining/src/bindings/slim_ocel_bindings.rs:24`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/bindings/slim_ocel_bindings.rs#L24) --- ### Module: `process_mining::conformance::object_centric::oc_declare` #### `oc_declare_conformance(ocel: SlimLinkedOCEL, arc: OCDeclareArc) -> double` Returns the confidence conformance of an OC-DECLARE arc on the given OCEL Returns a value from 0.0 (all source events violate this constraint) to 1.0 (all source events satisfy this constraint) **Arguments:** - `ocel` (SlimLinkedOCEL) - `arc` (OCDeclareArc) -- OC-DECLARE Constraint arc/edge between two nodes (i.e., activities) **Returns:** double **Source:** [`process_mining/src/conformance/object_centric/oc_declare.rs:287`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/conformance/object_centric/oc_declare.rs#L287) --- ### Module: `process_mining::core::event_data::case_centric::utils::activity_projection` #### `log_to_activity_projection(log: EventLog) -> EventLogActivityProjection` Convert an [`EventLog`] into an [`EventLogActivityProjection`] All traces with the same activity sequence are aggregated into one trace with a frequency count. This effectively constructs all trace variants, with their count. **Arguments:** - `log` (EventLog) **Returns:** EventLogActivityProjection **Source:** [`process_mining/src/core/event_data/case_centric/utils/activity_projection.rs:92`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/event_data/case_centric/utils/activity_projection.rs#L92) --- ### Module: `process_mining::core::event_data::object_centric::utils::flatten` #### `flatten_ocel_on(ocel: SlimLinkedOCEL, object_type: str) -> EventLog` Flatten an OCEL on a specific object type, resulting in a case-centric Event Log For each object of the specified type, a trace is created containing all events related to that object, ordered by their timestamp. **Arguments:** - `ocel` (SlimLinkedOCEL) - `object_type` (str) **Returns:** EventLog **Source:** [`process_mining/src/core/event_data/object_centric/utils/flatten.rs:15`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/event_data/object_centric/utils/flatten.rs#L15) --- ### Module: `process_mining::core::event_data::object_centric::utils::init_exit_events` #### `add_init_exit_events_to_ocel(ocel: OCEL) -> OCEL` Add artificial init/exit events to an OCEL - `` events are added for each object, exactly or slightly before the time they first occur in an event - `` events are added for each object, exactly or slightly after the time they last occur in an event For an object of type `order` the activities are then called ` order` or ` order`, respectively. __Note: This processing is no longer necessary for OC-DECLARE discovery and conformance checking__ This function remains, as it might be useful for other applications. **Arguments:** - `ocel` (OCEL) -- Object-centric Event Log Consists of multiple [`OCELEvent`]s and [`OCELObject`]s with corresponding event and object [`OCELType`]s **Returns:** OCEL **Source:** [`process_mining/src/core/event_data/object_centric/utils/init_exit_events.rs:32`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/event_data/object_centric/utils/init_exit_events.rs#L32) --- ### Module: `process_mining::core::process_models::case_centric::dfg::image_export` #### `export_dfg_image_png(dfg: DirectlyFollowsGraph, path: str) -> None` Export the image of a [`DirectlyFollowsGraph`] as a PNG file Also consider using [`DirectlyFollowsGraph::export_png`] for convenience. **Arguments:** - `dfg` (DirectlyFollowsGraph) -- A directly-follows graph of [`Activity`]s. Graph containing a set of activities, a set of directly-follows relations, a set of start activities, and a set of end activities. Both, the number of occurrences of activities and of directly follows relations are annotated with their frequency. - `path` (str) **Returns:** None **Source:** [`process_mining/src/core/process_models/case_centric/dfg/image_export.rs:123`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/case_centric/dfg/image_export.rs#L123) --- #### `export_dfg_image_svg(dfg: DirectlyFollowsGraph, path: str) -> None` Export the image of a [`DirectlyFollowsGraph`] as a SVG file Also consider using [`DirectlyFollowsGraph::export_svg`] for convenience. **Arguments:** - `dfg` (DirectlyFollowsGraph) -- A directly-follows graph of [`Activity`]s. Graph containing a set of activities, a set of directly-follows relations, a set of start activities, and a set of end activities. Both, the number of occurrences of activities and of directly follows relations are annotated with their frequency. - `path` (str) **Returns:** None **Source:** [`process_mining/src/core/process_models/case_centric/dfg/image_export.rs:111`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/case_centric/dfg/image_export.rs#L111) --- ### Module: `process_mining::core::process_models::case_centric::dfg::image_export::private` #### `export_dfg_png(dfg: DirectlyFollowsGraph, path: str) -> None` **Arguments:** - `dfg` (DirectlyFollowsGraph) -- A directly-follows graph of [`Activity`]s. Graph containing a set of activities, a set of directly-follows relations, a set of start activities, and a set of end activities. Both, the number of occurrences of activities and of directly follows relations are annotated with their frequency. - `path` (str) **Returns:** None **Source:** [`process_mining/src/core/process_models/case_centric/dfg/image_export.rs:140`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/case_centric/dfg/image_export.rs#L140) --- ### Module: `process_mining::core::process_models::case_centric::petri_net::image_export` #### `export_petri_net_image_png(net: PetriNet, path: str) -> None` Export the image of a [`PetriNet`] as a PNG file Also consider using [`PetriNet::export_png`] for convenience. **Arguments:** - `net` (PetriNet) -- A Petri net of [`Place`]s and [`Transition`]s Bipartite graph of [`Place`]s and [`Transition`]s with [`Arc`]s connecting them, as well as initial and final [`Marking`]s - `path` (str) **Returns:** None **Source:** [`process_mining/src/core/process_models/case_centric/petri_net/image_export.rs:122`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/case_centric/petri_net/image_export.rs#L122) --- #### `export_petri_net_image_svg(net: PetriNet, path: str) -> None` Export the image of a [`PetriNet`] as a SVG file Also consider using [`PetriNet::export_svg`] for convenience. **Arguments:** - `net` (PetriNet) -- A Petri net of [`Place`]s and [`Transition`]s Bipartite graph of [`Place`]s and [`Transition`]s with [`Arc`]s connecting them, as well as initial and final [`Marking`]s - `path` (str) **Returns:** None **Source:** [`process_mining/src/core/process_models/case_centric/petri_net/image_export.rs:110`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/case_centric/petri_net/image_export.rs#L110) --- ### Module: `process_mining::core::process_models::object_centric::ocdfg::object_centric_dfg_struct` #### `discover_dfg_from_ocel(ocel: SlimLinkedOCEL) -> OCDirectlyFollowsGraph` Construct an [`OCDirectlyFollowsGraph`] from an OCEL **Arguments:** - `ocel` (SlimLinkedOCEL) **Returns:** OCDirectlyFollowsGraph An object-centric directly-follows graph containing a [`DirectlyFollowsGraph`] for each object type involved. **Source:** [`process_mining/src/core/process_models/object_centric/ocdfg/object_centric_dfg_struct.rs:51`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/core/process_models/object_centric/ocdfg/object_centric_dfg_struct.rs#L51) --- ### Module: `process_mining::discovery::case_centric::alphappp::full` #### `discover_alpha+++(log_proj: EventLogActivityProjection, config: AlphaPPPConfig = None) -> PetriNet` Discover a [`PetriNet`] using the Alpha+++ Process Discovery algorithm **Arguments:** - `log_proj` (EventLogActivityProjection) - `config` (AlphaPPPConfig, optional) -- Algorithm parameters for Alpha+++ **Returns:** PetriNet A Petri net of [`Place`]s and [`Transition`]s Bipartite graph of [`Place`]s and [`Transition`]s with [`Arc`]s connecting them, as well as initial and final [`Marking`]s **Source:** [`process_mining/src/discovery/case_centric/alphappp/full.rs:110`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/discovery/case_centric/alphappp/full.rs#L110) --- ### Module: `process_mining::discovery::case_centric::dfg` #### `discover_dfg(event_log: EventLog) -> DirectlyFollowsGraph` Discover [`DirectlyFollowsGraph`] with default classifier **Arguments:** - `event_log` (EventLog) **Returns:** DirectlyFollowsGraph A directly-follows graph of [`Activity`]s. Graph containing a set of activities, a set of directly-follows relations, a set of start activities, and a set of end activities. Both, the number of occurrences of activities and of directly follows relations are annotated with their frequency. **Source:** [`process_mining/src/discovery/case_centric/dfg.rs:42`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/discovery/case_centric/dfg.rs#L42) --- ### Module: `process_mining::discovery::object_centric::oc_declare` #### `discover_oc_declare(locel: SlimLinkedOCEL, options: OCDeclareDiscoveryOptions = None) -> list[OCDeclareArc]` Discover behavioral OC-DECLARE constraints from the given OCEL **Arguments:** - `locel` (SlimLinkedOCEL) - `options` (OCDeclareDiscoveryOptions, optional) -- Options for the automatic discovery of OC-DECLARE constraints **Returns:** list[OCDeclareArc] **Source:** [`process_mining/src/discovery/object_centric/oc_declare/mod.rs:93`](https://github.com/aarkue/rust4pm/blob/main/process_mining/src/discovery/object_centric/oc_declare/mod.rs#L93) --- ## Examples ### Building a Linked OCEL Construct an OCEL end-to-end: declare event and object types, add events/objects with E2O/O2O relations, and export the resulting OCEL 2.0 to different formats. Live page: https://rust4pm.aarkue.eu/docs/examples/slim-ocel-basics ```python """ Build, query, and export a SlimLinkedOCEL log. Run: python example.py Install: pip install r4pm """ import r4pm import r4pm.bindings as b # --- Build --- locel = b.locel_new() # One event type with a `tip` attribute. b.locel_add_event_type(locel, "place order", [{"name": "tip", "type": "float"}]) # Two object types. `item` has a `price` attribute. # (Object attributes are always time-indexed in OCEL 2.0.) b.locel_add_object_type(locel, "order") b.locel_add_object_type(locel, "item", [{"name": "price", "type": "float"}]) # 100 events. Each event gets its own order plus four items. # The ints returned by `locel_add_event` / `locel_add_object` are the refs: # each is the index of that element in the log. All query functions take these. for i in range(100): ev = b.locel_add_event( locel, "place order", "2026-03-02T10:30:00Z", None, [round(i * 0.5, 2)], # tip ) order = b.locel_add_object(locel, "order") b.locel_add_e2o(locel, ev, order, "of") for j in range(4): # Each object attribute takes a list of (timestamp, value) tuples. # For initial or constant values, use UNIX epoch. price_history = [[("1970-01-01T00:00:00Z", round(j * 4.3, 2))]] item = b.locel_add_object(locel, "item", None, price_history) b.locel_add_e2o(locel, ev, item, "with") b.locel_add_o2o(locel, item, order, "is in") # --- Export --- # File extension picks the format (see "Export formats" below). r4pm.export_item(locel, "export.xml") # --- Read back / Use --- # How many events of a given type? events = b.locel_get_evs_of_type(locel, "place order") print(f"{len(events)} 'place order' events") # -> 100 'place order' events # Read an attribute off the most recently added event. tip = b.locel_get_ev_attr_val(locel, ev, "tip") print(f"last event tip = {tip}") # -> last event tip = 49.5 # Walk the E2O relations of that event and show what it's linked to. for qualifier, ob_ref in b.locel_get_e2o(locel, ev): ob_type = b.locel_get_ob_type_of(locel, ob_ref) print(f" {qualifier} -> {ob_type} (ref {ob_ref})") # -> of -> order (ref 495) # -> with -> item (ref 496) # -> with -> item (ref 497) # -> with -> item (ref 498) # -> with -> item (ref 499) ``` `r4pm.export_item` picks the OCEL 2.0 output format from the file extension: `.xml` (XML), `.sqlite` (SQLite), `.json` (JSON). ### Building an OCEL from CSV tables Read events, objects, and relationships from CSV tables and build an OCEL 2.0 log. Works the same way for Pandas or Polars dataframes. Live page: https://rust4pm.aarkue.eu/docs/examples/ocel-from-csv ```python """ Build a SlimLinkedOCEL from CSV tables. Inputs (in the same directory as this script): events.csv one row per event orders.csv, items.csv one row per object, one CSV per object type e2o.csv, o2o.csv relationships Run: python example.py Install: pip install r4pm """ import csv from pathlib import Path import r4pm import r4pm.bindings as b HERE = Path(__file__).parent def read_csv(name): with (HERE / name).open(newline="") as f: return list(csv.DictReader(f)) # --- Declare types --- locel = b.locel_new() b.locel_add_event_type(locel, "place order", [{"name": "tip", "type": "float"}]) b.locel_add_object_type(locel, "order") b.locel_add_object_type(locel, "item", [{"name": "price", "type": "float"}]) # --- Add events and objects --- # Pass the CSV string ID as the OCEL `id`. The relationship loops below resolve # it back to an integer ref via `locel_get_ev_by_id` / `locel_get_ob_by_id`, # so no manual id-to-ref dict is needed. Order matters: every event/object # must be added before any relationship that references it. for row in read_csv("events.csv"): # Attribute values are positional, in the order declared above. b.locel_add_event( locel, row["event_type"], row["timestamp"], row["event_id"], [float(row["tip"])], ) for row in read_csv("orders.csv"): b.locel_add_object(locel, "order", row["order_id"]) for row in read_csv("items.csv"): # Object attributes are time-indexed; UNIX epoch stands in for "constant". history = [[("1970-01-01T00:00:00Z", float(row["price"]))]] b.locel_add_object(locel, "item", row["item_id"], history) # --- Add relationships --- for row in read_csv("e2o.csv"): b.locel_add_e2o( locel, b.locel_get_ev_by_id(locel, row["event_id"]), b.locel_get_ob_by_id(locel, row["object_id"]), row["qualifier"], ) for row in read_csv("o2o.csv"): b.locel_add_o2o( locel, b.locel_get_ob_by_id(locel, row["source_object_id"]), b.locel_get_ob_by_id(locel, row["target_object_id"]), row["qualifier"], ) # --- Export --- # Extension picks the OCEL 2.0 format: .xml / .sqlite / .json r4pm.export_item(locel, "export.sqlite") print("Exported.") ```