Process Mining Objects in Expression Language

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search

QPR ProcessAnalyzer expression language is an object oriented language. This page lists all object types, and properties and functions that they have.

In the tables in this page, after the property or function name there is the type of the returned object in parenthesis. Asterisk (*) after the type means that the return value is an array of objects (multiple objects instead of one).

AttributeType

AttributeType properties Description
CalculationExpression (String) Expression used to calculate values for a calculated attribute. Value is null if attribute ValueOrigin is Imported.
Id (Integer) AttributeType Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
EventLog (EventLog) EventLog where the attribute belongs to.
Name (String) Attribute name.
ValueOrigin (String) Describes where the attribute values are coming from. Either of the following:
  • Calculated: Attribute values are calculated during the model loading using an expression.
  • Imported: Attribute values are imported to QPR ProcessAnalyzer, e.g. read from the ODBC data source.
Values (String Array) Returns an array of all unique values for this AttributeType.
AttributeType functions Parameters Description
EventsHavingValue (Event*)
  • Value to use for matching (Object)

Returns all Events that have the given value for this AttributeType. If the AttributeType is a case attribute, then all the returned events belong to a Case that has the specified value as the value of this case attribute. If the AttributeType is an event attribute, then all the returned Events have the specified value as the value of this event attribute.

Examples:

eventLog.EventAttributes.Where(Name=="SAP_User").EventsHavingValue("James")
Returns: An array of events that have "James" as the value of "SAP_User" event attribute.

eventLog.EventAttributes:EventsHavingValue("James")
Returns: A hierarchical array of event attributes with each having a sub array of events that have "James" as the value of the parent event attribute.

eventLog.CaseAttributes.Where(Name=="Region").EventsHavingValue("Dallas")
Returns: An array of events that have "Dallas" as the value of their case's "Region" case attribute.

eventLog.CaseAttributes:EventsHavingValue("Dallas")
Returns: A hierarchical array of case attributes with each having a sub array of events that have "Dallas" as the value of the parent case attribute of their case.
CasesHavingValue (Case*)
  • Value to use for matching (Object)

Returns all Cases that have given value for this attribute. If the AttributeType is a case attribute, then all the returned Cases have the specified value as the value of this case attribute. If the AttributeType is an event attribute, then all the returned Cases have at least one Event that has the specified value as the value of this event attribute.

Examples:

eventLog.EventAttributes.Where(Name=="SAP_User").CasesHavingValue("James")
Returns: An array of cases that have at least one event which has "James" as the value of "SAP_User" event attribute.

eventLog.EventAttributes:CasesHavingValue("James")
Returns: A hierarchical array of event attributes with each having a sub array of cases that have at least one event which has "James" as the value of the parent event attribute.

eventLog.CaseAttributes.Where(Name=="Region").CasesHavingValue("Dallas")
Returns: An array of cases that have "Dallas" as the value of "Region" case attribute.

eventLog.CaseAttributes:CasesHavingValue("Dallas")
Returns: A hierarchical array of case attributes with each having a sub array of cases that have "Dallas" as the value of the parent case attribute.

Case

A case is a single execution instance of a process. A case consist of Events. Case can have CaseAttributes storing additional information of that case. A Case doesn't need to have Events in QPR ProcessAnalyzer.

Case properties Description
Duration (TimeSpan) Case duration, i.e. duration between Case start and Case end time. Case duration is zero for Cases having only one Event.
EndTime (DateTime) Case end time, i.e. timestamp of the last Event.
EventLog (EventLog) EventLog where the Case belongs to.
Events (Event*) All events in the Case in temporal order by event timestamp.
FirstEvent (Event) The first Event in the Case in temporal order. Better performing shortcut for Events[0].
FlowOccurrences (FlowOccurrence*) All FlowOccurrences in the Case.
Flows (Flow*) All Flows the Case goes through.
Id (Integer) Case Id. Case id is generated by QPR ProcessAnalyzer when the model is loaded.
LastEvent (Event) The last Event in the Case in temporal order. Better performing shortcut for Events[Count(_) - 1].
Name (String) Case name. The case name comes from the source data when data is imported to QPR ProcessAnalyzer.
StartTime (DateTime) Case start time, i.e. timestamp of the first Event.
Variation (Variation) Variation the Case belongs to.
Case functions Parameters Description
AnalyzeConformance
  1. ConformanceModel
  2. Parameters

