# A Model Based Framework for IoT-Aware Business Process Management
## 5 Implementation of the IoT-Aware Framework Prototype
In order to be handled by the model transformation engine, the annotations must conform to the EBNF (Extended Backus-Naur Form) formal syntax, as illustrated in [41]. [<<Sensor>> { serviceEndPoint = [[http://utv.testserviceurl.it/sensor1](http://utv.testserviceurl.it/sensor1)]([http://utv.testserviceurl.it/sensor1](http://utv.testserviceurl.it/sensor1)), } ```
* **IoTBPMN-to-eBPMN Model-to-Text Transformation**, which takes as input the IoT-BPMN model and yields as output the eBPMN code that constitutes the Java-based implementation of BP digital twin. It should be underlined that this transformation takes into consideration the performance- and reliability-related properties of the IoT-BPMN model. Therefore, the framework prototype uses the transformation implementation introduced in [41];
* **SysML-to-Sensor Model-To-Text Transformation** which constitutes the core of the proposed approach. This transformation takes as input the annotated SySML model, which represents the structural view of the IoT system, and generates the Java classes implementing the application-specific OSH sensor drivers, along with the relevant data model. In this respect, in order to generate the app-specific sensor drivers, the transformation analyzes the SysML model and, for each class stereotyped as \(*\)_Sensor_*, yields as output the following classes:  
* _Sensor Configuration class_, which provides the attributes to store the parameters that characterize the sensor configuration. If the SysML model specifies the sensor location (i.e., throughout the _position_ attribute provided by \(*\)_Sensor_* or \(*\)_Platform_* stereotypes, the transformation includes such information in the sensor configuration;
* _Sensor Class_, which constitutes the actual implementation of the sensor driver. According to the OSH architecture, it implements the _ISensorModule_ interface. The transformation generates the class skeleton which includes the code to handle the sensor identifiers. The skeleton also includes the appropriate specification and initialization of the methods inherited from the _ISensorModule_ interface for accessing the measured sensor data. A manual refinement is thus required for the complete implementation of the driver;
* _Sensor Output Class_, which provides methods to allow access to measured data. In this respect, the sensor output data structure and the encoding to be adopted are generated according to the structure of the SyML model elements. Specifically, the transformation takes into account those elements stereotyped as \(*\)_ObservableProperties_*, \(*\)_SensorData_*, \(*\)_SensorDataArray_* and \(*\)_CategorySensorData_*. Finally, in order to obtain the implementation of the sensor data model, the transformation generates one separated class for each SysML model element stereotyped as \(*\)_FeatureOfInterest_*. It is worth noting that the related properties are typed according to the SysML model elements annotated with stereotypes that inherit from \(*\)_BaseSensorData_*. The implementation of the _Broker_ consists of various components. As described in Section 4.5, the core of the _Broker_ implementation is represented by the open-source project Open Sensor Hub (OSH), which provides a service-based interface for interacting with IoT devices. The OSH implementation includes a set of _OSH Basic Drivers_ that enact the data exchange with generic devices. The _App-specific Sensor Driver_ component includes the implementation of the various drivers required for interacting with the actual sensors used in the specific application. As stated above, such drivers constitute the output of the SysML-to-Sensor_model-to-text_ transformation. An example is given in Section 6. Similarly, the Java-based implementation of _Sensor Data_ which represents the Broker data model, is dynamically obtained from the structural model of the sensors network by use of the same SysML-to-Sensor_model-to-text_ transformation (see Figure 8 step 5).