Spatiotemporal Context Modelling in Pervasive Context-Aware Computing Environment : A Logic Perspective

Pervasive context-aware computing, is one of the topics that received particular attention from researchers. The context, itself is an important notion explored in many works discussing its: acquisition, definition, modelling, reasoning and more. Given the permanent evolution of context-aware systems, context modeling is still a complex task, due to the lack of an adequate, dynamic, formal and relevant context representation. This paper discusses various context modeling approaches and previous logic-based works. It also proposes a preliminary formal spatiotemporal context modelling based on first order logic, derived from the structure of natural languages. Keywords—context modelling; logic; formal; pervasive system; context-aware system


INTRODUCTION
Context-aware computing has had significant attention in diverse areas such as human-computer interaction and mobile computing.The context awareness is also an important concept explored in pervasive systems and ambient intelligence.There are still questions around context: definition, modeling, and reasoning.
The notion of a context in itself is not new, and has been the subject of research in many areas.In linguistics for instance, the context was described as the surrounding text element of the language and can help to determine its meaning.While in artificial intelligence, the context definition is derived from two main approaches: the first is a so-called propositional logical approach offered by McCarthy [1] [2], and Guha [3] which defines the context as the circumstances that could determine the truth value of a term.This approach was formulated as a set of predicates that can process a context to make reasoning and logic deductions.
The second approach is called local reasoning (Local Models Semantics (LMS) / Multi-Background Systems (MCS)) [4] [5].In the LMS / MCS approach, the context is determined by a known set of facts which perform a line of reasoning.The approach provides an incomplete environment description.Thus, the context is partial, inexact and approximate.
However, to design a reliable context-aware system, the context must be well represented and modeled in an appropriate form that allows sharing between different devices in a pervasive system.Using a richer model provides a higher level of abstraction to facilitate adaptation.
As indicated by Henricksen [6], there is usually, a significant difference between the input information and the one which is useful for applications.This difference may be overcome by various types of context information processing.Therefore, modelling is a crucial step in the context treatment.Indeed, modelling includes the analysis and design of contextual information comprised within the system, as an abstract representation at the data-structure level and at the semantics level.
Context-aware applications in pervasive computing environment can adjust their processing to the current context and thus can be easier to use and reliable.Developing systems that allow applications to be context-aware has been subject to extensive research.[7] [8] [9] [10].One of the challenges in this respect, is developing a flexible and expressive context model.On one hand, there is a need for a uniform representation that can span a plethora of possible contexts.On the other hand, the model should be flexible enough to allow performing complex operations on the context.The prupose of this paper, is to show that using a logic model based on spatiotemporal axes, yields a reliable way of dealing with contexts.In this model, first-order predicates are used to represent contexts, thus improving expressiveness and offering means to represent various kinds of contexts.The model supports operations on context like conjunction, disjunction, negation, and quantification.An important advantage of using a formal model is that one can clearly specify the efficiency and expressiveness of the model.A lot of work has been done in the formal methods area of first order logic strength, expressiveness, and decidability.However, most researchers worked on current context and adaptation but not on prediction and anticipate adaptation.This paper develops our vision around context after having redefined in previous work: ``A Spatiotemporal Context Definition for Service Adaptation Prediction in a Pervasive Computing Environment`` [11], we propose actually our method to model contextual information.This paper offers a new model based on first-order logic and spatiotemporal axes.www.ijacsa.thesai.org The rest of the paper is structured as follows: Section II provides an overview of context modelling in the literature.Section III presents our proposed context model based on logic.We will introduce our modelling methodology, and we will show how our model help to get a context model with a high-level abstraction.At the end of section III, we will propose a scenario to demonstrate how we can model a context based in our logic model.Section IV concludes the paper with a discussion, our contributions and presents our future work.

II. RELATED WORK
Context modelling is a fundamental step for the development of context-aware systems.The existence of welldesigned context models will ease the construction of such systems.Context modelling consists of analysis and design of contextual information.This information is contained in the system as an abstract form at the data-structure level as well as the semantic level.Several modelling approaches have been proposed, studied and analyzed in the literature.This section, start by presenting a survey and comparison (Table .1)about different context modelling approaches in general, followed by another overview focused more on the work using a logic based model.In this part, this model is evaluated, contrasting its strength and weakness, leading to the motivation for a new model.

