Sofia2 IoT Workshop (Part 1/4): Data Model. Ontology. ThinKP

The goal of this workshop is the realization of a real example on wich we can evaluate the capabilities of Sofia2 platform.


To do this, we are going to simulate a building that has several floors, and three devices for the reading of energy consumption, temperature and humidity in each one of them.  Finally, we will create a dashboard to display this information and we will publish data in an API to be consumed in a simple way by any application.


In order to get a better understanding of the workshop, we will structure the steps to follow in 4 posts. We start today with the first part:


  • (Part 1/4) – Data Model. Ontology. ThinKP.

Data Model

The Model


The main support of an IoT Project is its data model.  It must contain all relevant information, both for immediate use and for further analysis of the information.


It is significant that the devices shouldn’t send irrelevant information. This only would generate a higher cost in the communications.


In the generation of a balanced model lies the complexity of the data model design.



On Sofia2, the data model is named Ontology. We can define it in a very superficial way as a JSON schema that will explicitly define the data it will store.


Sofia2 centralized management console has several methods for creating an ontology (graphical editor, text mode, wizard and from data source).




We are going to use the Guided Ontology Creation.




The first thing we have to do is to give a name to our ontology, we will call it WorkshopIoTPTG (WorkshopIoT+our initials).


We set the ontology as active, and the description of our ontology as good practice.




We can ignore the details of BDTR and BDH Configuration and dependency between ontologies, since it has no relevance for this workshop


Now we are going to add the fields of our data model, we will work with a very simple model that will contain the following information:






We set the field ‘Additional Properties’ to false in order to prevent our ontology from containing any other information. Finally, we press the generate ontology button.




In the Scheme section, we will see the definition of the JSON-Schema that defines our ontology and has to comply with all ontology’s instances we use.




If we click the Generate Instance button, it will show us an example of an ontology instance.




Finally, we click the Create button.



Once we have defined the data model, by means of ontologies configuration, we have to create the ThinKP: the logical configuration of the devices that are going to interact with our ontology.


To do this, we access ‘My ThinKPs’ menu and click on the ‘New ThinKP’ button.




We assign a name to our ThinKP, we will call it WorkshopIoTPTG (WorkshopIoT+our initials).




We can give our ThinKP a description. And we must select the ontology we created at point 3. Should be called WorkshopIoTPTG (WorkshopIoT+our initials).




Once given this information, we can click the Create button and we will see the detail screen of ThinKP.




We can always access to our tokens using ‘My Tokens’ tab.




We select the editing icon of our ThinKP (pencil).




Selecting ‘My Tokens’ tab we will see a list with the Tokens that are assigned and the options to activate / deactivate, to unsubscribe and to add new Tokens.




So, reaching this point, we already defined the data domain (so we can store and interchange the data in a specific format), and the logical instance of the devices to be connected to it (our thinkKP).


In the next post we will continue with the second part of the workshop. We will wait for you.

Sofia2 IoT Workshop (Part 1/4): Data Model. Ontology. ThinKP


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s