pm4py.objects.oc_causal_net.variants.to_ocpn 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
- pm4py.objects.oc_causal_net.variants.to_ocpn.apply(occn: OCCausalNet, parameters=None) OCPetriNet[source]#
Converts an Object-centric Causal Net (OCCN) to an Object-centric Petri Net (OCPN) with empty markings. All cardinalities c!=(1,1) are treated as c=(0, *). Keys for input marker groups are ignored.
- Parameters:
occn (OCCausalNet) – The Object-centric Causal Net to convert. Start and end activities must be labeled “START_{object_type}” and “END_{object_type}” respectively.
parameters (dict, optional) – Additional parameters for the conversion (not used in this implementation).
- Returns:
The converted Object-centric Petri Net with empty markings.
- Return type:
- pm4py.objects.oc_causal_net.variants.to_ocpn.build_ordered_key_groups(activities, marker_groups)[source]#
Builds a hierarchy of object type groups, key groups and markers for each activity in the given list of activities. Object type groups are ordered by object type name. Key groups are ordered by the number of markers and by the number of markers with min_count=1 and max_count=1. Markers in key groups are ordered by min_count and max_count, effectively putting markers with (1,1) first.
- Parameters:
activities (list) – List of activities for which to build the key groups.
marker_groups (dict) – Dictionary mapping activities to their corresponding marker groups. The keys are activity names and the values are lists of marker groups.
- Returns:
A dictionary where keys are activities and values are lists of lists of tuples (object_type, object_type_group), where each object_type_group is a sorted list of tuples (marker_key, marker_key_group), where each marker_key_group is a sorted list of markers.
- Return type:
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_activity(places, places_names, transitions, arcs, activity, input_marker_groups, output_marker_groups, object_types, p_input_binding)[source]#
Creates the necessary places, transitions, and arcs for an activity in the OCPN.
- Parameters:
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to avoid duplications.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
activity (str) – The name of the activity to transform.
input_marker_groups (list) – List of input marker groups for the activity, where each marker group is a list of object type groups.
output_marker_groups (list) – List of output marker groups for the activity, where each marker group is a list of object type groups.
object_types (set) – Set of all object types in the OCPN.
p_input_binding (OCPetriNet.Place) – The input binding place for the activity construct.
- pm4py.objects.oc_causal_net.variants.to_ocpn.get_activity_object_types(object_types, input_marker_groups, output_marker_groups)[source]#
Returns a set of non-variable object types and a set of variable object types for the given marker groups. Non-variable object types are those where exactly one object of that type is involved in every firing of the activity.
- Parameters:
object_types (set) – Set of all object types in the OCPN.
input_marker_groups (list) – List of input marker groups for the activity, where each marker group is a list of object type groups.
output_marker_groups (list) – List of output marker groups for the activity, where each marker group is a list of object type groups.
- Returns:
A tuple containing two sets: - The first set contains non-variable object types. - The second set contains variable object types.
- Return type:
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_marker_group(activity, places, places_names, transitions, arcs, marker_group, p_input_binding, p_output_binding, is_output_marker_group)[source]#
Transforms a marker group into a construct of places, transitions, and arcs in the OCPN. Places, transitions, and arcs are updated to include the marker group.
- Parameters:
activity (str) – The name of the activity which the marker group belongs to.
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to avoid duplications.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
marker_group (list) – The marker group to transform, which is a list of object type groups (tuples of object type and list of key groups).
p_input_binding (OCPetriNet.Place) – The input binding place for the marker group construct.
p_output_binding (OCPetriNet.Place) – The output binding place for the marker group construct.
is_output_marker_group (bool) – Indicates if the marker group is an output marker group (True) or an input marker group (False).
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_input_object_type_group(activity, places, places_names, transitions, arcs, object_type_group, p_input_binding, p_output_binding)[source]#
Transforms an object type group of an input marker group into a construct of places, transitions, and arcs in the OCPN. Places, transitions, and arcs are updated to include the object type group. For input marker groups, we treat all keys as unique.
- Parameters:
activity (str) – The name of the activity which the object type group belongs to.
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to avoid duplications.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
object_type_group ((object_type, list)) – The object type group to transform, which is a tuple of the object type and a sorted list of key groups.
p_input_binding (OCPetriNet.Place) – The input binding place for the object type group construct.
p_output_binding (OCPetriNet.Place) – The output binding place for the object type group construct.
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_output_object_type_group(activity, places, places_names, transitions, arcs, object_type_group, p_input_binding, p_output_binding)[source]#
Transforms an object type group of an output marker group into a construct of places, transitions, and arcs in the OCPN. Places, transitions, and arcs are updated to include the object type group.
- Parameters:
activity (str) – The name of the activity which the object type group belongs to.
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to avoid duplications.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
object_type_group ((object_type, list)) – The object type group to transform, which is a tuple of the object type and a sorted list of key groups.
p_input_binding (OCPetriNet.Place) – The input binding place for the object type group construct.
p_output_binding (OCPetriNet.Place) – The output binding place for the object type group construct.
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_output_key_group(activity, places, places_names, transitions, arcs, key_group, p_input_binding, p_output_binding, is_last_key_group, p_input=None)[source]#
Transforms a key group of an output marker group into a construct of places, transitions, and arcs in the OCPN. Places, transitions, and arcs are updated to include the key group.
- Parameters:
activity (str) – The name of the activity which the key group belongs to.
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to avoid duplications.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
key_group ((marker_key, list)) – The key group to transform, which is a tupel of the marker key and a sorted list of markers.
p_input_binding (OCPetriNet.Place) – The input binding place for the key group construct.
p_output_binding (OCPetriNet.Place) – The output binding place for the key group construct.
is_last_key_group (bool) – Indicates if the key group is the last key group of its object type group.
p_input (OCPetriNet.Place, optional) – The input place for case 2 of this construct. Only to be set when recursively calling this function from case 3.
- pm4py.objects.oc_causal_net.variants.to_ocpn.transform_marker(places, places_names, transitions, arcs, marker, p_input, p_output, p_input_binding, p_output_binding, is_output_marker, key_group_length, is_last_key_group, is_first_marker)[source]#
Transforms a marker into a construct of places, transitions, and arcs in the OCPN. Places, transitions, and arcs are updated to include the marker.
- Parameters:
places (set) – Set of places in the OCPN.
places_names (set) – Set of place names in the OCPN to which the place name will be added.
transitions (set) – Set of transitions in the OCPN.
arcs (set) – Set of arcs in the OCPN.
marker (Marker) – The marker to transform.
p_input (OCPetriNet.Place) – The input place for the marker construct.
p_output (OCPetriNet.Place) – The output place for the marker construct.
p_input_binding (OCPetriNet.Place) – The input binding place for the marker construct.
p_output_binding (OCPetriNet.Place) – The output binding place for the marker construct.
is_output_marker (bool) – True if the marker is part of an output marker group, False if it is part of an input marker group.
key_group_length (int) – The length of the key group to which the marker belongs. Does not matter for input markers.
is_last_key_group (bool) – Indicates if the marker is in the last key group of its object type group. Does not matter for input markers.
is_first_marker (bool) – Indicates if the marker is the first marker in its input object type group. Does not matter for output markers.
- pm4py.objects.oc_causal_net.variants.to_ocpn.add_arc(arc, arcs)[source]#
Adds an arc to the OCPN and its source and target.
- Parameters:
arc (OCPetriNet.Arc) – The arc to add to the OCPN.
arcs (set) – Set of arcs in the OCPN to which the arc will be added.
- pm4py.objects.oc_causal_net.variants.to_ocpn.add_place(place, places, places_names) Place[source]#
Adds a place to the OCPN and its name to the set of place names. Does not add the place if a place with the same name already exists in the OCPN. Returns the place if it was added, otherwise returns the existing place.
- Parameters:
place (OCPetriNet.Place) – The place to add to the OCPN.
places (set) – Set of places in the OCPN to which the place will be added.
places_names (set) – Set of place names in the OCPN to which the place name will be added.
- Returns:
The place that was added or the existing place if it was not added.
- Return type:
- pm4py.objects.oc_causal_net.variants.to_ocpn.label_activity_place(activity_name, is_input, object_type)[source]#
Returns the name for an input / output place of an activity.
- Parameters:
activity_name (str) – The name of the activity.
is_input (bool) – Indicates if the place is an input place (True) or an output place (False).
object_type (str) – The object type of the activity.
- Returns:
The name of the place.
- Return type:
- pm4py.objects.oc_causal_net.variants.to_ocpn.label_arc_place(source, target, object_type)[source]#
Returns the name for the place corresponding to an arc between two activities.
- Parameters:
source (str) – The name of the source activity.
target (str) – The name of the target activity.
object_type (str) – The object type of the arc.