A. Overviews of context modelling approach
Strang et al. [12] surveyed the most relevant approaches for context modelling and compared them to some requirements of ubiquitous computing such as distributed composition, partial validation, quality information richness, incompleteness and ambiguity, formality level and applicability.They concluded that ontology makes the best context description compared to the surveyed methods because it provides a good information sharing with common semantics.However, this does not mean that the other approaches are unsuitable for the ubiquitous computing environment.
Bettini et al. [13] discussed the requirements that context modelling and reasoning techniques should meet.They have selected a set requirement for context models: heterogeneity and mobility, relationships and dependencies, timeliness, imperfection, reasoning, modelling formalisms usability and efficient context provisioning.They did not mention logic based context model: instead, they introduced hybrid approaches as an attempt to combine different formalisms and techniques to improve the identified requirements.Perera et al. [14] surveyed context awareness from an Internet of Things perspective.They discussed high-level context modelling techniques.Their focus was on the conceptual perspective of each modelling technique not on specific implementation.Their discussion was based on the six most popular context modelling methods: key-value, graphical, markup schemes, object-based, logic-based, and ontology-based modelling.In their conclusion, they mentioned that logic-based modelling provides much more expressiveness compared to the other models.However, lack of standardization reduces their reusability and applicability.Most importantly, they concluded that diversifying their modelling techniques is the best way to provide efficient results, which will lessen each other's weaknesses.Therefore, no modelling technique is ideal to be used in a stand alone manner.Most of the previous work has focused on ontology-based context modelling, and less effort has been spent on logicbased context modelling.The following section, focuses on logic-based context modelling approaches.

C. Related work on context modelling approaches logicbased
A logic model provides a formal representation of contextual information.Using a reasoning process or an inference engine, a logic model can deduce new information based on existing rules in the system.
Among the first works using this approach, those by Carthy and Buvac [2] [15], introduced the context as a formal object.They defined simple axioms for events or phenomena with common sense and treated the context associated with a particular situation.They provided basic relationship ist (c, p), which means that the proposition p is true in the context C, defined by formulas such as: C0: ist ( contextof ( Sherlock Holmes stories), Holmes is detective).This model also uses the notion of inheritance [15].
Another early representative of this type of approach is the theory of situations introduced by Akram et al. [16].This approach was inspired by the theory proposed by Barwise et al. [17].They have tried to give theoretical semantics model of natural language in a formal logic system.Akram et al., have subsequently provided an extension to this model.They represented the facts related to a particular context with nonparametric expressions supported by the type of situation that matches the context.
A similar approach proposed by Gray and Salber [18] used the first order logic as a formal representation of context information and their relationships.
Another approach in this same category was used to develop a multimedia system [19].In this system, location taken as a context aspect is expressed as a fact in a rules-based system.The system itself is implemented in Prolog.
Ranganathan et al. [20] proposed a context model based on first order predicate, in the ConChat project.Their context model describes context information properties and structure and the kinds of operations that can be performed on context, e.g.conjunction, disjunction, negation, and quantification.The predicate name is the type of context being described.
It is also possible to have relational operators inside predicates.The predicate form is not general and the meaning and number of the parameters depend on the context element.The context model didn't constrain the types of the value-spaces of the different arguments in the context predicate.So, predicate arguments can be randomly complex structures.Arguments of a context predicates can be functions that return some values.In the second time, the authors used rules to derive new contexts based on existing contexts.Roman et al. [6] presented an experimental middleware infrastructure called Gaia (an Active Space System Software Infrastructure) where they used modeling techniques built on first order logic and Boolean algebra.This allowed them to easily write various rules to describe context information.They represented context through a predicate with an arity of 4, whose structure is borrowed from a simple clause in the English language of the form <subject><verb><object>. An atomic context predicate is defined as follows: Context (<ContextType>, <Subject>, <Relater>, <Object>) e.g.Context (location, Chris, entering, room 3231).
In some cases, one or more elements of a predicate may be empty.It is still possible to construct more complex contexts by performing first order logic operations such as context predicates using: quantification, implication, conjunction, disjunction, and negation.Gu et al. [21] proposed a Service-Oriented Context-Aware Middleware (SOCAM) architecture for the building and rapid prototyping of context-aware services.In their model, contexts are represented as first-order predicate calculus.The basic model had the form of Predicate (subject, value).The context predicates structures are described in an ontology.The ontology is written in OWL as a collection of RDF triples, each statement being in the form (subject, predicate, object).
Other works followed the same approach [8], [22].Nalepa & Bobek [7] proposed a new rule-based context reasoning platform tailored to the needs of intelligent distributed mobile computing devices.They made a comparison of existent context modelling approaches, and they took into consideration the following aspect of context modelling methods: formalization, simplicity, expressiveness, support for inference, uncertainty handling, and existing tools that support design.They also proposed an inference service that uses HeaRT inference engine to provide efficient on-line reasoning for mobile devices.