Checks whether the Case conforms with given DesignModel and reports a list of violations if the case doesn't conform. The function returns an array where the first item is the nonconformance reason as an integer. Next items in the array depends on the reasons, and thus there may be none or several further items in the array.

The parameters are an optional key-value pairs containing additional settings for the conformance checking (see: allowed settings).

Examples:

Let("myConformanceModel", DesignModelFromXml(xml));
Let("myEventLog", EventLogById(1));
Let("cases", OrderBy(EventLogById(1).Cases, Name));
cases.(
  Let("analysis",AnalyzeConformance(myConformanceModel)),
  ""
  +(CountTop(analysis)==0)
  +((CountTop(analysis)>0)
    ? " ("
      +StringJoin("",
        ReplaceLeafValues(
          analysis,
          "i",
          i[0]==3?i[2]+"->"+i[3]:(i[0]==2?"DNF":"")))
      +")"
    :"")
  +": "+StringJoin("->",Events.Type.Name))

Returns: A report containing a line for each case (in filter having id 1) showing whether the Case conforms with the model (in xml variable) or not and if not, gives some information on why the conformance check failed for that case.
Attribute (Object)
  • attribute name (string)
Returns case attribute value for a case attribute provided as a parameter. This function must be used when there are spaces in the case attribute name. If there are no spaces, syntax .attributeName can be used.

If the case attribute is not found, en error is given.

DurationBetweenEvents (Timespan)
  1. Starting event (String, String*, EventType or EventType*)
  2. Ending event (String, String*, EventType or EventType*)
  3. Starting event occurrence index (Integer)
  4. Ending event occurrence index (Integer)

Returns duration between two specified events in the Case. Returns null, if the duration cannot be calculated in the following situations:

  • Starting or ending event doesn't occur in the Case
  • Ending event occurs before the starting event
  • Starting or ending event doesn't occur the defined occurrence index number of times

Several EventTypes for the starting and ending event can also be defined. Then the first occurred event is chosen if the occurrence index is positive, and the last occurred event is chosen, if the occurrence index is negative.

When the 3. and 4. parameters are not defined, the first occurrence of the starting event is chosen and the last occurrence of the ending event.

Parameters:

  1. Starting event: Starting event name to calculate the duration. This parameter can also be given as an EventType object, and both can also be given as an array to define several types of events.
  2. Ending event: Ending event name or EventType object to calculate the duration. This parameter can also be given as an EventType object, and both can also be given as an array to define several types of events. Default value is same as the starting event
  3. Starting event occurrence index (default 0): Specifies which event occurrence to choose if the Case has multiple occurrences of the specified event. First occurence is 0, the second is 1 and so on. The last occurence is -1 and the second from the end is -2. Default value is 0.
  4. Ending event occurrence index (default -1): Same logic as in the Starting event order number parameter. Default value is -1.
EventLogById(1).Cases[0].DurationBetweenEvents("Order confirmation", "Product returned");
Returns: Duration between the first "Order confirmation" and last "Product returned".

EventLogById(1).Cases[0].DurationBetweenEvents("Order confirmation", "Product returned", 0, 0);
Returns: Duration between the first "Order confirmation" and first "Product returned".

EventLogById(1).Cases[0].DurationBetweenEvents(["Order confirmation", "Order received"], "Product returned");
Returns: Duration between the first "Order confirmation" or "Order received" (which one occurs first) and last "Product returned".

EventLogById(1).Cases[0].DurationBetweenEvents("Order confirmation", "Order confirmation", 0, 1);
Returns: Duration between the first and second "Order confirmation".

EventLogById(1).Cases[0].DurationBetweenEvents("Order confirmation");
Returns: Duration between the first and last "Order confirmation".
EventCountByType (Integer)
  • EventType object(s) or EventType name(s) (string or array)

Returns the number of Events in the Case, that are of given type(s). Can be either EventType object, a string identifying the name of the event type, or an array of EventType objects and event type name strings.

