Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Calculus of Context-aware Ambients(CCA)
How to program: Context-expressions
Dr. François Siewe
Software Technology Research Laboratory (STRL)De Montfort University
Leicester, [email protected] / [email protected]
http://www.cse.dmu.ac.uk/~fsiewe/
September 2017
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Outline
1 Context Model
2 Context Expressions
3 Context-aware Processes
4 Structure of a ccaPL Program
5 Translating CCA process into ccaPL program
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Introduction
This lecture presentsthe underlying structure for representing the contexts ofCCA processes.a spatial modal logic for expressing properties ofcontexts. A formula in this logic is called ContextExpression. Context expressions are used to specifycontext-aware processes.how to specify context-aware processes in ccaPL.the general structure of a ccaPL program.other formalisms for modelling context-aware systems.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
What is Context?
Dey (1993):Context is any information that can be used tocharacterise the situation of an entity. An entityis a person, place, or object that is consideredrelevant to the interaction between a user and anapplication, including the user and applicationsthemselves.
Important aspects of context include:user locationwho the user is withnearby people or resourcesuser preferences
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Model
In CCA, a process is described as a hierarchy of nestedambients.So, the context of each individual (sub-)processcorrespond to the surrounding of that process in thehierarchy.This is obtained by replacing the process by a ‘hole’ in thehierarchy.A hole is represented by the symbol � and can be thoughtof as a place holder.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Examples of Context (cont’d)
Bob is carrying a mobile device (phone) is represented bythe process
bob[phone[P] | Q]
where P and Q are processes.The context of the mobile device carried by Bob is:
bob[� | Q]
Graphically it looks like this:
bob
� | Q
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Examples of Context (cont’d)
Context of a mobile device carried by Bob at theconference room:
conf [bob[� | Q] | R]
where Q and R are processes.Graphically it looks like this:
confbob
� | Q R
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Examples of Context (cont’d)
Context of a smart device carried by Bob who is with Aliceat conference, Alice carrying a pda:
conf [bob[� | Q] | alice[pda[R] | S] | T]
Graphically it looks like this:
conf
bob
� | Q
alicepda
RS T
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Model: Syntax
In CCA, a context is described by the following syntax:
C ::= Context0 nil� holen[C] locationC | P parallel compositionnew n C restriction
where the symbol C stands for context (environment), n rangesover names and P ranges over processes.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Model: Syntax (cont’d)
The context 0 is the empty context, also called the nilcontext. It contains no context information.The position of a process in that process’ context isdenoted by the symbol �. This is a special context calledthe hole context.The context new n C means that the scope of the name n islimited to the context C.The context n[C] means that the internal environment ofthe ambient n is described by the context C.The context C | P says that the process P runs in parallelwith the context C.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Model: Exercise
Consider the following process:
confbob
phone
PQ
alicepda
RS T
What is the context of the ambient phone in that process?What is the context of the ambient alice in that process?What is the context of the process T in that process?
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Syntax of Context Expressions
Context expressions are described by the following language:
κ ::= Context Expressionstrue truen = m name matchthis holenot κ negationκ1 | κ2 parallel compositionκ1 and κ2 conjunctionκ1 or κ2 disjunctionn[κ] locationnext κ spatial next modalitysomewhere κ somewhere modality
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expression (true)
true holds for all contexts.
Exampletrue holds for the following contexts:
�n[�]0send().0� | n[send().0]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expression (n = m)
n = m holds for a context if the names n and m are lexically identical.
Example
2 = 2 evaluates to true for all contexts.
n = n evaluates to true for all contexts.
2 = 3 evaluates to false for all contexts.
alice = bob evaluates to false for all contexts.
In addition to the match operator ‘=’, the following predicates can be used:
‘<’: less than; e.g. n < m
‘<=’: less than or equal ; e.g. n <= m
‘>’: greater than; e.g. n > m
‘>=’: greater than or equal; e.g. n >= m
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (this)
this holds solely for the hole context �.
Examplethis holds for the context �this does not hold for the context phone[�]this does not hold for the contextbob[phone[�] | pda[R] | Q]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (n[κ])
n[κ] holds for a context if that context is of the form n[C] suchthat κ holds for the context C.
Example
phone[this] holds for the context phone[�]phone[true] holds for the context phone[�]bob[phone[this]] holds for the context bob[phone[�]]pda[this] does not hold for the context phone[�]phone[this] does not hold for the context �
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (κ1 | κ2)
κ1 | κ2 holds for a context C if that context is of the formC = C1 | C2 such that κ1 holds for C1 and κ2 holds for C2.
Example
this | true holds for the context � | pda[R]
phone[this] | pda[true] holds for the context phone[�] | pda[R]
phone[this] | true holds for the context phone[�] | pda[R]
bob[phone[this] | pda[true] | true] holds for the contextbob[phone[�] | pda[R] | Q]
bob[true | pda[true] | true] holds for the contextbob[phone[�] | pda[R] | Q]
this | phone[true] does not hold for the context � | pda[R]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (κ1 and κ2)
κ1 and κ2 holds for a context if κ1 holds for that context and κ2also holds for that context.
Example
phone[this] and phone[true] holds for the context phone[�]bob[phone[this] | true] and bob[true] holds for the contextbob[phone[�] | R]phone[this] and phone[true] does not hold for the context phone[0]
bob[phone[this] | true] and bob[true] does not hold for the contextbob[pda[�] | R]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (κ1 or κ2)
κ1 or κ2 holds for a context if κ1 holds for that context or κ2holds for that context.
Example
phone[this] or phone[true] holds for the context phone[�]bob[phone[this] | true] or bob[true] holds for the contextbob[phone[�] | R]phone[this] or phone[true] holds for the context phone[0]
bob[phone[this] | true] or bob[true] holds for the contextbob[pda[�] | R]phone[this] or phone[true] holds for the context �bob[phone[this] | true] or bob[true] holds for the contextalice[phone[�] | R]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (next κ)
next κ holds for a context C if that context is of the formC = n[C′] and κ holds for C′.The operator next is called the spatial next modality.
Example
next this holds for the context phone[�]next (phone[true] | this) holds for the context bob[phone[R] | �]next (true | this) holds for the context bob[phone[R] | �]next ((next true) | this) holds for the context bob[phone[R] | �]next this dose not hold for the context bob[phone[R] | �]next this does not hold for the context bob[phone[�]]next next this holds for the context bob[phone[�]]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expression (somewhere κ)
somewhere κ holds for a context if there exists somewhere inthat context a sub-context for which κ holds.
Example
somewhere this holds for the context �somewhere this holds for the context phone[�]somewhere this holds for the context bob[phone[�] | R]somewhere this holds for the context conf [bob[phone[�] | R] | Q]
somewhere this does not hold for the context 0
somewhere this does not hold for the context phone[0]
somewhere this does not hold for the context conf [bob[phone[0]]]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expression (somewhere κ)
The context expression (somewhere κ) holds if the contextexpression κ holds at any level of the ambient hierarchy.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expression (not κ)
not κ holds for a context if κ does not hold for that context.
Example
not this holds for the context phone[�]not next true holds for the context �not this does not hold for the context �not next true does not hold for the context phone[�]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Formalising Common Context Predicates in CCA
Context expressions (CEs) are commonly used inside anambient, in the form:
λ[κ?M.P | Q]
whereκ is a CEM is a capability, andP and Q are processes.
We say that λ is the ambient evaluating the contextexpression κ.In the following slides, we assume that CEs are used inthis form, i.e. inside some ambient that we refer to as λ.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Predicate has
has(n) holds if the ambient λ evaluating the expression has no parent andcontains an ambient named n:
has(n) = next (this | n[true] | true)
Note that the ambient λ evaluating the CE has needs to be a top-level ambient:
has(pda) holds for the context bob[� | pda[0]].
has(pda) does not hold for the context conf [bob[� | pda[0]]].
If λ is nested inside another ambient, the CE has cannot hold but next has can:
next has(pda) holds for the context conf [bob[� | pda[0]]].
With the somewhere modality somewhere , the actual location of λ does notmatter:
somewhere has(pda) holds for the context bob[� | pda[0]].
somewhere has(pda) holds for the context conf [bob[� | pda[0]]].
somewhere has(pda) holds for the context building[conf [bob[� | pda[0]]]].
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Predicat at
at(n) holds for a context if the ambient λ evaluating theexpression is located in a root ambient named n:
at(n) = n[next (this | true)] | true
Example
at(conf ) holds for the context conf [bob[� | pda[0]]].somewhere at(conf ) holds for the contextbuilding[recept[0] | conf [bob[� | pda[0]]]].
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Predicate with
with(n) holds for a context if λ and n are both roots in thatcontext:
with(n) = n[true] | next (this | true)
Example
with(alice) holds for the context alice[0] | bob[� | pda[0]].at(conf ) ∧ next with(alice) holds for the contextconf [alice[0] | bob[� | pda[0]]].
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Predicate at2
at2(n,m) holds for a context if the ambient m is located at aroot ambient named n in that context:
at2(n,m) = n[m[true] | true] | true
Example
at2(conf , alice) holds for the contextconf [alice[0] | bob[� | pda[0]]].at2(conf , bob) holds for the contextconf [alice[0] | bob[� | pda[0]]]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
The Predicate with2
with2(n,m) holds for a context if the ambients n and m are allroot ambients in that context:
with2(n,m) = n[true] | m[true] | true
Example
with2(alice, bob) holds for the contextalice[0] | bob[� | pda[0]].next with2(alce, bob) holds for the contextconf [alice[0] | bob[� | pda[0]]].
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Other Predicates
More predicates can be found in [1].You can define your own predicates in a similar manner.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context-aware Processes
A context-aware process is a process that contains a processof one of the forms
<κ>M.P Context-guarded prefixif <κ1>M1.P1 . . . <κ`>M`.P` fi Selectionfind y : κ for P Search
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context-guarded Prefix (<κ>M.P)
<κ>M.Pwaits until the environment satisfies the context expressionκ, then performs the capability M and continues like theprocess P.A process <κj>Mj.Pj is enabled in a context if thecondition κ holds and the capability Mj can be executed inthat context.We write M.P in place of <true>M.P.
Example
<at(conf )>send(hello).0<with(bob)>bob :: send(hello).0<somewhere at(conf )>send(hello).0<x = 2>send(hello).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Selection (if . . .fi)
if<κ1>M1.P1<κ2>M2.P2. . .<κ`>M`.P`
fi
waits until one of the branches, j say, becomes enabled(i.e. can be executed) and proceeds like <κj>Mj.Pj
if many branches are enabled at the same time, one ofthem is chosen non-deterministically and executed.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Selection (if . . .fi) – Examples
ExampleDeterministic choiceif<x = 2>send(x).0<not (x = 2)>send(3).0
fi
Non-deterministic choiceif<true>send(1).0<true>send(2).0<true>send(3).0<true>send(4).0
fi
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Search (find y : κ for P)
find y1, . . . , yn : κ for Psearches for a list of names z1, . . . , zn such that theenvironment satisfies the context expressionκ{y1 ← z1, . . . , yn ← zn} and continuesthen likeP{y1 ← z1, . . . , yn ← zn}.
ExampleFind current location
find y : somewhere at(y) for send(y).0
Find a neighbor and say hello
find y : somewhere with(y) for y :: send(hello).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Structure of a Program
BEGIN_DECLS
// Definitions of context-expressions go here.// Also, the execution directives are specified here.
END_DECLS
//Body of the prgram goes here.// The body of program is a process.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Example of Program
BEGIN_DECLS
def isHello(n) = {n = hello}
END_DECLS
send(hello).recv(ack).0| recv(x).<isHello(x)>send(thanks).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Example of Program with execution directives
BEGIN_DECLS// Declaration of context expressionsdef has(n) = { this | n[true] | true}def isHello(n) = {n = hello}
// Declaration of execution directivesmode randomdisplay codedisplay congruence
END_DECLS// main processsend(hello).recv(ack).0| recv(x).<isHello(x)>send(thanks).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Example of Program without definitions nor directives
BEGIN_DECLS
END_DECLSsend(hello).recv(ack).0| recv(x).<x = hello>send(thanks).0
OR JUST:
send(hello).recv(ack).0| recv(x).<x = hello>send(thanks).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Declaration Section
begins with the keyword BEGIN_DECLS, all in capitalends with the keyword END_DECLS, all in capitalthis section is optionaleach declaration has the for:
def f (x1, . . . , xn) = {κ}
where:def is a keywordf is the name of the function being declaredx1, . . . , xn is a finite list of formal parameters; can be emptyκ is a normalised context expression
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Example of Declarations
BEGIN_DECLSdef has(n) = { next (this | n[true] | true) }def at(n) = { n[next(this | true)] | true }def with(n) = { n[true] | next (this | true) }def at2(n,m) = { n[m[true] | true] | true}def with2(n,m) = { n[true] | m[true] | true }def AT(n) = { somewhere (n[next(this | true)] | true) }def WITH(n) = { somewhere (n[true] | next (this | true)) }
END_DECLS
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Execution Directives
Two execution modes are implemented which insure fairexecution of concurrent processes.
mode randomFor each reduction, the pair of process to be reduced ischosen randomly (with uniform distribution) among all theprocesses that are willing to execute.mode interleavingFor each reduction, the pair of process to be reduced ischosen based on two criteria:
how long the pair has been willing to execute (first-in,first-out), andin case of conflict, the sequential order as they appear inthe program text is used.
The default mode is interleaving.Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Execution Directives (cont’d)
The directive display controls the output of process execution.display codeDisplay the program code (except comments) after eachreduction.display congruenceDisplay in addition to reduction steps (denoted by -->), thecongruence steps (denoted by <-->).By default code and congruence are not displayed inoutput.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Body and Comments
The body of a program is a single processA multiline comment is enclosed between “/*” and “*/”A single line comment follows “//”A single line comment must end with a new line or acarriage returnFinally, the ccaPL parser is CASE SENSITIVE, i.e. “hello”and “Hello” are treated as different messages, for example.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Example of Program with comments
/* this is a multi-line comments, i.e.a comment that expands across many lines.
*/BEGIN_DECLS // this section is optional
def has(n) = { this | n[true] | true}def at(n) = {n[next (this | true)] | true}
END_DECLS//put here the body of the programn[find x:next has(x) for x#send(hello).x#recv(y).0
| m[ <somewhere at(n)>n@recv(x).<x=hello>@send(thanks).0 ]
]
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Understanding Execution Output
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Understanding Execution Output (cont’d)
The symbol ‘<-->’ corresponds to the structuralcongruence relation as formally defined in [1]‘-->’ represents the reduction relation (see [1])The explanation of each transition is given between a pairof curly brackets.The notation ‘A ==X==> B’ means that an ambient ‘A’ hassent a message ‘X’ to another ambient ‘B’.Other notations such as ‘Child to parent’ and‘Sibling to sibling’ provide information about therelationship between the sender ‘A’ and the receiver ‘B’.the notation {binding: n -> IN1} corresponds to theexecution of the operator find and means that the nameIN1 has been found for n....
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Error Messages
Programs are first parsed for syntax errors and thenexecuted if no error is detected.When an error is detected, the parser displays an errormessage then terminates. Error messages have thefollowing form:CCA Parser Version 3.0 : Reading from file prg2.cca . . .CCA Parser Version 3.0 : Encountered errors during parse.ParseException: Encountered " <NAME> "y "" at line 8, column 3.Was expecting one of:
"def" ..."END_DECLS" ..."display" ..."mode" ...
Note that line number and column at which the erroroccurs are given, as well as a list of expected tokens.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Generating the Execution Graphs
The simulator ccaPL (version 4.02 or higher) also displaysthe execution output graphically in the form of a diagram, whichenables the user to visualise the concurrent behaviours of thesystem.Two types of graphs can be produced:
a communication graph depicting message passingbetween ambients;a behaviour graph showing both the movements ofambients and the communications between them.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Generating the Execution Graphs (Cont’d)
Communication graph Behaviour graph
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Generating the Execution Graphs (Cont’d)
The top row in both diagrams lists the names of theambients involved in the system being executed.The vertical dashed line represents the timeline for eachambients (time increases from top to bottom).A solid directed line from the timeline of an ambient B tothat of an ambient C indicates a message passing from theambient B to the ambient C at a specific time point, withthe content of the message carried as a label to that line.A behaviour graph provides additional information aboutthe mobility of ambients. A box labelled as “X - -> Y” on thetimeline of an ambient B indicates that the ambient B hasmoved from location X to location Y.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Generating the Execution Graphs (Cont’d)
Download and install the graph visualisation software“dot.exe” from http://www.graphviz.org/.To generate only the communication graph, use thecommand:
java -jar ccaPL.jar -g myprog.cca
The generated graph is stored in the file myprog.jpg.To generate both the communication graph and thebehaviour graph, use the command:
java -jar ccaPL.jar -gx myprog.cca
The generated graphs are stored in the file myprog_0.jpgand myprog_1.jpg respectively.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Processes (P, Q)
CCA Process ccaPL Program Description0 0 inactivityn[P] n[P] ambient(νn) P new n P restrictionP|Q P|Q composition!P !P replicationκ?M.P <κ>M.P context-guarded capabilityx . (y).P proc x(y) P process abstraction x{P} {P} bracketsfind y : κ for P find y : κ for P searchif if selectionκ1?M1.P1 <κ1>M1.P1
. . . . . .κ`?M`.P` <κ`>M`.P`
fi fi
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Processes (P, Q)
CCA 0 n[P] (νn) P P|Q !P κ?M.P x . (y).P {P}ccaPL 0 n[P] new n P P|Q !P <κ>M.P proc x(y) P {P}
Example
CCA ccaPL(νn) {n[0] | in n.out.0} new n {n[0] | in n.out.0}
!out.(n = m)?in m.0 !out.<n = m>in m.0
create . (x, y).{x[0] | y[0]} proc create(x,y) {x[0] | y[0]}
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Capabilities (M)
CCA ccaPL DescriptionM ::= in n in n move into the ambient n
out out move outdel n del n delete the ambient nα x<z> α x(z) call to the process abstraction xα (y) α recv(y) receive list of messages z from αα <z> α send(z) send list of messages z to α
Example
CCA ccaPL<n>.0 | (x).x[0] send(n).0 | recv(x).x[0]!has(n)?del n.0 !< has(n)>del n.0out.create〈n,m〉.0 out.create(n,m).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Locations (α)
CCA ccaPL Descriptionα ::= ↑ @ any parent
n ↑ n@ parent n↓ # any childn↓ n# child n:: :: any siblingn :: n :: sibling nε ε locally
Example
CCA ccaPL:: <n>.0 | m ↑(x).x[0] :: send(n).0 | m@recv(x).x[0]
↑(x, y).↓create〈x, y〉.0 @recv(x, y).#create(x, y).0
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Context Expressions (κ)
CCA ccaPL Descriptionκ ::= true true true
n = m n = m name match• this hole¬κ not κ negationκ1 | κ2 κ1 | κ2 parallel compositionκ1 ∨ κ2 κ1 or κ2 disjunctionκ1 ∧ κ2 κ1 and κ2 conjunction⊕κ next κ spatial next modalityGκ somewhere κ somewhere modality
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Other Related Process Calculi
π-calculus (Milner et al., 1992)Milner(1992). A calculus of mobile processes. Informationand Computation 100 (100): 1–40http://en.wikipedia.org/wiki/Pi-calculus
Ambient Calculus (Cardelli & Gordon, 2000)Cardelli, L., Gordon, A. (2000). Mobile Ambients.Theoretical Computer Science 240, 1777–213.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Other Related Process Calculi (cont’d)
Bigraphs (Milner, 2006)Milner, R. (2006). Pure bigraphs: structure and dynamics.Information and Computation 204(1):60–122.http://www.itu.dk/research/pls/wiki/index.php/A_Brief_Introduction_To_Bigraphs
Calculus for Context-Awareness (Zimmer 2005, Bucur2008)
Zimmer, P. (2005). A Calculus for Context-awareness.Tech. Rep., BRICS.Bucur, D. Nielsen, M. (2008). Secure Data Flow in aCalculus for Context Awareness. Lecture Notes inComputer Science Vol. 5065. Springer, PP. 439–456.
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
Summary
1 Context Model
2 Context Expressions
3 Context-aware Processes
4 Structure of a ccaPL Program
5 Translating CCA process into ccaPL program
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Context ModelContext Expressions
Context-aware ProcessesStructure of a ccaPL Program
Translating CCA process into ccaPL program
References
F. Siewe (2016). Towards the Modelling of Secure Pervasive Computing Systems: A Paradigm of
Context-Aware Secure Action System. Journal of Parallel and Distributed Computing (Elsevier), 87.
F. Siewe and H. Yang (2016). Privacy Protection by Typing in Ubiquitous Computing Systems. Journal of
Systems and Software (Elsevier), 120, 133-153.
F. Siewe, et al. (2016). Analysing Use Case Diagrams in a Calculus of Context-aware Ambients.
International Journal of Intelligent Computing Research, Infonomics Society, 7(1), 655-662.
M. Al-Sammarraie, F. Siewe and H. Zedan (2011). Formal Specification of an Intelligent Message
Notification Service in Infostation-based mLearning System using CCA. In Proceedings of CCIT’11.
M. Al-Sammarraie, F. Siewe and H. Zedan (2010). Formalising Policies of a mLearning System using CCA.
In Proceedings of CASEMANS 2010, Copehagen, Danmark.
F. Siewe, H. Zedan and A. Cau (2010). The Calculus of Context-aware Ambients. Journal of Computer and
Systems Sciences (Elsevier), 77(4), 597-620.
F. Siewe, A. Cau and H. Zedan (2009). CCA: a Calculus of Context-aware Ambients. In the proceeding of
the IEEE 23rd International Conference on Advanced Information Networking and Applications (AINA-09).
Dr. François Siewe The Calculus of Context-aware Ambients (CCA)
Top Related