D. synthesis
Logic based model provides the ability to create complex expressions in first order logic and deduct a high-level context from the basic context (captured) using an approach based on rules.The model defines a base structure to present each object context atomically.Deduction approaches based on a logical modelling offer the most appropriate mechanisms to achieve abstraction information; it will be more specified later in section III.1.
In spite of the formal high level of logic, less effort has been spent on logic based context modelling and most previous 1) The context predicates are not generic enough, and their components are not fixed and vary according to the predicate usage.2) Predicates components do not cover all aspects of the context because they are not based on a clear and concise context definition.This limits their usage to some specific applications and negatively affects the expressiveness.Therefore, the approach proposed in this paper, follows a logic model that solves these weaknesses.Based on the natural language and our context definition [11], focusing on spatiotemporal parameters and the contextual information usage which promotes proactive adaptation: current or anticipatory based on future context prediction.We have demonstrated that space and time are an important context information in many context-aware applications [11].Most definition mentions a space as vital factor, e.g., the most frequently used by Dey [9].
As described in section II.2, many research works used the logical approach for its high level of formality, its abstraction benefits, effectiveness and its support for logical reasoning, except these works neglected the time aspect.
Given that contextual information is better defined with the spatiotemporal axes [11], the proposed model integrates these parameters.This will allow a better description of the space service context and thus a more expressive context reasoning and a more efficient adaptation.

III. PROPOSED MODELLING APPROACH
The logic based models are usually used in context-aware systems for their strong formalism, allowing verification and validation of context models and their ability to automate inductive and deductive reasoning on contextual information.The proposed modeling approach relies on first order logic to model the contect context.The first order logic provides an expressive description of contextual information close to the real environment and natural language.
Firstly, a simple context is described using first-order logicbased formalism.Then, a more complicate complicated context is described with Boolean operators and existential and universal quantifiers (Section III.1).Secondly, we try to provide a simple reasoning logic model that provide a highlevel representation of context which can be used as a basis for more advanced reasoning on the context, such as the context discovery or prediction.We believe that logic based models are very efficient tools for context reasoning and are adequate for general pervasive context-aware systems.(Section III.2).

A. Context formalism 1) The basic structure -The context predicate
The required context is the one in which, the service is more likely to be offered.If the current context satisfies this requirement, then the service will be offered.
Definition.1:The context is the set of entities with a spatiotemporal variation that affects the quality of the service, in a short or long term (current service vs anticipatory service) [11].
Definition.2:The state of a service space is the combination of the all the states of the entities existing in this space (including active services and contexts linked to those services).
A context can be reduced to an atomic form, derived from the structure of natural languages.For example, in a natural language people describe information with simple-clause sentence containing a subject and a verb: Simple clause (<subject> <verb>)

Exp : Adam enters
The natural form sentence can also be used as follows: subject-verb-object Sentence (<subject> <verb> <object>) Exp : Adam enters in room This sentence might be an observation in the context, which might influence the behaviour of a system and trigger an adaptation to offer a service: Context (<user> <action> <localisation>) However, the contextual information available is less useful unless we have a complement of information about the spatiotemporal qualifications.In a natural language sentence, time is implicit and given off by the tense of the sentence.
In a systematic description, we use parameters.Knowing that spatiotemporal information in the service space might lead to a more efficient adaptation [11], it becomes a requirement to add two parameters to the description: a time parameter and a location parameter.This may take the following predicate form:

