Smart Data Models support in Onesait Platform
The availability of widely adopted (de facto standard) information models is key to creating a global digital single market for interoperable and replicable (portable) smart solutions in multiple domains (smart cities, smart agri-food, smart utilities, smart industry, etc.). Such models provide an essential element in the common technical basis needed for open standards-based innovation and public procurement.
Data Models play a crucial role because they define the harmonised representation formats and semantics that applications will use to both consume and publish data. In this 6.1.0-Warcraft version of Onesait Platform we have decided to increase our support for Data Models, and specifically for Smart Data Models.
What are Smart Data Models?
Smart Data Models is a joint collaborative programme to support the adoption of a reference architecture and compatible common data models that underpin a digital marketplace of interoperable and replicable smart solutions.
The FIWARE Foundation, IUDX, TM Forum and OASC are leading a joint collaborative programme to support the adoption of common compatible data models that underpin a digital marketplace of smart, interoperable and replicable solutions across multiple sectors, starting with smart cities. The programme is open to collaboration by both contributing new models, as well as using existing models as they are open.
How are these models supported on the Platform?
Onesait Platform has an agnostic design as far as data models are concerned and therefore has always been able to use any data model, until now, supporting JSON-Schema and JSON-LD as languages for the definition of the models.
The way of working with data models is to define them in the data model management functionality, which allows the administrator to register and categorize Data Models. This way, the rest of the users can use them when defining their entities. Therefore, it allows defining the catalogue of data models that will conform the data model standard of a project.
Taking this to the Smart Data Models, the administrator has the ability to register the models he/she considers appropriate and have them classified as in the following example:
As we said, from this version 6.1.0 onwards, the definitions of Smart Data Models will be added as part of the data models available by default, as was already the case, for example, with the GSMA data models, which are now also part of Smart Data Models. In this way, the administrator does not need to create them in order to make them available to users.
Once a model has been created, its definition can be consulted as shown in the following image:
Finally, it can be used for the creation of new Entities, simply by selecting the data model:
Once the Entity is created, it can be used to insert data and validate that the data complies with the standard. For example, by inserting a valid instance, it is stored correctly:
{
"id": "urn:ngsi-ld:Building:a3b15710-993b-4af9-9a28-bdccdf936948",
"type": "Building",
"dateCreated": "2023-01-26T08:50:56Z",
"dateModified": "2023-01-25T16:09:41Z",
"source": "Import",
"name": "Building",
"alternateName": "Building type 2",
"description": "Building of limited Building types",
"dataProvider": "IFC file"
}
In the case of trying to insert an invalid data, e.g. without a ‘type’ field which is mandatory in the schema we are using as an example, a validation error is produced which clearly indicates the cause of the insertion failure:
The schema validation engine allows the use of references to models defined on the internet. This is very convenient in many cases, but in production environments it is very common for servers not to have access to the internet for security reasons.
In such cases, Onesait Platform has the ability to define a mapping of schema URIs to schema identifiers defined in the data schema management. In this way the validation engine will use the local definition instead of trying to go out to the Internet to get the definition, allowing the use of standard data models in offline environments without having to rewrite references to other data models.
The following image shows some examples of these mappings for models using an Onesait Platform URI, but the mapping can be done for any other URI as well.
Header Image: Nick Fewings at Unsplash.