This repository contains:
- JSON Schemas and documentation on harmonized datamodels for different Smart Domains, particularly Smart Cities and Smart Agrifood.
- code that allows to expose different harmonized datasets useful for different applications. Such datasets are currently exposed through the FIWARE NGSI version 2 and/or NGSI-LD APIs (query).
This work is aligned with the results of the GSMA IoT Big Data Project. Such project is working on the harmonization of APIs and data models for fueling IoT and Big Data Ecosystems. In fact the FIWARE data models are a superset of the GSMA Data Models.
📚 Documentation |
---|
To support the adoption, we created a short guideline for the usage of data models. If you are using NGSI-LD, you should also check the NGSI-LD HowTo and the NGSI-LD FAQ.
A JSON Schema is provided for every harmonized data model. In the future all the documentation could be generated from a JSON Schema, as it is part of our roadmap. The different JSON Schemas usually depend on common JSON Schema definitions found at the root directory of this repository.
There are different online JSON Schema Validators, for instance: http://jsonschemalint.com/. For the development of these schemas the AJV JSON Schema Validator is being used. For using it just install it through npm:
npm install ajv
npm install ajv-cli
A validate.sh
script is provided for convenience.
Note: JSON Schemas capture the name and data type of each Entity Attribute.
For instance, this means that to test JSON schema examples with a
FIWARE NGSI version 2 or
NGSI-LD
API implementation, you need to use the keyValues
mode (options=keyValues
).
Contributions should come in the form of pull requests.
New data models should be added under a folder structured as follows:
specs/
NewModel/
doc/
spec.md
: A data model description based on the data model template, e.g. spec.md of WeatherObserved.
README.md
: A summary file (as an extract from the spec file), e.g. README.md of WeatherObservedschema.json
: The JSON Schema definition, e.g. schema.json of WeatherObservedexample.json
: One or more JSON example file, e.g. example.json of WeatherObservedexample-normalized.json
: One or more JSON example file in NGSI v2 normalized format, e.g. example-normalized.json of WeatherObservedexample-normalized-ld.jsonld
: One or more JSON example file in NGSI-LD normalized format, e.g. example-normalized-ld.jsonld of WeatherObserved
The name of the folder should match the Entity Type used in the JSON Schema
(e.g. NewModel
). For data models including more entities, a hierarchical
folder should be used. The parent folder can include common JSON schemas shared
among the entities. e.g.:
specs/
NewModel/
doc/
spec.md
README.md
newmodel-schema.json
: the common schema for the different entities.NewModelEntityOne/
doc/
spec.md
README.md
schema.json
example.json
example-normalized.json
example-normalized-ld.jsonld
NewModelEntityTwo/
doc/
spec.md
README.md
schema.json
example.json
example-normalized.json
example-normalized-ld.jsonld
To facilitate contributions and their validation, we developed a tool that is also used for the Continuous Integration of FIWARE Data Models. The FIWARE Data Model validator checks the adherence of each data model to the FIWARE Data Models guidelines.
For using it just install it through npm:
npm install -g fiware-model-validator
More details are available in the validator documentation.
When creating a Pull Request, please ensure the files are properly formatted,
the Husky should do this automatically on
git commit
, but the files can be manually formatted at any time using the
prettier
and prettier:text
commands:
cd validator
npm i
# To format JavaScript files:
npm run prettier
# To format Markdown files:
npm run prettier:text
# To Auto-correct Markdown files:
npm run lint:text
To check for spelling mistakes and dead links in the text within the Data Model, run the text linter as shown:
npm test
See:
- https://gitlab.com/synchronicity-iot/synchronicity-data-models
- schema.org
- https://github.com/GSMADeveloper/NGSI-LD-Entities
- https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD
MIT © 2019 FIWARE Foundation e.V.
All the code in this repository is licensed under the MIT License. However each original data source may have a different license. So before using harmonized data please check carefully each data license.
All the data models documented here are offered under a Creative Commons by Attribution 4.0 License.