# Semi-Automated Approach for Building Event Logs for Process Mining from Relational Database
## 3 Materials and Methods
### Construction of the Event Log
#### 3.2.2 Attribute Extraction  
The activity's objective is to create a mapping between the columns of the relational database with the attributes defined for the event log, using the knowledge generated in the previous activities. This activity is performed of several tasks that allow the definition of correlation between the parts for constructing the event log.  
**Case correlation.**: It refers to searching and selecting an identifier for the cases that will be extracted from the database. This identifier will be linked to the _IdCase_ from the event log. An _IdCase_ refers to a single instance of the process. The case correlation task is defined by specifying the table \(TbCase\subset schema.\)\(tables(DB)\) and the columns \(TbNCase\in schema.columns(TbCase)\) that store data to extract the case identifier attribute (\(IdCase\gets TbNCase\)). In the structure of an event log, all _cases_ are derived from the _process_ (IdProcess), which represents the root of the event log.
**Event correlation.**: In this task will define the unique identifier for each event generated by the business process's execution. It is necessary to identify the table \(TbIdEvent\in schema.tables(DB)\) and the column \(TbNIdEvent\in schema.columns(TbIdEvent)\) that allows us to obtain the identifier of the event \(e\) (\(IdEvent\gets TbNIdEvent\)). Each event in the event log must refer to a case. Furthermore, the events are related to some activity.
**Activity correlation.**: In this task, the columns that store the name of activities (for example, register a sales order, evaluate a discount request, or reject a purchase order) executed within the business process flow will be selected. It is necessary to identify the tables \(TbActivityC\subset schema.tables(DB)\), relations \(ER(DB)\) and the columns \(TbNAtivityC\in schema.columns(TbActivityC)\) that allow obtaining the name of the activities carried out by a resource within a valid behavior for a business process participant, which will be rendered by the activity (\(a\)) name attribute in the event \(e\) (\(concept:name\gets TbNAtivityC\)). The value of the activity name column will be mapped to the _concept:name_ attribute of the event log.
**TimeStamp correlation.**: This task is composed of a rule to build the _timestamp_ attribute, where the table \(TbTimeS\in schema.tables(DB)\) and the column \(TbNTimeS\in schema.columns(TbTimeS)\mid type(TbNTimeS)=time:stamp\), allowing to know the date and time of the execution of the _event_\(e\) (\(time:stamp\gets TbNTimeS\)), allowing to calculate the time consumed in the business process execution at the case level.
**Resource correlation.**: This task links the column that contains information on users, services, or systems with the capacity to execute user, service, manual, business rule, or script type tasks (defined as atomic activities in the BPMN language) with the resource attribute of the event log. Then, we must identify the table \(TbResource\subset schema.tables(DB)\) and its columns \(TbNResource\subset schema.columns(TbResource)\) that contain the name of the user, system, or web service that executed each _activity_\(a\) (\(resource\gets TbNResource\)).
**Input/Output object correlation.**: The tables and their columns containing data from input or output objects (for example, business documents) exchanged by the business process participants through tasks or intermediate events of sending or receiving messages (in the case of inter-organizational business processes) are specified. Then, the tables \(TbDataOI\subset schema.tables(DB)\) and their columns \(TbNDataOI\subset schema.columns(TbDataOI)\) are specified with data from the message exchange containing input/output objects from the event set \(e\subset E\) (\(input/output\_data\gets TbNDataOI\)).