Context (<element> <state> <value> <times> <location>)
Example: describing the following information "Alex enters the room" in a service space, entails an emphasis the time and location parameters in that information
 State: indicates the state of an element, an action, a functionality and is linked to the type of element it describes.
 Value: observation qualifying a state a functionality or an action (i.e.on, off).
 Time: observation time, the instant is when the element's state was observed.
 Location: the place where the observation happened.www.ijacsa.thesai.org To describe a complex context expression, requires use of Boolean, quantitative and existential operators, as will be detailed below.

2) Operation on context
Our goal is to have an accurate description of the physical world.With a pervasive system, we would also like to describe the service space.To ensure context-awareness with an accurate description yields an efficient system.As described above, the atomic form can be extended to describe all the elements of a context in a service space.It is possible to scale in complexity adapting the description accordingly by integrating Boolean operators and logical quantifiers to the predicates.Conjunctions, disjunction and negation can also be performed for a complex description, as illustrated in table 2. Describes light as being on in room 1 at 22h00 and either user 2 or user 1 are registering their presence there.

3) Quantification
An existential or universal quantification model allows us to represent even richer sets, table 3. A context might be quantified with respect to one of its parameters.
The existential quantifier indicates that the context is true, at least for one mentioned variable.
The user is present at least in one location The universal quantifier shows that the context is true for all the occurrences of the mentioned variable.

 Example ∀user X Context (<X> <presence> <active><22 :00> <room1>)
To describe any user in the location designated by 'room 1'  Low-level context consisting in information provided by physical sensor and acquired without further interpretation or analysis, can be meaningless, susceptible, superfluous, or uncertain, the limitation of low-level contextual cues: when modelling different service space interaction risks reducing the usefulness of context-aware applications.A way to mitigate this problem is the elicitation of higher-level context from raw and unrefined sensor values, named context reasoning and interpretation as show in Fig. 1.
Using a formal approach for modeling, the context can be processed with logical reasoning methods (e.g.: rule-based, temporal logic).The context reasoning was useful to: (i) checking the consistency of context, and (ii) infering a highlevel implicit context from a low-level explicit context.
The idea is to abstract from low-level context by creating a new model layer that generates a higher-level.This refers to a different work in literature discussed a contextual situation [9,23] In the context-aware system, situations are the semantic interpretation of low-level context, giving meaning to the application, making it more stable, and easier to define and maintain than basic contextual information [23].Adaptations in context-aware applications are then caused by the change of situations.Operating at a high level of context abstraction to define a contextual situation make easier application implementation.
In literature, several approaches have been proposed to get abstraction and define situation.For example, [13] enumerates six different ways to describe the situation ``in_meeting_now`` based on: www.ijacsa.thesai.orgEarly approaches relied on formal logic to describe and represent these states.One of the first approaches: Situation Theory, was proposed by Barwise and Perry [17].Situation Theory attempts to cover model-theoretic semantics of natural language in a formal logic system [24].The situation inference affords a logical language for reasoning about action and adaptation.
Our approach based on formal logic provides a high level of abstraction and formality for specifying the context and contextual situation.It also establishes a logic link between context and situation and puts it under the causal connection.This is in agreement with our vision of the context and its use on adaptation or prediction [11].
Based on McCarthy's definition of a situation [1], who described a situation as a complete state of the universe at an instant of time.Therefore, in order to describe a service space situation we do not need to get the whole state of the universe but rather a system environment at this time; which in realty is the context, like a snapshot or instantiation of all context variables at some point of time in a space service as mentioned in definition.2(section III.1).
The value of context entity parameters changes from situation to situation.To be able to deduce a situation and abstract a context into situation, the characteristic features of a context are used to get properties that are more stable over one situation.Situation encompass a complex context witch can be represented by a predicate and link structure.Situations are a complex context limited by time.The situation can be derived as:

