data-models

Data models guidelines

This is a set of guidelines for defining new data models. Further information and a guideline update can be found at D2.2 Synhronicity IoT LSP

Before creating a new data model, explore the existing ones to be sure there is already a data model that covers your use case. The search box in the ReadTheDocs page can help you to search for specification connected to your needs. Recall to use synonyms in your search. E.g. what you might call Public Transport already exists under UrbanMobility.

If you are looking for guidelines on adoption of existing data models, please refer to How to use FIWARE Harmonised Data Models in your projects section.

Syntax

Reuse

Data types

Attribute definition

Units

Relative values

Modelling location

Modelling linked data

Date Attributes

Dynamic attributes

Internationalization (i18N)

There can be certain entity attributes which content is subject to be internationalized. For instance, the description of a Point of Interest. The internationalization (i18N) guidelines for the FIWARE Data Models are defined as follows:

<AttributeName>_<LanguageTag> where AttributeName is the original attribute name and LanguageTag shall be a language tag as mandated by RFC 5646. W3C provides guidelines on how to use language tags.

JSON-LD can facilitate developers to parse internationalized Entity representations, thus Context Data Producers are encouraged to use JSON-LD (provided that the backing implementations support it).

When parsing plain JSON content, developers should validate that the corresponding JSON terms are actually conveying a language variant of an attribute. For instance, by validating that the term’s suffix actually corresponds to a valid language tag and by checking that the corresponding original attribute is contained in the entity.

Example:

An entity may contain an attribute named description. The value of such attribute shall be expressed in American English. Additionally it might exist an attribute named description_es used to convey the value of such a description attribute in Spanish.

Some of the most used attributes

In case of doubt check the existing data models!

Versioning

FIWARE Data Models Project aim to maintain backwards compatibility, however some incompatibilities will inevitably occur over time. Data providers may choose to tag Entities with an additional schemaVersion Attribute so that Data Consumers can behave accordingly. This aligns with the https://schema.org/schemaVersion Property definition.

How to contribute

Contributions should come in the form of pull requests. Fork the repository, Create a branch containing your changes, and proceed with a Pull Request.

Pull Request should be easy to review, so if the model, or the changes you are proposing are wide, please create different pull requests.

New data models should be added under a folder structured as follows:

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 father folder can include common JSON schemas shared among the entities. e.g.: