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 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.
AttributeType properties Description
Id (Integer) AttributeType Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
Name (String) Attribute name.
Values (String Array) Returns an array of all the existing unique values for this AttributeType.

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.
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", ConformanceModelFromXml(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. Case attribute name is provided as a parameter. This function is needed when there are spaces in the case attribute name. If there are no spaces, syntax .attributeName can be used.
EventsByType (Event*)
  • EventType object or EventType name (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".
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", ConformanceModelFromXml(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.

DateTime

DateTime represents a timestamp.

DateTime properties Description
Day (Integer) The day of the calendar month represented by the DateTime. Number between 1 and 31.
Hour (Integer) The hour component of the date represented by the DateTime. Number between 0 and 23.
Millisecond (Integer) The millisecond component of the date represented by the DateTime. Number between 0 and 999.
Minute (Integer) The minute component of the date represented by the DateTime. Number between 0 and 59.
Month (Integer) The calendar month component of the date represented by the DateTime. Number between 1 and 12.
Second (Integer) The second component of the date represented by the DateTime. Number between 0 and 59.
Ticks (Integer) Number of ticks represented by the DateTime. A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond, or 10 million ticks in a second.
Year (Integer) The year component of the date represented by the DateTime. Number between 1 and 9999.
DateTime functions Parameters Description
Round (DateTime)
  • TimeSpan or Integer

Rounds given date time by given TimeSpan or given number of seconds.

Example:

Round to the nearest hour:
Round(DateTime(2017, 1, 1, 14, 48), TimeSpan(0, 1))

DateTime(2017, 1, 2, 3, 4, 5).Round(10)
Returns: DateTime(2017, 1, 2, 3, 4, 10)

DateTime(2017, 1, 2, 3, 4, 5).Round(TimeSpan(1))
Returns: DateTime(2017, 1, 2)
Truncate (DateTime)
  1. Period (String)

Truncates given DateTime value to given precision. Truncating means that the provided DateTime (i.e. timestamp) is converted into a timestamp representing the beginning of the period. For example, if period is year, the Truncate function returns the first date of the year where the input DateTime is belonging. Truncate function is useful e.g. when dimensioning data into different periods.

Supported precision values are: year, quarter, month, week, day, hour, minute and second.

Examples:

DateTime(2018, 5, 14, 3, 4, 5).Truncate("year")
Returns: DateTime(2018)

DateTime(2018, 5, 20, 3, 4, 5).Truncate("quarter")
Returns: DateTime(2018, 4, 1)

DateTime(2019, 8, 14, 3, 4, 5).Truncate("day")
Returns: DateTime(2019, 8, 14)

DateTime(2019, 8, 14, 3, 4, 5).Truncate("hour")
Returns: DateTime(2019, 8, 14, 3)

Event

Event properties Description
Case (Case) Case 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.
IncomingFlowOccurrences (FlowOccurrence*) All FlowOccurrencies that end to this Event.
Model (Model) Model the event belongs to.
NextInCase (Event) Temporally next event in the case. For the last event, return EMPTY.
PreviousInCase (Event) Temporally previous event in the case. For the first event, return EMPTY.
OutgoingFlowOccurrences (FlowOccurrence*) All FlowOccurrencies that start from this Event.
TimeStamp (DateTime) Timestamp of the event.
Type (EvenType) 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. Event attribute name is provided as a parameter. This function is needed when there are spaces in the event attribute name. If there are no spaces, syntax .attributeName can be used.

EventLog

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

  • Model EventLog represents all the data within one model
  • Filter EventLog represents all the data related to one filter of one model
  • Runtime/temporary EventLog is created whenever needed, e.g., when processing filter rules one by one on top of model event log
EventLog properties Description
CaseAttributes (AttributeType*) Used case attribute in the EventLog.
Cases (Case*) Cases that belong to the EventLog.
EventAttributes (AttributeType*) Used event attributes in the EventLog.
Events (Event*) Events that belong to 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)
Returns all Events from this EventLog which are of the given type.