S= ( Ti, Te, Cs)
Where: (i) Ti is the starting time it is the first time context parameter associated to the specific situation; (ii) Te is the end time, it is the last time context parameter associated to the same situation; and (iii) Cs is the conjunction of all context entity associated to the situation.This may take the following predicate form, that can be use it as a deduction rule:

B. Scenario Morning at work
Adam starts his day; it is a work day.He leaves to work and issues a vocal command to his car indicating his destination: the office.The computed commuting time is 30 minutes.Adam should be at the office at 09h00.On his today's schedule, he has a meeting planned for 10h00, where he is supposed to make a presentation for his team.

USS Work space
Meeting room Office Fig. 2. USS services spaces Reaching office by 09h00, Adam swipes his access card; the system authenticates him and opens the door.The blinds were already retracted, the temperature adjusted to ambient and the office computer, started.Adam starts working on his presentation.At 09h45, an audiovisual notification appears on the computer screen reminding Adam of his upcoming meeting in 15 minutes.According to the location, he needs 10 minutes to reach the meeting room.The desktop computer saves Adam's work and synchronizes with his laptop.
On the way to the meeting, the system issues commands to upgrade the service spaces:  USS prepares the meeting room: launch the projector and the display screen, activate the audio system, adjust luminosity, temperature and deploys the blinds.
 USS manages Adam's office while he's away: turns off the desk lamp, locks his computer session, launch system upgrades on the computer and locks access.
Adam and his team are in the meeting room; the presentation is about to start.The system switches all phones to silent mode and locks access to the meeting room.
The meeting ends at 11h00.Adam goes back to his office.The system updates the office's context:  Unlock the computer session.
 Activate the UV blinds.
 Switch the phone back to normal mode.USS updates the state of the meeting room, according to its scheduled uses.This paper focus on the context modelling and use this scenario to define the context and the context situation.www.ijacsa.thesai.org In future work, we envision to use the same scenario for the context prediction approach and adaptation.

Switches on / Switches off
To describe the situation in one of the service spaces scenario: the meeting room or the office, the model will be based on the ambiance (eg light, sound), the time, location of users (eg present, absent, co-present) and applications (type of application, run, off).A few of these rules a few of these rules are as following:   The proposed model follows our pervious reflection on the spatiotemporal contextual information and provides a formal method to introduce it in the context modelling.Compare to the other formal model, this proposal provides notables properties for context model: dynamic context easily understandable; natural language support, logic reasoning support, remaining faithful to a spatiotemporal framework.Future work will concentrate mainly, on context reasoning and prediction method, and how to design better a context discovery engine, and formalizes it in a generic reusable model.


co-location of people and agenda information  co-location of filled coffee cups in a room  devices in the room  weight sensors on the floor  sounds and noises  cameras: watching activity in the meeting room In this paper, formal logic approach is used to model the context and acquire high-level contextual model concerning the situation.
∀time t ∈ [Ti,Te] Context (<element1> <state> <value> <t> <location>) ˄ Context (<element2> <state> <value> <t> <location>) ˄ Context (<element n> <state> <value> <t> <location>) → Cs In high level: Cs → S Our scenario's time: a morning in a working day  Ti : initial time to context situation  Te: end time to context situation Based on ambiancelocationtime (sample contextualsituation-office), various rules are formalized in first-order predicate based in our context model in order to deduce the space situation.

TABLE I
 Generate high-level context based on low-level context  Simple to use  Simple to model  Partial validation difficult to maintain  Applicability can be complicated. No standard www.ijacsa.thesai.orgB. Synthesis The following comparison table (Table.1)summarises the review of context modeling approches.
High level of formality www.ijacsa.thesai.orgwork on this topic has been centered on the ontology model.The previously proposed works on logic based context modelling suffer from two main weakness points:

TABLE II .
CONJUNCTION, DISJUNCTION AND NEGATION OPERATOR

TABLE IV .
DEVICES, STATES AND SERVICE SPACES

TABLE V .
OFFICE CONTEXT SITUATION

TABLE VI .
MEETING ROOM CONTEXT SITUATION