An infrastructure for contextawareness based on first order

An infrastructure for context-awareness based on first order logic Ubiquitous Software Lab Oh Min Kyoung 2006 -06 -02

Contents l l Context Model Protocols for obtaining context Context infrastructure Specify application

Context Model l The basic structure - Context Predicate Operations on contexts What is the context of a smart space?

Context Model – Context Predicate l l l First-order predicate Name of predicate is the type of context → Simple & uniform context representation Context-Type(<Subject>, <Verb>, <Object>) l Location(chris, entering, room 3231) l Temperature(room 3231, “=“, 98 F) l Sister(venus, serena) l Stock. Quote(msft, “>”, $60) l Printer. Status(srgalw 1 printer queue, is, empty) l Time(New York, “<“, 12: 00 01/01/01)

Context Model – Context Predicate l Structure of predicate : using ontology l l DAML+OIL Argument values are constrained by context type → type checking l Location § § § l 1 st argument : “person” or “object” 2 nd argument : “entering” or “leaving” or “in” 3 rd argument : “location” No restriction on the types of argument values → argument can be complex structure l 3 rd argument of Location § § String representing the room Complex structure containing x, y, z coordinates of the person

Context Model - Operations l Boolean operations → construct complex context expressions l Conjunction l l Disjunction l l Environment. Lighting(Room 3234, Off) ∨ Environment. Lighting(Room 3234, Dim) Negation l l Location(Manuel, Entering, Room 3221) ∧ Social. Activity(Room 3221, Meeting) NOT Location(Manuel, In, Room 3221) Quantifier l Existential Quantifier (i. e. “there exists”) l l ∃Location y Location(Chris, In y) Universal Quantifier (i. e. “for all”) l ∀People x Location(x, In, Room 3231)

Context Model - Operations l Quantifier Evaluation l Domain define : set of values (& sets is finite) → Evaluation of expressions with quantifier will always terminate l Location set : all valid locations in our system § l Room 3221, hallway … Stock set : all stock that system is interested in § IBM, MSFT, SUNW … l Arguments can be function l ∃Person s Location(s, Entering, current. Room()) l Deriving new contexts from other contexts l Sound(Room 3234, “>”, 40 d. B) ∧ Lighting(Room 3234, Stroboscopic) ∧ #People(Room 3234, “>”, 6) => Social. Activity(Room 3234, Party)

Context Model – Aggregate context l Aggregate context of smart space → predicate expression set that are true in the smart space l Context Provider l l Smart space has various sensors These sensors l provide contextual information l generate first order expressions that are true at that point of time l are called Context Provider

Context Model – Aggregate context l Set of true context expressions in a smart room at some point in time l Location Context Provider l l Room. Environment Context Provider l l l Temperature(Room 2401, =, 68) Lighting(Room 2401, Is, Dim) Applications Context Provider l l l Location(Manuel, In, Room 2401) Location(Chris, In, Room 2401) Location(Roy, Entering, Room 2401) Application(Power. Point, Is, Running) Application(MP 3 Player, Is, Running) Activity Context Provider (deduction) l Social Activity(Room 2401, Lecture)

Protocols l l Query-Answer protocol Subscribe-Notify protocol

Protocols for obtaining context l Protocols l Applications can use to obtain interesting context l Using XML l Query-Answer protocol l To obtain and understand current context l Similar to Prolog query l Location(X, In, room 3231) l Subscribe-Notify protocol l To perform certain actions when context changes l Using CORBA event mechanism l Context Provider sends context event in its own event channel l Context Consumers can listen on there channels

Context infrastructure l l l Context Provider Context Consumer Context Provider Lookup Service l l Context History Context Synthesisers l l Rule-based synthesisers Synthesisers that learn

Context infrastructure

Context infrastructure l Context Provider l l l Represent using a context expression Send context events on an event channel Provide query interface (Prolog syntax) Evaluation of queries is semi-decidable & safe Use XSB reasoning engine for evaluating Prolog queries Context Consumers (or Context-Aware Applications) l l Consume various types of contexts Adapt their behaviour depending on the current context

Context infrastructure l Context Provider Lookup Service l l Search for different context providers Providers advertise context expressions it provides Consumers query context expression it needs Context history l l It is possible to store all context events using persistent event channels in a database along with a timestamp We use past context information to learn rules about user and application behaviour through data mining

Context infrastructure Context Synthesisers l l l Infer higher-level contexts based on simpler contexts Context Provider & Context Consumer l process 1. Get source context 2. Sort them 3. generate new context l approach l Using rules l Using machine learning

Context infrastructure Rule-based synthesisers l l l Have pre-defined rules for deducing higher-level context If multiple rules are active at the same time, resolve conflict using priority-based mechanism In such case, may deduce the wrong context No flexible & can’t adapt to changing circumstances Synthesisers that learn l l Use Na Bayes algorithm for predicting user mood 1. Train the learner using past context 2. ask user mood periodically 3. Find features 4. Predict the mood

Specify application l l Specifying context-sensitive behaviour for applications Optimizing context expression evaluation Initializing and updating the poset Resolving conflicts

Specify application l Specifying context-sensitive behaviour for applications l Make a configuration file l l l Specify a certain method to be called at a certain context Each context is associated with a priority level Implements the methods

Specify application l Optimizing context expression evaluation l l All rules have to be re-evaluated whenever context changes → O(n) time , inefficient Thus, develop mechanism to reduce evaluations whenever context changes l Organize poset(partially ordered set) data structure l If there are Exp 1, Exp 2 and Exp 1 => Exp 2, then Exp 1 node is a child of Exp 2 node l If any node is false, then its descendents will also be false l Traverse top-down l Poset extends vertically allows greater optimization l Poset extends horizontally allows less optimization

Specify application l Initializing and updating the poset l Initializing l When application starts up, it queries Context Providers § § l get the initial set of true context expressions traverse the poset some nodes to true Invoke the methods associated with these true nodes Updating l Application listen to the event channels l When it receives any context update event, then it updates its poset l And the application executes the methods of those nodes that just became true

Specify application l Resolving conflicts l l Since multiple nodes can become true at the same time, there may be conflicts in actions Handle these conflict using priority-based mechanism l l Higher priority win If it’s same, randomly choose

Example : jukebox application
- Slides: 23