Examples:

eventLog.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".

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.
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.

Expression

Expression is an object type that encapsulates a KPI expression language expression. Expression inside expression object can be evaluated by using the expression object as if it was a function by using <expression object name>(<parameter list>) syntax. Expression objects can be created in the following ways:

  • Using Def function
  • Whenever & prefix is used in Def function for an attribute

Examples:

Def(null, "a", "b", a+b)._(1,2)
Returns: 3

[Def("", "a", "b", a+b), Def("", "a", "b", a*b)].(_(1,2))
Returns: [3, 2]

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, the may be several FlowOccurrences of a single Flow.

Flow properties Description
Cases (Case*) Cases that contain the flow, i.e. there is a flow occurrence between Flow's starting and ending events.
FlowOccurrences (FlowOccurrence*) Flow occurrences the flow belongs to.
From (EventType) EventType from which this Flow starts.
Id (Integer) Flow Id. It's generated by QPR ProcessAnalyzer when the model is loaded.
Name (String) Identifying name of the Flow.
To (EventType) EventType to which this Flow ends.

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.
Flow (Flow) Corresponding Flow of the FlowOccurrence.
From (Event) Event from where the FlowOccurrence begins.
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 transition from that event to the other event has occurred in the case until that point. The first time has number 0.
To (Event) Event to where the FlowOccurrence ends.

Model

Model properties Description
CaseAttributes (AttributeType*) CaseAttributes in the model.
DefaultFilterId (Integer) Default filter id of the model.
EventAttributes (AttributeType*) EventAttributes in the model.
EventLog (EventLog) EventLog representing the whole model. The model EventLog contains all events in the model, i.e. no filters have been applied.
Id (Integer) Model Id. Model Id is generated by QPR ProcessAnalyzer when the model is created.
Name (String) Model name.
Project (Project) Project the model belongs to.

TimeSpan

TimeSpan represents a temporal duration. TimeSpan is not bound to calendar time. Difference between two TimeStamps is TimeSpan. TimeStamp added by TimeSpan is TimeStamp.

TimeSpan properties Description
Ticks (Integer) Number of ticks represented by the TimeSpan. A single tick represents one hundred nanoseconds or one ten-millionth of a second. There are 10,000 ticks in a millisecond, or 10 million ticks in a second.
TotalDays (Float) TimeSpan value in days (one day is 24 hours) (both whole and fractional).
TotalHours (Float) TimeSpan value in hours (both whole and fractional).
TotalMilliseconds (Float) TimeSpan value in milliseconds (both whole and fractional).
TotalMinutes (Float) TimeSpan value in minutes (both whole and fractional).
TotalSeconds (Float) TimeSpan value in seconds (both whole and fractional).

Project

Project properties Description
Id (Integer) Id of the Project. It's generated by QPR ProcessAnalyzer when the model is loaded.
Name (String) Name of the Project.
Models (Model*) Models that are in the Project.

User/Group

User objects represents users and user groups. Note that some properties can only be used for users and some for groups.

User properties Description
Description (String) Description of the user.
Email (String) Email address of the user.
FullName (String) Full name of the user.
GroupMemberNames (String*) Array of names of members of a user group. This property is available for groups.
GroupMembers (User*) Array of members of a user group. This property is available for groups.
GroupNames (String*) Array of names of user groups the user belongs to. This property is available for users.
Groups (User*) Array of user groups the user belongs to. This property is available for users.
Id (String) Id of the user, which is unique for every user.
IsActive (Boolean) Returns true only if the user is active (not disabled).
IsGroup (Boolean) Returns true if the user is a user group.
LogonMessage (String) Returns the logon message of the user.
Name (String) Login name of the user.
Roles (String Array*) Roles of user as string array.

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.
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", ConformanceModelFromXml(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.