pm4py.objects.ocpn.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.ocpn.semantics.OCPetriNetSemantics[source]#

Bases: Generic[N]

classmethod is_enabled(pn: N, transition: T, marking: OCMarking) → bool[source]#

Checks whether a given transition is enabled in a given object-centric Petri net and marking. A transition is enabled if every non-variable arc has at least one object in the corresponding place, and at least one arc can consume a token.

Parameters:
  • net – object-centric Petri net

  • transition – transition to check

  • marking – marking to check

Returns:

true if enabled, false otherwise

Return type:

bool

classmethod is_binding_enabled(pn: N, transition: T, marking: OCMarking, objects: Dict[str, Set]) → bool[source]#

Checks whether a given binding is enabled for a transition in a given object-centric Petri net and marking.

Parameters:
  • pn – object-centric Petri net

  • transition – transition to check

  • marking – marking to check

  • objects – dict of objects per object type, e.g., {“order”: {“order1”, “order2”}}

Returns:

true if binding is enabled, false otherwise

Return type:

bool

classmethod check_and_fire(pn: N, transition: T, marking: OCMarking, objects: Dict[str, Set]) → OCMarking[source]#

Checks if a transition is enabled and fires it with the given set of objects. If the transition is not enabled, it returns None.

Parameters:
  • pn – object-centric Petri net

  • transition – transition to fire

  • marking – marking to use

  • objects – dict of objects per object type, e.g., {“order”: {“order1”, “order2”}}

Returns:

New marking after firing the transition or None if the transition was not enabled.

Return type:

OCMarking or None

classmethod fire(pn: N, transition: T, marking: OCMarking, objects: Dict[str, Set]) → OCMarking[source]#

Execute a transition for a given set of objects per object type For performance reasons, this function does not check if the transition is enabled or binding passed set of objects is valid, i.e., this should be performed by the invoking algorithm (if needed). Hence, markings can become negative.

Parameters:
  • pn – object-centric Petri net

  • transition – transition to execute

  • marking – marking to use

  • objects – dict of objects per object type, e.g., {“order”: {“order1”, “order2”}}

Returns:

newly reached marking

Return type:

OCMarking

classmethod replay(ocpn: N, trace, initial_marking=None, final_marking=None)[source]#

Replays a trace on the object-centric Petri net. Starts with the initial marking and check if the trace reaches the final marking.

Parameters:
  • ocpn (N) – The object-centric Petri net to replay on.

  • trace (tuple) – A trace from the object-centric Petri net, represented as a tuple of (transition_name, {object_type: set(object_ids)}) tuples.

  • initial_marking (OCMarking, optional) – The initial marking to start the replay from. If None, the initial marking of the ocpn is used.

  • final_marking (OCMarking, optional) – The final marking to check after the replay. If None, the final marking of the ocpn is used.

classmethod enabled_transitions(pn: N, marking: OCMarking) → Set[T][source]#

Returns the enabled transitions in a given object-centric Petri net and marking

Parameters:
  • net – object-centric Petri net

  • marking – marking to check

Returns:

Set of enabled transitions

Return type:

Set[T]

classmethod get_possible_bindings(pn: N, transition: T, marking: OCMarking) → Iterator[Dict[str, Set]][source]#

Returns an Iterator on the possible bindings for a given transition in a given object-centric Petri net and marking.

Parameters:
  • net – object-centric Petri net

  • transition – transition to check

  • marking – marking to check

Returns:

Iterator on all possible bindings (key is object type, value is a set of objects)

Return type:

Iterator[Dict[str, Set]]