Examples:

EventLogById(1).EventCountByType("Invoice")
Returns: Number of "Invoice" type of events in the event log with filter id = 1

EventLogById(1).EventCountByType(EventLog.EventTypes.Where(Name=="Invoice"))
Returns: Number of "Invoice" type of events in the event log with filter id = 1

EventLogById(1).EventCountByType(["Invoice", "Shipment"])
Returns: Number of "Invoice" and "Shipment" type of events in the event log with filter id = 1

EventLogById(1).EventCountByType(EventLog.EventTypes.Where(Name=="Invoice" || Name=="Shipment"))
Returns: Number of "Invoice" and "Shipment" type of events in the event log with filter id = 1
EventsByType (Event*)
  • EventType object(s) or EventType name(s) (string or array)

Returns all Events in the Case which are of given type(s). The parameter can be either an EventType object or EventType name as a string. The parameter can also be an array of multiple EventType objects or EventType names.

Examples:

case.EventsByType("Invoice")
Returns: Array of events having event type named "Invoice".

case.EventsByType((EventLog.EventTypes.Where(Name=="Invoice"))[0])
Returns: Array of events having event type named "Invoice".

case.EventsByType(["Invoice", "Shipment"])
Returns: Array of events having event type named "Invoice" or "Shipment".

case.EventsByType(EventLog.EventTypes.Where(Name=="Invoice" || Name=="Shipment"))
Returns: Array of events having event type named "Invoice" or "Shipment".
EventTimeStampsByType (DateTime*)
  • EventType object(s) or EventType name(s) (string or array)

Returns timestamps of all Events of given type in the Case.

Example:

case.EventTimeStampsByType("Invoice")

Note: The result is same than (except the first one is faster to calculate):

case.EventsByType("Invoice").Timestamps
FlowOccurrencesByType (FlowOccurrence*)
  • Flow object or id of FlowOccurrence (Integer)

Returns all FlowOccurrences of this case which are of given type. The parameter can be either a Flow object or an integer identifying the id of the flow occurrence.

Examples:

case.FlowOccurrencesByType(EventLog.Flows[0])
Returns: All the flow occurrences in the case belonging to the first flow in event log.

case.FlowOccurrencesByType(EventLog.Flows[0].Id)
Returns: All the flow occurrences in the case belonging to the first flow in event log.
IsConformant (Boolean)
  1. ConformanceModel
  2. Parameters

Checks whether the Case conforms with given ConformanceModel. Returns true if the Case conforms with the given design model.

The parameters are an optional key-value pairs containing additional settings for the conformance checking (see: allowed settings).

Examples:

Let("myConformanceModel", DesignModelFromXml(xml));
Let("myEventlog", EventLogById(1));
Count(myEventlog.Cases.Where(IsConformant(myConformanceModel))) / Count(myEventlog.Cases)

Returns: Proportion of conforming cases in the EventLog created for filter having id 1.

Event

Event properties Description
Case (Case) Case the event belongs to.
EventLog (EventLog) EventLog where the Event belongs to.
Id (Integer) Event id. It's generated by QPR ProcessAnalyzer when the model is loaded.
IndexInCase (Integer) Index number of the Event in the case (in temporal order). The first event has index number 0, the second event has index number 1 and so on.
IncomingFlowOccurrence (FlowOccurrence) Preceding FlowOccurrence of the Event.
Model (Model) Model the event belongs to.
NextInCase (Event) Temporally next event in the case. For the last event, return EMPTY.
OutgoingFlowOccurrence (FlowOccurrence) The following FlowOccurrence of the Event.
PreviousInCase (Event) Temporally previous event in the case. For the first event, return EMPTY.
TimeStamp (DateTime) Timestamp of the Event.
Type (EventType) EventType of the Event.
TypeName (String) Name of the EventType of the Event. Result is the same as with Type.Name, but the TypeName shortcut has better performance.
Event functions Parameters Description
Attribute (object)
  • attribute name (string)
Return event attribute value for an event attribute provided as a parameter. This function must be used when there are spaces in the event attribute name. If there are no spaces, syntax .attributeName can be used.

If the case attribute is not found, en error is given.

