SMARTUNIFIER Configuration

Information Models

What Information Models are and how to create them is described in the chapter Information Models.

Information Model - JSON file

Create an Information Model that represents the structure of the JSON-file.

Information Model - File

Structure of the JSON Information Model:

  • Event that represents the trigger for the Mapping

  • Variables under the Event represent the key-value pairs from the JSON-file

JSON - Variables

ID

Node Type

Data Type

FileEvent

Event

FileEventType

FileEvent/equipmentId

Variable

String

FileEvent/orderNr

Variable

String

FileEvent/materialNr

Variable

String

FileEvent/quality

Variable

String

Note

The group function allows you to combine logical entities into paths. You can use existing naming conventions and styles for naming equipment to organize the configuration components. This simplifies the structuring and management of configurations.

Hint

It is recommended to use the same “Group” name throughout the scenario. For example, to identify the created Artifacts for this scenario the group name “demoscenario.json2database” is used.

Information Model - SQL Database

Create an Information Model that represents the structure of the database.

Information Model - Database

Structure of the Database Information Model:

  • Event that represents the table of the database

  • Variables under the Event represent the columns within the table

Database - Variables

ID

Node Type

Data Type

DatabaseInsertEvent

Event

DatabaseInsertEventType

DatabaseInsertEvent/EquipmentId

Variable

String

DatabaseInsertEvent/OrderNr

Variable

String

DatabaseInsertEvent/MaterialNr

Variable

String

DatabaseInsertEvent/Quality

Variable

String

Communication Channels

What Communication Channels are and how to create them is described in the chapter Communication Channels.

Communication Channel - JSON file

In this scenario the JSON-file is processed by the SMARTUNIFIER with the build-in File Consumer.

Create a Communication Channel for the JSON file.

1.) Select the JSON Information Model created previously.

2.) Select File reader (JSON) as Channel Type.

3.) Configuration:

3.1) Select the root node of the Information Model and specify paths to following folders:

  • In

  • Process

  • Out

  • Error

Channel - File

3.2) Select the Event to configure the FileNameFilter

Channel - File

4.) Save the new Communication Channel.

Communication Channel - SQL Database

Create a Communication Channel for the SQL Database.

1.) Select the Database Information Model created previously.

2.) Select SqlDatabase as Channel Type.

3.) Configuration:

3.1) Select the root node of the Information Model and configure the database access.

  • Select SQLServer as Type

  • Enter the JDBC Url according to the selected database - jdbc:sqlserver://192.168.0.111:1433;databaseName=unifier;trustServerCertificate=true

  • Enter the Username and the Password of the database or select it from the Credential Manager.

Channel - Database

3.2) Select the Event node in the Information Model and configure the table settings.

  • Enable the checkbox Insert

  • Enter the name for the Table as well as the Schema

Channel - Database

3.3) Select the Variable node EquipmentId in the Information Model and configure the columns (Repeat this step with the rest of the Variables).

  • Enable the checkbox Assign database column

  • Enter the name for the Column

Channel - Database

4.) Save the new Communication Channel.

Mapping

What Mapping is and how to create it, is described in the chapter Mappings.

1.) Create a new Mapping with the Information Models created previously (JSON and Database).

2.) Create a Rule that handles the assignment of values from the JSON-file to the database.

2.1) Enter a Rule Name.

2.2) Drag and Drop the File Event into the Trigger field.

2.3) Drag and Drop the DatabaseInsertEvent into the actions panel as Target.

2.4) Assign Source to Target: Drag and Drop the Variable equipmentId from the Json model into the according Source field(Repeat for all Variables).

Mapping

3.) Save the new Mapping.

Device Type

Next, assign the Mapping to a new Device Type. What Device Type is and how to create it, is described in the chapter Device Types.

1.) Select the Mapping JsonToDatabase created previously.

2.) Assign the Channels (Database and JSON) to their belonging Information Model.

DeviceType

3.) Save the new Device Type.

Instance

Last step of this Scenario is the creation of the Instance. What Instance is and how to create it, is described in the chapter Communication Instances.

1.) Select the Device Type SUDeviceType created previously.

2.) Change the name of the Instance to SUInstance.

3.) If necessary: Channels configuration can be made.

Instance

4.) Save the new Instance.

Deployment

1.) Create a new Local Deployment.

2.) Select the Instance SUInstance.

3.) Select the Log File Configuration Info (Defines the log level).

Add Deployment

4.) Save the new Deployment.

5.) Deploy and Start the Instance.

Deployment

Execution

In order to insert the data of the JSON-file into the SQL database move the file into the specified InFolder location (Step 3.1 Communication Channel - JSON file - Configuration).