====== Context-Aware Tuples for The Ambient ======
Under construction!!
Context-aware Tuples is a novel tuple space approach which augments the concept of a tuple with a context-rule to support the development of context-aware applications in a mobile environment.
===== Motivation =====
In tuple space approaches to context-aware mobile systems, the notion of context is defined by the presence or absence of certain tuples in the tuple space. Existing approaches define such presence either by collocation of devices holding the tuples or by replication of those tuples across all devices. However, this representation can lead to an erroneous perception of context. The former ties the perception of context to network connectivity which does not always yield the expected result. The latter causes context to be perceived even if a device has left that context a long time ago. The main reason for this is that the ability to read a tuple from the environment does not give any guarantees that the context information carried by the tuple is appropriate for the reader. This forces programmers to manually verify that a tuple is valid for the application’s context situation after the tuple is read. This manual verification leads to the violation of a large number of software engineering principles.
===== Our Approach =====
Context-aware tuples provides an alternative approach that keeps the sim- plicity of the tuple space model where interactions and context information are defined by means of tuples, while allowing tuples themselves to determine the context in which a receiving application should be in order to perceive a tuple.
A context-aware tuple has an associated predicated called a context rule that determines when the receiving application is in the right context to perceive the tuple. Only when a tuple’s context rule can be satisfied by the context of the receiving application, the tuple can be perceived by the application. Applications can also be notified when the tuple can no longer be perceived.
===== Context-Aware Tuples API =====
^ Operation ^ Description ^
| Tuple Creation |Tuple( Type, Field1, ..., FieldN) |
^ Non Blocking Operations ||
| Read Tuple | Rdp( ) |
| Read Tuples | Rdg( ) |
| Tuple Insertion | inject: inContext: timeout: |
| Tuple insertion | Out( ) |
^ Reactions on Tuples (Context Information) ||
| Tuple appearance | when: [template] read: [listener] outOfContext: [listener];|
| Tuple removal | when: [template] in: [listener] outOfContext: [listener];|
| For all appearance | whenever: [template] read: [listener] outOfContext: [listener]; |
| For all removal | whenever: [template] in: [listener] outOfContext: [listener]; |
===== Context-Aware Tuples Example =====
Consider a company building where each room is equipped with devices that act as context providers of different kinds of information. For example, information to help visitors to orient themselves in the building or information about the meeting schedule in a certain room. Employees and visitors are equipped with mobile devices which they use to plan meetings or to find their way through the building. Since each room is equipped with a context provider, a user located in one room will receive context information from a range of context providers.
Programming such application where the context information is spread based on connectivity would lead to people far outside of the meeting room to perceive that they are located in the meeting room (the range of wireless connection doesn't stop at the boundaries of the room). Here we show how context aware tuples help the programmer in implementing this application such that the context consumers will receive correct context information.
==== Context Provider ====
The context provider in the context-aware tuple model is this device which injects tuples into the ambient. These tuples can potentially be read by collocated devices (if the context rule is satisfied). The code below shows the code in order to set up the context-aware tuple system and inject a tuple.
In this case the tuple has type inRoom and one field "MeetingRoom". Being able to read this tuple will indicate that the reader is currently located in the meeting room.
In order to make sure that only those devices which are located in the meeting room can read this tuple the injected tuple has a context rule attached. This rule indicates that the reader of the tuple has to have a tuple in his local tuple space of type location and the field ?loc has to be within the boundaries of the roomArea. It is only when these conditions are satisfied that a context consumer will be able to read the tuple.
def cat := makeCatSystem();
cat.inject: Tuple(inRoom, "MeetingRoom") inContext:
[Tuple(location , ?loc), WithinBoundary(roomArea , ?loc)];
==== Context Consumer ====
Because the context provider specifies the rules in order to read its tuples the code for the context consumer is very easy.
The context consumer only has to read a tuple of type inRoom and register a listener for when such a tuple is read. In this case the listener will simply print that the user is currently in a particular room. The programmer can also react on the disappearance of a tuple by registering an outOfContext listener. In this case the listener will simply print that the user has move out of the room.
def cat := makeCatSystem();
cat.whenever: Tuple(inRoom , ?name) read: {
display("You are in room " + name);
} outOfContext: {
display("You moved out of room " + name);
};
===== Further Reading =====
**Context-Aware Tuples for the Ambient**, C. Scholliers, E. Gonzalez Boix, W. De Meuter, T. D'Hondt. In Proceeding of
the 12th International Symposium on Distributed Objects, Middleware, and Applications (DOA'10), LNCS. Springer Verlang, October 2010. ([[ http://prog.vub.ac.be/Publications/2010/vub-tr-soft-10-19.pdf | pdf]])