FI-WARE NGSI Context Management tutorial
From FIWARE Forge Wiki
FI-WARE NGSI Context Management specifications are based in the NGSI Context Management specifications defined by OMA (Open Mobile Alliance). They take the form of a RESTful binding specification of the two interfaces defined in the OMA NGSI Context Management specifications, namely NGSI-9 and NGSI-10 (see FI-WARE NGSI Open RESTful API Specification (PRELIMINARY)). However, FI-WARE NGSI Context Management specifications will not implement those parts of the OMA specs that prove to be useless or unnecessarily complex. Besides, they solve some ambiguities in the OMA specs and extend them when necessary to implement the FI-WARE Vision.
Basic NGSI Context Management Information Model
The central aspect of the NGSI-9/10 information model is the concept of entities. Entities are the virtual representation of all kinds of physical objects in the real world. Examples for physical entities are tables, rooms, or persons. Virtual entities have an identifier and a type. For example, a virtual entity representing a person named “John” could have the identifier “John” and the type “person”.
Any available information about physical entities is expressed in the form of attributes of virtual entities. Attributes have a name and a type as well. For example, the body temperature of John would be represented as an attribute having the name “body_temperature” and the type “temperature”. Values of such attributes are contained in value containers. This kind of container does not only consist of the actual attribute value, but also contains a set of metadata. Metadata is data about data; in in our body temperature example this metadata could represent the time of measurement, the measurement unit, and other information about the attribute value.
There also is a concept of attribute domains in OMA NGSI 9/10. An attribute domain logically groups together a set of attributes. For example, the attribute domain "health_status" could comprise of the attributes "body_temperature" and "blood_pressure".
The interfaces defined in NGSI 10 include operations to exchange information about arbitrary sets of entities and their attribute values, while NGSI-9 consists of functions for exchanging information about the availability of information about entities.
The data structure used for exchanging information about entities is context element. A context element contains information about multiple attributes of one entity. The domain of these attributes can also be specified inside the context element; in this case all provided attribute values have to belong to that domain.
Formally, a context element contains the following information
- an entity id and type
- a list of triplets <attribute name, attribute type, attribute value> holding information about attributes of the entity
- (optionally) the name of an attribute domain
- (optionally) a list of triplets <metadata name, metadata type, metadata value> that apply to all attribute values of the given domain