EventLog

EventLog is a list of events and information related to them, such as event and case attributes. There are following types of EventLogs:

  • Model EventLog represents all the data within a QPR ProcessAnalyer model
  • Filter EventLog represents data related to a filter in a model
EventLog properties Description
CaseAttributes (AttributeType*) CaseAttributes in the EventLog returned in the alphabetical order. Note that filtering affects which attributes exist in the EventLog.
Cases (Case*) Cases in the EventLog.
CaseCount (Integer) Number of cases in the EventLog.
EventAttributes (AttributeType*) EventAttributes in the EventLog returned in the alphabetical order. Note that filtering affects which attributes exist in the EventLog.
EventCount (Integer) Number of events in the EventLog.
Events (Event*) Events in the EventLog.
EventTypes (EventType*) EventTypes in the EventLog.
FilterEventLog (EventLog) Returns an EventLog representing all the events in the filter (where the current EventLog resides) (for example, if the EventLog has applied selection filters).
Flows (Flow*) Flows that the part of the EventLog.
Id (Integer) EventLog Id.
Model (Model) Model where the EventLog belongs.
ModelEventLog (EventLog) Returns an EventLog representing all the events in the QPR ProcessAnalyzer model (where the current EventLog resides).
Name (String) EventLog name.
Variations (Variation*) Variations that are in the EventLog
EventLog functions Parameters Description
EventsByType (Event*)
  • EventType object or EventType name (string or array)

Returns all Events in the EventLog which are of given type(s). The parameter can be either an EventType object or EventType name as a string. The parameter can also be an array of multiple EventType objects or EventType names.

EventCountByType (Integer)
  • EventType object(s) or EventType name(s) (string or array)

Returns the number of Events belonging to the Case which are of given type(s). Can be either EventType object, a string identifying the name of the event type, or an array of EventType objects and event type name strings.

Examples:

case.EventCountByType("Invoice")
Returns: Number of "Invoice" type of events in the case.

case.EventCountByType(EventLog.EventTypes.Where(Name=="Invoice"))
Returns: Number of "Invoice" type of events in the case.

case.EventCountByType(["Invoice", "Shipment"])
Returns: Number of "Invoice" and "Shipment" type of events in the case.

case.EventCountByType(EventLog.EventTypes.Where(Name=="Invoice" || Name=="Shipment"))
Returns: Number of "Invoice" and "Shipment" type of events in the case.
EventsWindow (Event*)
  1. First index (Integer)
  2. Maximum count (Integer)

Returns a range of events in the EventLog between the provided first index and maximum count. Events are ordered primarily based on cases and secondarily based on event timestamps within the case. If the specified window is partly or completely outside of the actual events, the result will only include those events that fit into the specified window.

Parameters:

  1. First index: Index of the first event to return (indexing starts from 0). If negative, the first index is [total event count] + [first index].
  2. Maximum count: The maximum number of events to return.

Examples:

EventLogById(1).EventsWindow(0, 10)
Returns: 10 first events.

EventLogById(1).EventsWindow(10, 10)
Returns: 10 events starting from event at index 10.

EventLogById(1).EventsWindow(-10, 10)
Returns: 10 last events.
Function Parameters Description
EventLogById

FilterId (Integer)

Returns EventLog object corresponding to the provided filter Id.

EventType

EventTypes are individual activities in processes, i.e. EventTypes are the boxes in the process flowchart.

EventType properties Description
Cases (Case*) Cases that have events of this EventType.
Count (Integer) Number of Events that have this EventType.
EventLog (EventLog) EventLog where the EventType belongs to.
Events (Event*) Events of that EventType.
Id (Integer) EventType Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
IncomingFlows (Flow*) All Flows that start from the EventType.
Name (string) EventType name.
OutgoingFlows (Flow*) All Flows that end to the EventType.
UniqueCount (Integer) Number of Cases having events of this EventType.

Flow

Flow is a combination of two EventTypes where there are FlowOccurrences between them. Unlike FlowOccurrencies, a Flow is not related to a single case. Flowchart shows Flows and EventTypes (not FlowOccurences or Events). In a Case, there may be several FlowOccurrences of a single Flow.

Flow properties Description
AverageDuration (TimeSpan) Returns the average duration of Flow within the EventLog, i.e. average duration of the related FlowOccurrence durations.
Cases (Case*) Cases that contain the flow, i.e. there is a flow occurrence between Flow's starting and ending events.
DurationStandardDeviation (TimeSpan) Returns the standard deviation of the Flow duration within the EventLog, i.e. standard deviation of the related FlowOccurrence durations.
EventLog (EventLog) EventLog where the Flow belongs to.
FlowOccurrences (FlowOccurrence*) Flow occurrences the flow belongs to.
From (EventType) EventType from which this Flow starts. Value is null for starting flows.
Id (Integer) Flow Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
MedianDuration (TimeSpan) Returns the median duration of Flows within the EventLog, i.e. median duration of the related FlowOccurrence durations.
Name (String) Identifying name of the Flow.
To (EventType) EventType to which this Flow ends. Value is null for ending flows.

FlowOccurrence

FlowOccurrence represents a transition from an event to another event in a case. Thus, FlowOccurrence is related to a single case. There is also a FlowOccurrence from the "start" of the case to the first event of the case, and a FlowOccurrence from the last event of the case to the "end" of the case. Corresponding flow is visible in BPMN kind of flowcharts showing separate start and event icons. Thus, there are one more FlowOccurrences in a case than the number of events.

FlowOccurrence properties Description
Case (Case) Case the FlowOccurrence belongs to.
Duration (TimeSpan) Returns the duration of the FlowOccurrence. null is returned if the FlowOccurrence represents Case start or end.
EventLog (EventLog) EventLog where the FlowOccurrence belongs to.
Flow (Flow) Corresponding Flow of the FlowOccurrence.
From (Event) Event from where the FlowOccurrence begins. Value is null for starting flow occurrences.
Id (Integer) FlowOccurrence Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
Name (String) Identifying name of the FlowOccurrence.
OccurrenceIndex (Integer) Occurrence index describes how many times the Flow of the FlowOccurrence has occurred in the case until that point. The first time has occurrence index 0. When a case goes through a certain flow the second time, the occurrence index is 1.
To (Event) Event to where the FlowOccurrence ends. Value is null for ending flow occurrences.

Variation

Variation is unique sequence of events in a case. A case belongs to a single variation.

Variation properties Description
CaseCount (Integer) Number of Cases belonging to the Variation.
Cases (Case*) Cases that belong to the Variation.
EventLog (EventLog) EventLog where the Variation belongs to.
EventTypeCount (Integer) Number of Events in the Variation.
EventTypes (EventType*) EventTypes belonging to the Variation.
Flows (Flow*) Flows that belong to the Variation.
Id (Integer) Variation Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
UniqueEventTypeCount (Integer) Number of different (unique) EventTypes in the Variation.
Variation functions Parameters Description
AnalyzeConformance
  1. ConformanceModel
  2. Parameters

Same as the IsConformant function for Case objects, but the check is done for the Variation.

Example:

Let("cm", DesignModelFromXml(xml));
Let("el", EventLogById(1));
Let("vars", OrderByDescending(EventLogById(1).Variations, CaseCount));
vars.(
  Let("analysis",AnalyzeConformance(cm)),
  ""
  +CaseCount
  +" * "
  +(CountTop(analysis)==0)
  +((CountTop(analysis)>0)
    ? " ("
      +StringJoin("",
        ReplaceLeafValues(
          analysis,
          "i",
          i[0]==3?i[2]+"->"+i[3]:(i[0]==2?"DNF":"")))
      +")"
    :"")
  +": "+StringJoin("->",EventTypes.Name))

Returns: A simple report containing a line for each variation (in filter having id 1) showing also whether the variation conforms with the model (in xml variable) or not and if not, gives some information on why the conformance check failed for that variation.
IsConformant (Boolean)
  1. ConformanceModel
  2. Parameters

Same as the IsConformant function for Case objects, but the check is done for the Variation.

Example:

Let("el", EventLogById(1));
Count(el.Variations.Where(IsConformant(cm))) / Count(el.Variations)

Returns: Proportion of conforming variations in event log created for filter with id 1.