An infrastructure for context-awareness based on first order logic Ubiquitous Software Lab Oh Min...

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

Transcript of An infrastructure for context-awareness based on first order logic Ubiquitous Software Lab Oh Min...

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

An infrastructure for context-awareness

based on first order logic

Ubiquitous Software LabOh Min Kyoung2006-06-02

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

Contents

Context Model Protocols for obtaining context Context infrastructure Specify application

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

Context Model

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

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

Context Model – Context Predicate

Context Predicate First-order predicate Name of predicate is the type of context

→ Simple & uniform context representation Context-Type(<Subject>, <Verb>, <Object>)

Location(chris, entering, room3231) Temperature(room3231, “=“, 98F) Sister(venus, serena) StockQuote(msft, “>”, $60) PrinterStatus(srgalw1 printer queue, is, empty) Time(New York, “<“, 12:00 01/01/01)

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

Context Model – Context Predicate

Structure of predicate : using ontology DAML+OIL Argument values are constrained by context type

→ type checking Location

1st argument : “person” or “object” 2nd argument : “entering” or “leaving” or “in” 3rd argument : “location”

No restriction on the types of argument values→ argument can be complex structure 3rd argument of Location

String representing the room Complex structure containing x,y,z coordinates of the person

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

Context Model - Operations Boolean operations

→ construct complex context expressions Conjunction

Location(Manuel, Entering, Room 3221) ∧ SocialActivity(Room 3221, Meeting)

Disjunction EnvironmentLighting(Room 3234, Off) ∨ EnvironmentLighting(Room 3

234, Dim) Negation

NOT Location(Manuel, In, Room 3221)

Quantifier Existential Quantifier (i.e. “there exists”)

∃Location y Location(Chris, In y) Universal Quantifier (i.e. “for all”)

∀People x Location(x, In, Room 3231)

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

Context Model - Operations Quantifier Evaluation

Domain define : set of values (& sets is finite)→ Evaluation of expressions with quantifier will always terminate Location set : all valid locations in our system

Room 3221, hallway … Stock set : all stock that system is interested in

IBM, MSFT, SUNW …

Arguments can be function ∃Person s Location(s, Entering, currentRoom())

Deriving new contexts from other contexts Sound(Room 3234, “>”, 40dB) ∧

Lighting(Room 3234, Stroboscopic) ∧ #People(Room 3234, “>”, 6) => SocialActivity(Room 3234, Party)

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

Context Model – Aggregate context

Aggregate context of smart space→ predicate expression set that are true in the smart space

Context Provider Smart space has various sensors These sensors

provide contextual information generate first order expressions that are true at that

point of time are called Context Provider

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

Context Model – Aggregate context Set of true context expressions in a smart room at some point in t

ime

Location Context Provider Location(Manuel, In, Room 2401) Location(Chris, In, Room 2401) Location(Roy, Entering, Room 2401)

RoomEnvironment Context Provider Temperature(Room 2401, =, 68) Lighting(Room 2401, Is, Dim)

Applications Context Provider Application(PowerPoint, Is, Running) Application(MP3 Player, Is, Running)

Activity Context Provider (deduction) Social Activity(Room 2401, Lecture)

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

Protocols

Query-Answer protocol Subscribe-Notify protocol

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

Protocols for obtaining context Protocols

Applications can use to obtain interesting context Using XML

Query-Answer protocol To obtain and understand current context Similar to Prolog query Location(X, In, room 3231)

Subscribe-Notify protocol To perform certain actions when context changes Using CORBA event mechanism Context Provider sends context event in its own event channel Context Consumers can listen on there channels

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

Context infrastructure

Context Provider Context

Consumer Context Provider

Lookup Service

Context History Context Synthesisers

Rule-based synthesisers Synthesisers that learn

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

Context infrastructure

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

Context infrastructure

Context Provider 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) Consume various types of contexts Adapt their behaviour depending on the current context

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

Context infrastructure

Context Provider Lookup Service Search for different context providers Providers advertise context expressions it provides Consumers query context expression it needs

Context history It is possible to store all context events using persistent even

t channels in a database along with a timestamp We use past context information to learn rules about user an

d application behaviour through data mining

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

Context infrastructure Context Synthesisers

Infer higher-level contexts based on simpler contexts Context Provider & Context Consumer

process1. Get source context2. Sort them3. generate new context

approach Using rules Using machine learning

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

Context infrastructure Rule-based synthesisers

Have pre-defined rules for deducing higher-level context If multiple rules are active at the same time, resolve conflic

t using priority-based mechanism In such case, may deduce the wrong context No flexible & can’t adapt to changing circumstances

Synthesisers that learn Use Na Bayes algorithm for predicting user mood

1. Train the learner using past context 2. ask user mood periodically3. Find features4. Predict the mood

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

Specify application

Specifying context-sensitive behaviour for applications

Optimizing context expression evaluation Initializing and updating the poset Resolving conflicts

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

Specify application

Specifying context-sensitive behaviour for applications Make a configuration file

Specify a certain method to be called at a certain context

Each context is associated with a priority level Implements the methods

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

Specify application Optimizing context expression evaluation

All rules have to be re-evaluated whenever context changes→ O(n) time , inefficient

Thus, develop mechanism to reduce evaluations whenever context changes Organize poset(partially ordered set) data structure If there are Exp1, Exp2 and Exp1 => Exp2,

then Exp1 node is a child of Exp2 node If any node is false, then its descendents will also be false Traverse top-down Poset extends vertically allows greater optimization Poset extends horizontally allows less optimization

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

Specify application

Initializing and updating the poset Initializing

When application starts up, it queries Context Providers get the initial set of true context expressions traverse the poset set some nodes to true Invoke the methods associated with these true nodes

Updating Application listen to the event channels When it receives any context update event, then it updates its

poset And the application executes the methods of those nodes that

just became true

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

Specify application

Resolving conflicts Since multiple nodes can become true at

the same time, there may be conflicts in actions

Handle these conflict using priority-based mechanism Higher priority win If it’s same, randomly choose

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

Example : jukebox application