pm4py.objects.oc_causal_net.semantics module#
PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- class pm4py.objects.oc_causal_net.semantics.OCCausalNetState(*args: Any, **kwargs: Any)[source]#
Bases:
Generic[N],defaultdictThe state of an object-centric causal net is a mapping from activities act to multisets of outstanding obligations (act2, object_id, object_type) from act2 to act.
` state = OCCausalNetState({act: Counter([(act2, object_id, object_type)])}) `
- class pm4py.objects.oc_causal_net.semantics.OCCausalNetSemantics[source]#
Bases:
Generic[N]Class for the semantics of object-centric causal nets
- classmethod enabled_activities(occn: N, state: OCCausalNetState, include_start_activities=False, act_to_idx: dict = None, ot_to_idx: dict = None) Set[source]#
Returns the enabled activities in the given state.
- Parameters:
occn – Object-centric causal net
state – State of the OCCN
include_start_activities – True if start activities should be included in the set. Start activities are always enabled.
act_to_idx – If activities are denoted in the state by an id instead of their name, a dictionary mapping activities to their index has to be provided here.
ot_to_idx – If object types are denoted in the state by an id instead of their name, a dictionary mapping object types to their index has to be provided here.
- Returns:
Set of all activities enabled.
- Return type:
- classmethod is_enabled(occn: N, act: str, state: OCCausalNetState, act_to_idx: dict = None, ot_to_idx: dict = None) bool[source]#
Checks whether a given activity is enabled in a given object-centric casal net and state. An activity is enabled if there exists an input marker group that can be bound. Start activities are always enabled.
- Parameters:
occn – Object-centric causal net
act – Activity to check
state – State of the OCCN
act_to_idx – If activities are denoted in the state by an id instead of their name, a dictionary mapping activities to their index has to be provided here.
ot_to_idx – If object types are denoted in the state by an id instead of their name, a dictionary mapping object types to their index has to be provided here.
- Returns:
true if enabled, false otherwise
- Return type:
- classmethod is_binding_enabled(net: N, act: str, cons: Dict[str, Dict[str, Set]], prod: Dict[str, Dict[str, Set]], state: OCCausalNetState) Tuple[MG, MG] | None[source]#
Checks whether the given binding is enabled in the object-centric causal net. A binding is enabled if the activity has input and output marker groupos that match the given objects and the state contains all necessary obligations.
- Parameters:
net (N) – The object-centric causal net
act (str) – The activity to bind
cons (dict[str, dict[str, Set]]) – The obligations to consume, mapping predecessor activities to a dict mapping object types to a set of object ids
prod (dict[str, dict[str, Set]]) – The obligations to produce, mapping successor activities to a dict mapping object types to a set of object ids
state (OCCausalNetState) – The current state of the OCCN
- Returns:
The input and output marker groups enabling the binding if it is enabled, None otherwise.
- Return type:
Union[tuple[MG, MG], None]
- classmethod bind_activity(net: N, act: str, cons: Dict[str, Dict[str, Set]], prod: Dict[str, Dict[str, Set]], state: OCCausalNetState) OCCausalNetState[source]#
Binds an activity in the object-centric causal net. For performance reasons, this method does not check whether the binding is valid given the current state. If necessary, the caller should ensure this, e.g., using the is_binding_enabled method.
- Parameters:
net (N) – The object-centric causal net
act (str) – The activity to bind
cons (dict[str, dict[str, Set]]) – The obligations to consume, mapping predecessor activities to a dict mapping object types to a set of object ids
prod (dict[str, dict[str, Set]]) – The obligations to produce, mapping successor activities to a dict mapping object types to a set of object ids
state (OCCausalNetState) – The current state of the OCCN
- Returns:
The new state after binding the activity
- Return type:
- classmethod replay(occn: N, sequence: tuple) bool[source]#
Replays a sequence of bindings on the object-centric causal net.
- Parameters:
occn (N) – The object-centric causal net to replay on.
sequence (tuple) – A sequence of bindings, where each binding is a tuple of (activity_name, consumed_obligations, produced_obligations). consumed_obligations and produced_obligations are dictionaries mapping related activities to a dict mapping object types to a set of object ids.
- Returns:
True if the sequence can be replayed on the net, False otherwise.
- Return type:
- classmethod enabled_bindings_start_activity(occn: N, act: str, object_type: str, objects: set, act_to_idx: dict = None, ot_to_idx: dict = None) tuple[source]#
Computes all enabled bindings for a start activity with a given set of objects. These bindings will produce obligations for at least one of the objects. Based on the enabled_bindings method, but specialized for start activities.
- Parameters:
occn (N) – The object-centric causal net
act (str) – The start activity to bind
object_type (str) – The object type of the start activity
objects (set) – A set of objects to bind to the activity. All bindings will bind at least one.
act_to_idx (dict, optional) – If activities are denoted in the state by an id instead of their name, a dictionary mapping activities to their index has to be provided here.
ot_to_idx (dict, optional) – If object types are denoted in the state by an id instead of their name, a dictionary mapping object types to their index has to be provided here.
- Returns:
A tuple where entries are tuples of activity id, consumed objects, and produced objects. Consumed / produces are tuples of (predecessor/successor activity id, objects_per_ot) where objects_per_ot is a tuples of entries (object_type, objects) where objects is a tuple (obj_id_1, obj_id_2, …). If act_to_idx and ot_to_idx are provided, indices instead of names are used for activities and object types.
- Return type:
- classmethod enabled_bindings(occn: N, act: str, state: OCCausalNetState, act_to_idx: dict = None, ot_to_idx: dict = None) tuple[source]#
Computes all enabled bindings for a given activity in a given state.
- Parameters:
occn (N) – The object-centric causal net
act (str) – The activity to bind
state (OCCausalNetState) – The current state of the OCCN
act_to_idx (dict, optional) – If activities are denoted in the state by an id instead of their name, a dictionary mapping activities to their index has to be provided here.
ot_to_idx (dict, optional) – If object types are denoted in the state by an id instead of their name, a dictionary mapping object types to their index has to be provided here.
- Returns:
A tuple where entries are tuples of activity id, consumed objects, and produced objects. Consumed / produces are tuples of (predecessor/successor activity id, objects_per_ot) where objects_per_ot is a tuples of entries (object_type, objects) where objects is a tuple (obj_id_1, obj_id_2, …). If act_to_idx and ot_to_idx are provided, indices instead of names are used for activities and object types.
- Return type: