pm4py.objects.dcr package#

Subpackages#

Submodules#

pm4py.objects.dcr.obj module#

This module defines the core components for modelling Declarative Process Models as Dynamic Condition Response (DCR) Graphs.

The module encapsulates the essential elements of DCR Graphs, such as events, relations, markings, and constraints, providing a foundational framework for working with DCR Graphs within PM4Py.

Classes:

Relations: An enumeration of possible relations between events in a DCR Graph. Marking: Represents the state of events in terms of executed, included, and pending. DCR_Graph: Encapsulates the structure and behavior of a DCR Graph, offering methods to query and manipulate it.

The dcr_template dictionary provides a blueprint for initializing new DCR Graphs with default settings.

class pm4py.objects.dcr.obj.Relations(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

I = 'includes'#
E = 'excludes'#
R = 'responses'#
N = 'noresponses'#
C = 'conditions'#
M = 'milestones'#
class pm4py.objects.dcr.obj.TemplateRelations(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

I = 'includesTo'#
E = 'excludesTo'#
R = 'responseTo'#
N = 'noResponseTo'#
C = 'conditionsFor'#
M = 'milestonesFor'#
class pm4py.objects.dcr.obj.Marking(executed, included, pending)[source]#

Bases: object

This class contains the set of all markings M(G), in which it contains three sets: M(G) = executed x included x pending

Attributes#

self.__executed: Set[str]

The set of executed events

self.__included: Set[str]

The set of included events

self.__pending: Set[str]

the set of pending events

Methods#

reset(self, initial_marking) -> None:

Given the initial marking of the DCR Graph, reset the marking, to restart execution of traces

property executed#
property included#
property pending#
reset(initial_marking) None[source]#

Resets the marking of a DCR graph, uses the graphs event to reset included marking

Parameters#

initial_marking

the events in the DCR Graphs

class pm4py.objects.dcr.obj.DcrGraph(template=None)[source]#

Bases: object

The DCR Structure was implemented according to definition 3 in [1]. Follows the idea of DCR graph as a set of tuples G = (E,Act,M,->*,*->,->{+,-},l) G graphs consist of a tuple of the events the activities, the marking of executed, included and pending events, all the relations, and the mapping of events to activities.

References#

Attributes#

self.__events: Set[str]

The set of all events in graph

self.__marking: Marking

the marking of the DCR graph loaded in

self.__labels: Set[str]

The set of activities in Graphs

self.__labelMapping: Dict[str, Set[str]]:

The set of event and their corresponding activity

self.__condiditionsFor: Dict[str, Set[str]]:

attribute containing all the conditions relation between events

self.__responseTo: Dict[str, Set[str]]:

attribute containing all the response relation between events

self.__includesTo: Dict[str, Set[str]]:

attribute containing all the include relations between events

self.__excludesTo: Dict[str, Set[str]]:

attribute containing all the exclude relations between events

Methods#

getEvent(activity) -> str:

returns the event of the associated activity

getActivity(event) -> str:

returns the activity of the given event

getConstraints() -> int:

returns the size of the model based on number of constraints

Parameters#

templatedict, optional

A template dictionary to initialize the distributed and assignments from, if provided.

Examples#

call this module and call the following graph = DCR_graph(dcr_template)

Notes#

  • DCR graph can not be initialized with a partially created template, use DCR_template for easy instantiation

obj_to_template()[source]#
property events: Set[str]#
property marking: Marking#
property labels: Set[str]#
property conditions: Dict[str, Set[str]]#
property responses: Dict[str, Set[str]]#
property includes: Dict[str, Set[str]]#
property excludes: Dict[str, Set[str]]#
property label_map: Dict[str, str]#
get_event(activity: str) str[source]#

Get the event ID of an activity from graph.

Parameters#

activity

the activity of an event

Returns#

event

the event ID of activity

get_activity(event: str) str[source]#

get the activity of an Event

Parameters#

event

event ID

Returns#

activity

the activity of the event

get_constraints() int[source]#
compute constraints in DCR Graph
  • conditions

  • responses

  • includes

  • excludes

Returns#

no

number of constraints

pm4py.objects.dcr.semantics module#

class pm4py.objects.dcr.semantics.DcrSemantics[source]#

Bases: object

the semantics functions implemented is based on the paper by:

Author: Thomas T. Hildebrandt and Raghava Rao Mukkamala, Title: Declarative Event-BasedWorkflow as Distributed Dynamic Condition Response Graphs publisher: Electronic Proceedings in Theoretical Computer Science. EPTCS, Open Publishing Association, 2010, pp. 59–73. doi: 10.4204/EPTCS.69.5.

classmethod is_enabled(event, graph: DcrGraph) bool[source]#

Verify that the given event is enabled for execution in the DCR graph

Parameters#

rtype:

bool

type graph:

DcrGraph

param event:

the instance of event being check for if enabled

param graph:

DCR graph that it check for being enabled

Returns#

return:

true if enabled, false otherwise

classmethod enabled(graph: DcrGraph) Set[str][source]#

Creates a list of enabled events, based on included events and conditions constraints met

Parameters#

type graph:

DcrGraph

param graph:

takes the current state of the DCR

Returns#

param res:

set of enabled activities

classmethod execute(graph: DcrGraph, event)[source]#

Function based on semantics of execution a DCR graph will update the graph according to relations of the executed activity

can extend to allow of execution of milestone activity

Parameters#

type graph:

DcrGraph

param graph:

DCR graph

param event:

the event being executed

Returns#

return:

DCR graph with updated marking

classmethod is_accepting(graph: DcrGraph) bool[source]#

Checks if the graph is accepting, no included events are pending

Parameters#

rtype:

bool

type graph:

DcrGraph

param graph:

DCR Graph

Returns#

return:

True if graph is accepting, false otherwise

Module contents#