The following post has been written by Fermín Galán Márquez, part of the FIWARE technical team in Telefonica R+D. We would like to thank him for his collaboration and his willingness to participate.
Your application dwells in a universe of information. This information is what we call the context of that application.
More specifically, context information is represented by values assigned to attributes that characterize the entities relevant to your application. So, context is about entities and their attributes. For example, if your application is about weather measurement based on sensors deployed in the streets and parks of your city, the entities are the sensors themselves and the attributes are the different weather parameters a sensor may measure (such as temperature, humidity, luminance, atmospheric pressure, etc.) along with other operational parameters (such as the sensor location, battery level, etc.)
Let’s consider another example: a traffic and route planning application. That application may use two different kinds of entities. First, vehicles: cars, buses, trucks, etc., whose basic attributes are speed and location. The second kind of entities could be city places, such as streets, roads, junctions, etc., whose attributes may be location, traffic intensity (e.g. number of vehicles per minute), congestion level, etc.
Taking into account these two cases, we can see two of the main values of context management as design paradigm for applications. First, its simplicity. Everything is about entities and attributes. No complex modeling needed. No complex data relationships or complicated SQL statements to get your data. Modeling your application in terms of entities and attributes is generally easy, as these concepts naturally arise from your application design. Second, its flexibility. Context is a rather generic concept, so it is suited for many applications, no matter whether the application is related to weather measurement, traffic or whatever other domain. As part of this flexibility, take into account that an entity doesn’t necessarily model things in the real world (such as sensors or cars). It can also model things in the virtual world, such as an “alarm” in a trouble ticket system (which doesn’t have any physical representation and only exists within the IT system which manages alarms).
FIWARE provides you with means to produce, gather, publish and consume context information at large scale. Context management as provided by FIWARE introduces two basic actors: context producers and context consumers. Context producers are the sources of context, the ones that create or update context information. A typical case of context producer is a sensor measuring some metrics. On the other side, context consumers are the sinks for context, the ones that receive context information and do something interesting with it. Of course, the particular actions to do depend on the application. For example, it could draw the temperature evolution over time in a chart or provide dress tips to users (“don’t forget your coat, it’s cold out there!”) depending on the weather context in the case of a weather application. Another example could be recommending alternative routes to a driver based on the overall traffic context of the city, in the case of a traffic application.
It is important to note that producer and consumer are independent roles. Although a given application may play both roles at the same time (for example, a smartphone application running in a smartphone that at the same time produces some context information measured by the phone and consumes context coming from other sources), context consumers don’t need to know about producers and vice versa. Some big applications have some parts playing the producer role and others playing the consumer role to provide a global service. For example, a weather application could have two parts: the first one runs in the sensors (context producers) and the second in the users’ smartphones (context consumers) to provide real-time weather information and recommendations.
In the next post, we will talk about Orion Context Broker, which is the piece of software within FIWARE that materializes context management. Orion Context Broker allows context producers and consumers interact in a decoupled way using different communication paradigms (synchronous or asynchronous), implementing some advanced features (such as geo-localization).