User Tools

Site Tools


contextawaretuples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
contextawaretuples [2010/10/20 16:44]
cfscholl
contextawaretuples [2010/10/20 17:48] (current)
cfscholl
Line 27: Line 27:
 | Tuple insertion | Out( <tuple> ) | | Tuple insertion | Out( <tuple> ) |
 ^    Reactions on Tuples (Context Information)  || ^    Reactions on Tuples (Context Information)  ||
-| Tuple appearance | when: [template] read: [closure]  outOfContext: [closure];| +| Tuple appearance | when: [template] read: [listener]  outOfContext: [listener];| 
-| Tuple removal | when: [template] in: [closure] outOfContext: [closure];| +| Tuple removal | when: [template] in: [listener] outOfContext: [listener];| 
-| For all appearance | whenever: [template] read: [closure] outOfContext: [closure]; | +| For all appearance | whenever: [template] read: [listener] outOfContext: [listener]; | 
-| For all removal | whenever: [template] in: [closure] outOfContext: [closure]; |+| 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. 
 + 
 +<code> 
 +def cat := makeCatSystem(); 
 +cat.inject: Tuple(inRoom, "MeetingRoom") inContext: 
 +[Tuple(location , ?loc), WithinBoundary(roomArea , ?loc)]; 
 +</code> 
 + 
 +==== 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. 
 + 
 +<code> 
 +def cat := makeCatSystem(); 
 +cat.whenever: Tuple(inRoom , ?name) read: {  
 +     display("You are in room " + name); 
 +} outOfContext: {  
 +     display("You moved out of room " + name); 
 +}; 
 +</code>
  
 ===== Further Reading ===== ===== Further Reading =====
  
 **Context-Aware Tuples for the Ambient**, C. Scholliers, E. Gonzalez Boix, W. De Meuter, T. D'Hondt. In Proceeding of **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. Srpinger Verlang, October 2010. ([[ http://prog.vub.ac.be/Publications/2010/vub-tr-soft-10-19.pdf | pdf]])+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]])
contextawaretuples.1287585860.txt.gz · Last modified: 2010/10/20 16:45 (external edit)