---
abstract: 'As we are moving towards the Internet of Things (IoT), the number of sensors deployed around the world is growing at a rapid pace. Market research has shown a significant growth of sensor deployments over the past decade and has predicted a significant increment of the growth rate in the future. These sensors continuously generate enormous amounts of data. However, in order to add value to raw sensor data we need to understand it. Collection, modelling, reasoning, and distribution of context in relation to sensor data plays critical role in this challenge. Context-aware computing has proven to be successful in understanding sensor data. In this paper, we survey context awareness from an IoT perspective. We present the necessary background by introducing the IoT paradigm and context-aware fundamentals at the beginning. Then we provide an in-depth analysis of context life cycle. We evaluate a subset of projects (50) which represent the majority of research and commercial solutions proposed in the field of context-aware computing conducted over the last decade (2001-2011) based on our own taxonomy. Finally, based on our evaluation, we highlight the lessons to be learnt from the past and some possible directions for future research. The survey addresses a broad range of techniques, methods, models, functionalities, systems, applications, and middleware solutions related to context awareness and IoT. Our goal is not only to analyse, compare and consolidate past research work but also to appreciate their findings and discuss their applicability towards the IoT.'
author:
- 'Charith Perera,  Arkady Zaslavsky,  Peter Christen, and Dimitrios Georgakopoulos,  [^1][^2][^3]'
bibliography:
- 'IEEEabrv.bib'
- 'Bibliography.bib'
title: |
    Context Aware Computing for\
    The Internet of Things: A Survey
---

[Shell : Bare Demo of IEEEtran.cls for Journals]{}

Internet of things, context awareness, sensor networks, sensor data, context life cycle, context reasoning, context modelling, ubiquitous, pervasive, mobile, middleware.

Introduction {#Introduction}
============

awareness, as a core feature of ubiquitous and pervasive computing systems, has existed and been employed since the early 1990s. The focus on context-aware computing evolved from desktop applications, web applications, mobile computing, pervasive/ubiquitous computing to the Internet of Things (IoT) over the last decade. However, context-aware computing became more popular with the introduction of the term ‘*ubiquitous computing*’ by Mark Weiser [@P506] in his ground-breaking paper *The Computer for the 21st Century* in 1991. Then the term ‘*context-aware*’ was first used by Schilit and Theimer [@P173] in 1994.

Since then, research into context-awareness has been established as a well known research area in computer science. Many researchers have proposed definitions and explanations of different aspects of context-aware computing, as we will discuss briefly in Section \[chapter2:CAF\]. The definitions for *‘context*’ and ‘*context-awareness*’ that are widely accepted by the research community today were proposed by Abowd et al. [@P104] in 1999.

During the last two decades, researchers and engineers have developed a significant amount of prototypes, systems, and solutions using context-aware computing techniques. Even though the focus varied depending on each project, one aspect remained fairly unchanged: that is the number of data sources (e.g. software and hardware sources). For example, most of the proposed solutions collect data from a limited number of physical (hardware) and virtual (software) sensors. In these situations, collecting and analysing sensor data from all the sources is possible and feasible due to limited numbers. In contrast, IoT envisions an era where billions of sensors are connected to the Internet, which means it is not feasible to process all the data collected by those sensors. Therefore, context-awareness will play a critical role in deciding what data needs to be processed and much more.

Due to advances in sensor technology, sensors are getting more powerful, cheaper and smaller in size, which has stimulated large scale deployments. As a result, today we have a large number of sensors already deployed and it is predicted that the numbers will grow rapidly over the next decade [@P029]. Ultimately, these sensors will generate *big data* [@ZMP003]. The data we collect may not have any value unless we analyse, interpret, and understand it. Context-aware computing has played an important role in tackling this challenge in previous paradigms, such as mobile and pervasive, which lead us to believe that it would continue to be successful in the IoT paradigm as well. Context-aware computing allows us to store context[^4] information linked to sensor data so the interpretation can be done easily and more meaningfully. In addition, understanding context makes it easier to perform machine to machine communication as it is a core element in the IoT vision.

When large numbers of sensors are deployed, and start generating data, the traditional application based approach (i.e. connect sensors directly to applications individually and manually) becomes infeasible. In order to address this inefficiency, significant amounts of middleware solutions are introduced by researchers. Each middleware solution focuses on different aspects in the IoT, such as device management, interoperability, platform portability, context-awareness, security and privacy, and many more. Even though, some solutions address multiple aspects, an ideal middleware solution that addresses all the aspects required by the IoT is yet to be designed. In this survey, we consider identifying the context-aware computing related features and functionalities that are required by an ideal IoT middleware solution as a key task.

There have been several surveys conducted in relation to this field. We briefly introduce these surveys in chronological order. Chen and Kotz [@P431] (2000) have surveyed context awareness, focusing on applications, what context they use, and how contextual information is leveraged. In 2004, Strang and Linnhoff-Popien [@P184] compared the most popular context modelling techniques in the field. Middleware solutions for sensor networks are surveyed by Molla and Ahamed [@P417] in 2006. Two separate surveys were conducted by Kjaer [@P035] and Baldauf et al. [@P402] in 2007 on context-aware systems and middleware solutions using different taxonomies. Both surveys compared limited numbers, but different projects with very little overlap. c et al. [@P185] (2009) reviewed popular context representation and reasoning from a pervasive computing perspective. In 2010, Bettini et al. [@P216] also comprehensively surveyed context modelling and reasoning by focusing on techniques rather than projects. In the same year another survey was done by Saeed and Waheed [@P359] focusing on architectures in the context-aware middleware domain. Bandyopadhyay et al. [@P118] have conducted a survey on existing popular Internet of Things middleware solutions in 2011. The latest survey is done by Bellavista et al. [@P291] (2013) which is focused on context distribution for mobile ubiquitous systems.

![image](./Figures/33-Evolution_of_Internet.pdf)

Our survey differs from the previous literature surveys mentioned above in many ways. Most of the surveys evaluated a limited number of projects. In contrast, we selected a large number of projects (50) covering a decade, based on the unique criteria that will be explained at the end of this section. We took a much broader viewpoint compared to some of the previous surveys, as they have focused on specific elements such as modelling, reasoning, etc. Finally and most importantly, our taxonomy formation and organisation is completely different. Rather than building a theoretical taxonomy and then trying to classify existing research projects, prototypes and systems according to it, we use a practical approach. We built our taxonomy based on past research projects by identifying the features, models, techniques, functionalities and approaches they employed at higher levels (e.g. we do not consider implementation/code level differences between different solutions). We consolidated this information and analysed the capabilities of each solution or the project. We believe this approach allows us to highlight the areas where researchers have mostly (priorities) and rarely (non-priorities) focused their attention and the reasons behind. Further, we have also used a non-taxonomical project based evaluation, where we highlight how the different combinations of components are designed, developed and used in each project. This allows to discuss their applicability from an IoT perspective.

Our objectives in revisiting the literature are threefold: 1) to learn how context-aware computing techniques have helped to develop solutions in the past, 2) how can we apply those techniques to solve problems in the future in different paradigms such as the IoT, and 3) to highlight open challenges and to discuss future research directions.

This paper is organised into sections as follows: Section \[chapter2:IoTP\] provides an introduction to the IoT. In this section, we briefly describe the history and evolution of the Internet. Then we explain what the IoT is, followed by a list of application domains and statistics that show the significance of the IoT. We also describe the relationship between sensor networks and the IoT. Comparisons of popular IoT middleware solutions are presented at the end of the section in order to highlight existing research gaps. In Section \[chapter2:CAF\], we present context awareness fundamentals such as context-aware related definitions, context types and categorisation schemes, features and characteristics, and context awareness management design principles. In Section \[chapter2:CDLC\], we conduct our main discussion based on context life cycle where we identify four stages: acquisition, modelling, reasoning, and distribution. Section \[chapter2:PRE\] briefly discusses the highlights of each project, which we use for the comparison later. Finally, Section \[chapter2:LL\] discusses the lessons learn from the literature and Section \[chapter2:LLFRD\] identifies future research directions and challenges. Conclusion remarks are presented in Section \[chapter2:Conclusions\].

For this literature review, we analyse, compare, classify a subset of both small scale and large scale projects (50) which represent the majority of research and commercial solutions proposed in the field of context-aware computing based on our own taxonomy. We selected the existing solutions to be reviewed based on different criteria. Mainly, we selected projects that were conducted over the last decade (2001-2011). We also considered main focus, techniques used, popularity, comprehensiveness, information availability, and the year of publication, in order to make sure that our review provides a balanced view on context-aware computing research.

The Internet of Things Paradigm {#chapter2:IoTP}
===============================

In this section, we briefly introduce the IoT paradigm. Our intention is not to survey the IoT, but to present some fundamental information (e.g. how Internet evolved, what is the IoT, statistics related to IoT, underline technologies, characteristics, and research gaps in IoT paradigm) that will help with understanding the historic movements and the direction into which technology is moving today. The IoT paradigm has its own concepts and characteristics. It also shares significant amounts of concepts with other computer fields. The IoT bundles different technologies (e.g. sensor hardware/firmware, semantic, cloud, data modelling, storing, reasoning, processing, communication technologies) together to build its vision. We apply the existing technologies in different ways based on the characteristics and demands of the IoT. The IoT does not revolutionise our lives or the field of computing. It is another step in the evolution of the Internet we already have.

Evolution of Internet {#chapter2:IoTP:Evolution of Internet}
---------------------

Before we investigate the IoT in depth, it is worthwhile to look at the evolution of the Internet. In the late 1960s, communication between two computers was made possible through a computer network [@P260]. In the early 1980s the TCP/IP stack was introduced. Then, commercial use of the Internet started in the late 1980s. Later, the World Wide Web (WWW) became available in 1991 which made the Internet more popular and stimulate the rapid growth. Web of Things (WoT) [@P575], which based on WWW, is a part of IoT.

Later, mobile devices connected to the Internet and formed the mobile-Internet [@P018]. With the emergence of social networking, users started to become connected together over the Internet. The next step in the IoT is where objects around us will be able to connect to each other (e.g. machine to machine) and communicate via the Internet [@P006]. Figure \[Fig:Evolution\_of\_The\_Internet\] illustrates the five phases in the evolution of the Internet.

What is the Internet of Things? {#chapter2:IoTP:What is Internet of Things?}
-------------------------------

![Definition of the Internet of Things: The Internet of Things allows people and things to be connected anytime, anyplace, with anything and anyone, ideally using any path/network and any service [@P019].[]{data-label="Fig:Definition_of_IoT"}](./Figures/34-IoT_Definition.pdf)

During the past decade, the IoT has gained significant attention in academia as well as industry. The main reasons behind this interest are the capabilities that the IoT [@P007; @P003] will offer. It promises to create a world where all the objects (also called smart objects [@P041]) around us are connected to the Internet and communicate with each other with minimum human intervention [@P026]. The ultimate goal is to create ‘a better world for human beings’, where objects around us know what we like, what we want, and what we need and act accordingly without explicit instructions [@P040].

The term ‘Internet of Things’ was firstly coined by Kevin Ashton [@P065] in a presentation in 1998. He has mentioned *“The Internet of Things has the potential to change the world, just as the Internet did. Maybe even more so”*. Then, the MIT Auto-ID centre presented their IoT vision in 2001 [@P361]. Later, IoT was formally introduced by the International Telecommunication Union (ITU) by the *ITU Internet report* in 2005 [@P020].

The IoT encompasses a significant amount of technologies that drive its vision. In the document, *Vision and challenges for realising the Internet of Things*, by CERP-IoT [@P029], a comprehensive set of technologies was listed. IoT is a very broad vision. The research into the IoT is still in its infancy. Therefore, there aren’t any standard definitions for IoT. The following definitions were provided by different researchers.

Definition by [@P002]: *“Things have identities and virtual personalities operating in smart spaces using intelligent interfaces to connect and communicate within social, environment, and user contexts.”*

Definition by [@P006]:*“The semantic origin of the expression is composed by two words and concepts: Internet and Thing, where Internet can be defined as the world-wide network of interconnected computer networks, based on a standard communication protocol, the Internet suite (TCP/IP), while Thing is an object not precisely identifiable Therefore, semantically, Internet of Things means a world-wide network of interconnected objects uniquely addressable, based on standard communication protocols.”*

Definition by [@P019]: *“The Internet of Things allows people and things[^5] to be connected Anytime, Anyplace, with Anything and Anyone, ideally using Any path/network and Any service.”*

We accept the last definition provided by [@P019] for our research work, because we believe, this definition encapsulates the broader vision of IoT. Figure \[Fig:Definition\_of\_IoT\] illustrates the definition more clearly. The broadness of IoT can be identified by evaluating the application domains presented in Section \[chapter2:IoTP:IoT Application Domains\].

IoT Application Domains {#chapter2:IoTP:IoT Application Domains}
-----------------------

The IoT, interconnection and communication between everyday objects, enables many applications in many domains. The application domain can be mainly divided in to three categories based on their focus [@P003; @P029]: industry, environment, and society. The magnitude of the applications can be seen in the statistics presented in Section \[chapter2:IoTP:IoT Related Statistics\].

Supply chain management [@P017], transportation and logistics [@P005], aerospace, aviation, and automotive are some of the industry focused applications of IoT. Telecommunication, medical technology [@P362], healthcare, smart building, home [@P363] and office, media, entertainment, and ticketing are some of the society focused applications of IoT. Agriculture and breeding [@P244; @P013], recycling, disaster alerting, environmental monitoring are some of the environment focused applications.

Asin and Gascon [@P416] listed 54 application domains under twelve categories: smart cities, smart environment, smart water, smart metering, security and emergencies, retail, logistics, industrial control, smart agriculture, smart animal farming, domestic and home automation, and eHealth.

IoT Related Statistics {#chapter2:IoTP:IoT Related Statistics}
----------------------

The vision of the IoT is heavily energised by statistics and predictions. We present the statistics to justify our focus on the IoT and to show the magnitude of the challenges. It is estimated that there about 1.5 billion Internet-enabled PCs and over 1 billion Internet-enabled mobile phones today. These two categories will be joined with Internet-enabled devices (smart objects [@P041])) in the future. By 2020, there will be 50 to 100 billion devices connected to the Internet [@P029].

According to BCC Research [@P255], the global market for sensors was around \$56.3 billion in 2010. In 2011, it was around \$62.8 billion. Global market for sensors is expected to increase to \$91.5 billion by 2016, at a compound annual growth rate of 7.8%.

The Essential Component of IoT: Sensor Networks {#chapter2:IoT:The Backbone of IoT: Sensor Networks}
-----------------------------------------------

We provide a brief introduction to sensor networks in this section as it is the most essential component of the IoT. A sensor network comprises one or more sensor nodes, which communicate between themselves using wired and wireless technologies. In sensor networks, sensors can be homogeneous or heterogeneous. Multiple sensor networks can be connected together through different technologies and protocols. One such approach is through the Internet. The components and the layered structure of a typical sensor network are discussed in Section \[chapter2:IoT:Layers in Sensor Networks\].

We discuss how sensor networks and the IoT work together in Section \[chapter2:IoT:Relationship Between Sensor Networks and IoT\]. However, there are other technologies that can complement the sensing and communication infrastructure in IoT paradigm such as traditional ad-hoc networks. These are clearly a different technology from sensor networks and have many weaknesses. The differences are comprehensively discussed in [@P009].

There are three main architectures in sensor networks: flat architecture (data transfers from static sensor nodes to the sink node using a multi-hop fashion), two-layer architecture (more static and mobile sink nodes are deployed to collect data from sensor nodes), and three-layer architecture (multiple sensor networks are connected together over the Internet). Therefore, IoT follows a three-layer architecture.

Most of the sensors deployed today are wireless. There are several major wireless technologies used to build wireless sensor networks: wireless personal area network (WPAN) (e.g. Bluetooth), wireless local area network (WLAN) (e.g. Wi-Fi), wireless metropolitan area network (WMAN) (e.g. WiMAX), wireless wide area network (WWAN) (e.g. 2G and 3G networks), and satellite network (e.g. GPS). Sensor networks also use two types of protocols for communication: non-IP based (e.g: Zigbee and Sensor-Net) and IP-based protocols (NanoStack, PhyNet, and IPv6).

The sensor network is not a concept that emerged with the IoT. The concept of a sensor network and related research existed a long time before the IoT was introduced. However, sensor networks were used in limited domains to achieve specific purposes, such as environment monitoring [@P193], agriculture [@P244], medical care [@P158], event detection [@P113], structural health monitoring [@P067], etc. Further, there are three categories of sensor networks that comprise the IoT [@P266]: body sensor networks (BSN), object sensor networks (OSN), and environment sensor networks (ESN).

Molla and Ahamed [@P417] identified ten challenges that need to be considered when developing sensor network middleware solutions: abstraction support, data fusion, resource constraints, dynamic topology, application knowledge, programming paradigm, adaptability, scalability, security, and QoS support. A comparison of different sensor network middleware solutions is also provided based on the above parameters. Several selected projects are also discussed in brief in order to discover the approaches they take to address various challenges associated with sensor networks.

Some of the major sensor network middleware approaches are IrisNet, JWebDust, Hourglass, HiFi, Cougar, Impala, SINA, Mate, TinyDB, Smart Object, Agilla, TinyCubus, TinyLime, EnviroTrack, Mires, Hood, and Smart Messages. A survey on web based wireless sensor architectures and applications is presented in [@P475].

Layers in Sensor Networks {#chapter2:IoT:Layers in Sensor Networks}
-------------------------

We have presented a typical structure of a sensor network in Figure \[Fig:Layered Structure on a Sensor Network\]. It comprises the most common components in a sensor network. As we have shown, with the orange coloured arrows, data flows from right to left. Data is generated by the low-end sensor nodes and high-end sensor nodes. Then, data is collected by mobile and static sink nodes. The sink nodes send the data to low-end computational devices. These devices perform a certain amount of processing on the sensor data. Then, the data is sent to high-end computational devices to be processed further. Finally, data reaches the cloud where it will be shared, stored, and processed significantly.

![Layered structure of a sensor network: These layers are identified based on the capabilities posed by the devices. In IoT, this layered architecture may have additional number of sub layers as it is expected to comprises large verity of in sensing capabilities.[]{data-label="Fig:Layered Structure on a Sensor Network"}](./Figures/37-Sensor_Networks.pdf)

Based on the capabilities of the devices involved in a sensor network, we have identified six layers. Information can be processed in any layer. Capability means the processing, memory, communication, and energy capacity. Capabilities increase from layer one to layer six. Based on our identification of layers, it is evident that an ideal system should understand the capability differences, and perform data management accordingly. It is all about efficiency and effectiveness. For example, perform processing in the first few layers could reduce data communication. However, devices in the first few layers do not have a sufficient amount of energy and processing power to do comprehensive data processing [@P318]. find more efficient and effective ways of data management, such as collecting, modelling, reasoning, distributing.

Relationship Between Sensor Networks and IoT {#chapter2:IoT:Relationship Between Sensor Networks and IoT}
--------------------------------------------

In earlier sections we introduced both IoT and sensor network concepts. In this section we explain the relationship between the two concepts. Previously, we argued that sensor networks are the most essential components of the IoT. Figure \[Fig:Relationship Between Sensor Networks and IoT\] illustrates the big picture. The IoT comprises sensors and actuators. The data is collected using sensors. Then, it is processed and decisions are made. Finally, actuators perform the decided actions. This process is further discussed in Section \[chapter2:CDLC\]. Further, integration between wireless sensor networks and the IoT are comprehensively discussed in [@P351]. The difference between sensor networks (SN) and the IoT is largely unexplored and blurred. We can elaborate some of the characteristics of both SN and IoT to identify the differences.

SN comprises of the sensor hardware (sensors and actuators), firmware and a thin layer of software. The IoT comprises everything that SN comprises and further it comprises a thick layer of software such as middleware systems, frameworks, APIs and many more software components. The software layer is installed across computational devices (both low and high-end) and the cloud.

From their origin, SNs were designed, developed, and used for specific application purposes, for example, detecting bush fire [@P266]. In the early days, sensor networks were largely used for monitoring purposes and not for actuation [@P277]. In contrast, IoT is not focused on specific applications. The IoT can be explained as a general purpose sensor network [@P285]. Therefore, the IoT should support many kinds of applications. During the stage of deploying sensors, the IoT would not be targeted to collect specific types of sensor data, rather it would deploy sensors where they can be used for various application domains. For example, company may deploy sensors, such as pressure sensors, on a newly built bridge to track its structural health. However, these sensors may be reused and connect with many other sensors in order to track traffic at a later stage. Therefore, middleware solutions, frameworks, and APIs are designed to provide generic services and functionalities such as intelligence, semantic interoperability, context-awareness, etc. that are required to perform communication between sensors and actuators effectively.

Sensor networks can exist without the IoT. However, the IoT cannot exist without SN, because SN provides the majority of hardware (e.g. sensing and communicating) infrastructure support, through providing access to sensors and actuators. There are several other technologies that can provide access to sensor hardware, such as wireless ad-hoc networks. However, they are not scalable and cannot accommodate the needs of the IoT individually [@P009], though they can complement the IoT infrastructure. As is clearly depicted in Figure \[Fig:Relationship Between Sensor Networks and IoT\], SN are a part of the IoT. However, the IoT is not a part of SN.

![Relationship between sensor networks and IoT.[]{data-label="Fig:Relationship Between Sensor Networks and IoT"}](./Figures/40-Relationship_Between_IoT_and_SN2.pdf)

Characteristics of the IoT {#chapter2:IoT:Characteristics of IoT}
--------------------------

In Section \[chapter2:IoT:Relationship Between Sensor Networks and IoT\], we highlighted the differences between sensor networks and the IoT. Further, we briefly explore the characteristics of the IoT from a research perspective. Based on previous research efforts in the IoT [@P029]: *intelligence*, *architecture*, *complex system*, *size considerations*, *time considerations*, *space considerations*, and *everything-as-a-service*. These characteristics need to be considered when developing IoT solutions throughout all the phases from design, development, implement and evaluation.

**Intelligence:** This means the application of knowledge. First the knowledge needs to be generated by collecting data and reasoning it. Transforming the collected raw data into knowledge (high-level information) can be done by collecting, modelling, and reasoning the context. Context can be used to fuse sensor data together to infer new knowledge. Once we have knowledge, it can be applied towards more intelligent interaction and communication.

**Architecture:** IoT should be facilitated by a hybrid architecture which comprises many different architectures. Primarily there would be two architectures: event driven [@P038] and time driven. Some sensors produce data when an event occurs (e.g. door sensor); the rest produce data continuously, based on specified time frames (e.g. temperature sensor). Mostly, the IoT and SN are event driven [@P275]. Event-Condition-Action (ECA) rules are commonly used in such systems.

**Complex system:** The IoT comprises a large number of objects (sensors and actuators) that interact autonomously. New objects will start communicating and existing ones will disappear. Currently, there are millions of sensors deployed around the world [@P069]. Interactions may differ significantly depending on the objects capabilities. Some objects may have very few capabilities, and as such store very limited information and do no processing at all. In contrast, some objects may have larger memory, processing, and reasoning capabilities, which make them more intelligent.

**Size considerations:** It is predicted that there will be 50-100 billion devices connected to the Internet by 2020 [@P029]. The IoT needs to facilitate the interaction among these objects. The numbers will grow continuously and will never decrease. Similar to the number of objects, number of interactions may also increase significantly.

**Time considerations:** The IoT could handle billions of parallel and simultaneous events, due to the massive number of interactions. Real-time data processing is essential.

**Space considerations:** The precise geographic location of a object will be critical [@P083] as location plays a significant role in context-aware computing. When the number of objects get larger, tracking becomes a key requirement. Interactions are highly dependent on their locations, their surroundings, and presence of other entities (e.g. objects and people).

**Everything-as-a-service:** Due to the popularity of cloud computing [@P498], consuming resources as a service [@P502] such as Platform-as-a-Service (PaaS), Infrastructure-as-a-Service (IaaS), Software-as-a-Service (SaaS), has become main stream. Everything-as-a-service [@P533] model is highly efficient, scalable, and easy to use. IoT demands significant amounts of infrastructure to be put in place in order to make its vision a reality, where it would follow a community or crowd based approach. Therefore, sharing would be essential, where an everything-as-a-service model would suit mostly sensing-as-a-service [@ZMP003].

Middleware Support for IoT {#chapter2:IoT:Middleware Support for IoT}
--------------------------

As we mentioned at the beginning, the IoT needs to be supported by middleware solutions. *“Middleware is a software layer that stands between the networked operating system and the application and provides well known reusable solutions to frequently encountered problems like heterogeneity, interoperability, security, dependability [@P064].”* The functionalities required by IoT middleware solutions are explained in detail in [@P029; @P018; @P006; @P019; @P020]. In addition, challenges in developing middleware solutions for the IoT are discussed in [@P028]. We present the summary of a survey conducted by Bandyopadhyay et al. [@P118]. They have selected the leading middleware solutions and analyse them based on their functionalities, each one offers, *device management*, *interoperation*, *platform portability*, *context-awareness*, and *security and privacy*. Table \[Tbl:IoT Middleware Comparison\] shows the survey results. By the time we were preparing this survey, some of the middleware solutions listed (i.e. GSN and ASPIRE) were in the processing of extending towards next generation solutions (i.e. EU FP7 project OpenIoT (2012-2014) [@P377]) by combining each other’s strengths.

[l m[0.85cm]{} m[0.85cm]{} m[0.85cm]{} m[0.85cm]{} m[0.85cm]{}]{}

Middleware & DM & I &PP &CA &SP\

Hydra [@P105] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\checkmark$\
ISMB [@P375] &$\checkmark$ &$\times$ &$\checkmark$ &$\times$ &$\times$\
ASPIRE [@P366] &$\checkmark$ &$\times$ &$\checkmark$ &$\times$ &$\times$\
UBIWARE [@P146] &$\checkmark$ &$\times$ &$\checkmark$ &$\checkmark$ &$\times$\
UBISOAP [@P367] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\times$ &$\times$\
UBIROAD [@P119] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\checkmark$\
GSN [@P050] &$\checkmark$ &$\times$ &$\checkmark$ &$\times$ &$\checkmark$\
SMEPP [@P371] &$\checkmark$ &$\times$ &$\checkmark$ &$\checkmark$ &$\checkmark$\
SOCRADES [@P373] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\times$ &$\checkmark$\
SIRENA [@P368] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\times$ &$\checkmark$\
WHEREX [@P370] &$\checkmark$ &$\checkmark$ &$\checkmark$ &$\times$ &$\times$\

\[Tbl:IoT Middleware Comparison\]

Research Gaps {#chapter2:IoT:Research Gaps to Improve}
-------------

According to Table \[Tbl:IoT Middleware Comparison\], it can be seen that the majority of the IoT middleware solutions do not provide context-awareness functionality. In contrast, almost all the solutions are highly focused on device management, which involves connecting sensors to the IoT middleware. In the early days, context-awareness was strongly bound to pervasive and ubiquitous computing. Even though there were some middleware solutions that provided an amount of context-aware functionality, they did not satisfy the requirements that the IoT demands. We discuss the issues and drawbacks with existing solutions, in detail, in Section \[chapter2:PRE\]. We discuss some of the research directions in Section \[chapter2:LLFRD\].

In this section, we introduced the IoT paradigm and highlighted the importance of context-awareness for the IoT. We also learnt that context-awareness has not been addressed in existing IoT focused solutions, which motivates us to survey the solutions in other paradigms to evaluate the applicability of context-aware computing techniques toward IoT. In the next section we discuss context-aware fundamentals that helps us understand the in-depth discussions in the later sections.

Context Awareness Fundamentals {#chapter2:CAF}
==============================

This section discusses definitions of context and context awareness, context-aware features, types of context and categorisation schemes, different levels and characteristics of context-awareness, and finally, context management design principles in the IoT paradigm.

Context-awareness Related Definitions {#chapter2:CAF:Context-awareness Related Definitions}
-------------------------------------

### Definition of Context {#chapter2:CAF:CARD:Definition of Context}

The term context has been defined by many researchers. Dey et al. [@P143] evaluated and highlighted the weaknesses of these definitions. Dey claimed that the definition provided by Schilit and Theimer [@P173] was based on examples and cannot be used to identify new context. Further, Dey claimed that definitions provided by Brown [@P175], Franklin and Flachsbart [@P178], Rodden et al. [@P181], Hull et al. [@P179], and Ward et al. [@P183] used synonyms to refer to context, such as environment and situation. Therefore, these definitions also cannot be used to identify new context. Abowd and Mynatt [@P115] identified the five W’s (Who, What, Where, When, Why) as the minimum information that is necessary to understand context. Schilit et al. [@P116] and Pascoe [@P180] have also defined the term context. Dey claimed that these definitions were too specific and cannot be used to identify context in a broader sense and provided a definition for context as follows:

*“Context is any information that can be used to characterise the situation of an entity. An entity is a person, place, or object that is considered relevant to the interaction between a user and an application, including the user and applications themselves [@P104].”*

We accept the definition of context provided by Abowd et al. [@P104] to be used in this research work, because this definition can be used to identify context from data in general. If we consider a data element, by using this definition, we can easily identify whether the data element is context or not. A number of dictionaries have also defined and explained the word context:

Synonyms [@P437]: *“Circumstance, situation, phase, position, posture, attitude, place, point; terms; regime; footing, standing, status, occasion, surroundings, environment, location, dependence.”*

Definition by FOLDOC [@P438]: *“That which surrounds, and gives meaning to, something else.”*

Definition by WordNet [@P439]: *“Discourse that surrounds a language unit and helps to determine its interpretation”*

Definition by Longman [@P440]: *“The situation, events, or information that are related to something and that help you to understand it”*

In addition, Sanchez et al. [@P344] explained the distinction between raw data and context information as follows:

**Raw (sensor) data:** Is unprocessed and retrieved directly from the data source, such as sensors.

**Context information:** Is generated by processing raw sensor data. Further, it is checked for consistency and meta data is added.

For example, the sensor readings produced by GPS sensors can be considered as raw sensor data. Once we put the GPS sensor readings in such a way that it represents a geographical location, we call it context information. Therefore in general, the raw data values produced by sensors can be considered as data. If this data can be used to generate context information, we identify these data as context. Therefore, mostly what we capture from sensors are data not the context information.

Ahn and Kim [@P278] define context (also called compound events) as a set of interrelated events with logical and timing relations among them. They also define an event as an occurrence that triggers a condition in a target area. There are two categories of events: discrete events and continuous events. If the sampling rate is *p*:

**Discrete events:** An event that occurs at time t and t + *p*, there are considered to have been two separate event instances. (e.g. a door open, lights on, etc.)

**Continuous events:** An event instance lasting for at least time *p*, where an event occurring at time t and t + *p*, cannot be considered as two separate events. (e.g. raining, having a shower, driving a car, etc.)

### Definition of Context-awareness {#chapter2:CAF:CARD:Definition of Context-awareness}

The term context awareness, also called sentient, was first introduced by Schilit and Theimer [@P173] in 1994. Later, it was defined by Ryan et al. [@P182]. In both cases, the focus was on computer applications and systems. As stated by Abowd et al. [@P104], those definitions are too specific and cannot be used to identify whether a given system is a context-aware system or not. Therefore, Dey has defined the term context-awareness as follows:

*“A system is context-aware if it uses context to provide relevant information and/or services to the user, where relevancy depends on the user’s task. [@P104]”*

We accept the above definition on context-awareness to be used in our research work, because we can use this definition to identify context-aware systems from the rest. If we consider a system, by using this definition we can easily identify whether this system is a context-aware system or not. Context awareness frameworks typically should support acquisition, representation, delivery, and reaction [@P143]. In addition, there are three main approaches that we can follow to build context-aware applications [@P339].

**No application-level context model:** Applications perform all the actions, such as context acquisition, pre-processing, storing, and reasoning within the application boundaries.

**Implicit context model:** Applications uses libraries, frameworks, and toolkits to perform context acquisition, pre-processing, storing, and reasoning tasks. It provides a standard design to follow that makes it easier to build the applications quickly. However, still the context is hard bound to the application.

**Explicit context model:** Applications uses a context management infrastructure or middleware solution. Therefore, actions such as context acquisition, pre-processing, storing, and reasoning lie outside the application boundaries. Context management and application are clearly separated and can be developed and extend independently.

### Definition of Context Model and Context Attribute {#chapter2:CAF:CARD:Definition_of_Context_Model_and_Context_Attribute}

We adopt the following interpretations of context model and context attributes provided by Henricksen [@P389] based on Abowd et al. [@P104] in our research work.

*“A context model identifies a concrete subset of the context that is realistically attainable from sensors, applications and users and able to be exploited in the execution of the task. The context model that is employed by a given context-aware application is usually explicitly specified by the application developer, but may evolve over time [@P389].”*

*“A context attribute is an element of the context model describing the context. A context attribute has an identifier, a type and a value, and optionally a collection of properties describing specific characteristics [@P389].”*

### Definition of Quality of Context {#chapter2:CAF:CARD:Definition of Quality of Context}

There are number of definitions and parameters that have been proposed in the literature regarding quality of context (QoC). A survey on QoC is presented in [@P291]. QoC is defined using a set of parameters that expresses the quality of requirements and properties of the context data. After evaluating a number of different parameter proposals in the literature, [@P291] has defined QoC based on three parameters: context data validity, context data precision, and context data up-to-dateness. QoC are being used to resolve context data conflicts. Further, they claim that QoC is depend on quality of the physical sensor, quality of the context data, and quality of the delivery process.

Context-aware Features {#chapter2:CAF:Context-aware Features}
----------------------

After analysing and comparing the two previous efforts conducted by Schilit et al. [@P116] and Pascoe [@P180], three features that a context-aware application can support: presentation, execution, and tagging. Even though, the IoT vision was not known at the time these features are identified, they are highly applicable to the IoT paradigm as well. We elaborate these features from an IoT perspective.

**Presentation:** Context can be used to decide what information and services need to be presented to the user. Let us consider a smart [@P007] environment scenario. When a user enters a supermarket and takes their smart phone out, what they want to see is their shopping list. Context-aware mobile applications need to connect to kitchen appliances such as a smart refrigerator [@P352] in the home to retrieve the shopping list and present it to the user. This provides the idea of presenting information based on context such as location, time, etc. By definition, IoT promises to provide any service anytime, anyplace, with anything and anyone, ideally using any path/network.

**Execution:** Automatic execution of services is also a critical feature in the IoT paradigm. Let us consider a smart home [@P007] environment. When a user starts driving home from their office, the IoT application employed in the house should switch on the air condition system and switch on the coffee machine to be ready to use by the time the user steps into their house. These actions need to be taken automatically based on the context. Machine-to-machine communication is a significant part of the IoT.

**Tagging:** In the IoT paradigm, there will be a large number of sensors attached to everyday objects. These objects will produce large volumes of sensor data that has to be collected, analysed, fused and interpreted [@P109]. Sensor data produced by a single sensor will not provide the necessary information that can be used to fully understand the situation. Therefore, sensor data collected through multiple sensors needs to be fused together. In order to accomplish the sensor data fusion task, context needs to be collected. Context needs to be tagged together with the sensor data to be processed and understood later. Context annotation plays a significant role in context-aware computing research. We also call this *tagging* operation as *annotation* as well.

Context Types and Categorisation Schemes {#chapter2:CAF:context Types}
----------------------------------------

Different researchers have identified context types differently based of different perspectives. Abowd et al. [@P104] introduced one of the leading mechanisms of defining context types. They identified location, identity, time, and activity as the primary context types. Further, they defined secondary context as the context that can be found using primary context. For example, given primary context such as a person’s identity, we can acquire many pieces of related information such as phone numbers, addresses, email addresses, etc.

However, using this definition we are unable to identify the type of a given context. Let us consider two GPS sensors located in two different locations. We can retrieve to identify the position of each sensor. However, we can only find the distance between the two sensors by performing calculations based on the raw values generated by the two sensor. The question is, ‘what is the category that *distance* belongs to?’ ‘is it primary or secondary?’ The *distance* is not just a value that we sensed. We computed the *distance* by fusing two pieces of context. The above definition does not represent this accurately.

Thus, we define a context categorisation scheme (i.e. primary and secondary) that can be used to classify a given data value (e.g. single data item such as current time) of context in terms of an operational perspective (i.e. how the data was acquired). However, the same data value can be considered as primary context in one scenario and secondary context in another. For example, if we collect the blood pressure level of a patient directly from a sensor attached to the patient, it could be identified as primary context. However, if we derive the same information from a patient’s health record by connecting to the hospital database, we call it secondary context. Therefore, the same information can be acquired using different techniques. It is important to understand that the quality, validity, accuracy, cost and effort of acquisition, etc. may varied significantly based on the techniques used. This would be more challenging in the IoT paradigm, because there would be a large amount of data sources that can be used to retrieve the same data value. To decide which source and technique to use would be a difficult task. We will revisit this challenge in Section VI. In addition, a similar type of context information can be classified as both primary and secondary. For example, location can be raw GPS data values or the name of the location (e.g. city, road, restaurant). Therefore, identifying a location as primary context without examining how the data has been collected is fairly inaccurate. Figure \[Fig:Context Types and Categories of Context\] depicts how the context can be identified using our context type definitions.

[&gt;l@ p[0.35cm]{} p[0.40cm]{}p[0.40cm]{}p[0.40cm]{}p[0.40cm]{}p[0.40cm]{} c p[0.40cm]{}p[0.40cm]{}p[0.40cm]{}p[0.40cm]{}p[0.40cm]{} c p[0.38cm]{}p[0.38cm]{} c]{} Context Types

&

&

&

&

&

&

&

&

&

&

&

&

&

&

&

&

\

User & & $\checkmark$ & & & $\checkmark$ & & & & & & & $\checkmark$ & & & $\checkmark$ & $\checkmark$\
Computing (System) & & $\checkmark$ & & & $\checkmark$ & & & & & & $\checkmark$ & $\checkmark$ & & & & $\checkmark$\
Physical (Environment) & & $\checkmark$ & $\checkmark$ & & $\checkmark$ & & & & & & $\checkmark$ & $\checkmark$ & & & $\checkmark$ &\
Historical & & & & & & & & & & & $\checkmark$ & & & & &\
Social & & & & & & & & & & & & $\checkmark$ & & & &\
Networking & & & & & & & & & & & & & & & $\checkmark$ &\
Things & & & & & & & & & & & & & & & & $\checkmark$\
Sensor & & & & & & & & & & & $\checkmark$ & & & & &\
Who (Identity) & $\checkmark$ & & $\checkmark$ & $\checkmark$ & & & & & & & & & & & &\
Where (Location) & $\checkmark$ & & $\checkmark$ & $\checkmark$ & & & & & & & & & & & &\
When (Time) & & & $\checkmark$ & $\checkmark$ & $\checkmark$ & & & & & & $\checkmark$ & $\checkmark$ & & & &\
What (Activity) & $\checkmark$ & & & $\checkmark$ & & & & & & & & & & & &\
Why & & & & $\checkmark$ & & & & & & & & & & & &\
Sensed & & & & & & $\checkmark$ & & & $\checkmark$ & & & & & & &\
Static & & & & & & $\checkmark$ & & & & & & & & & &\
Profiled & & & & & & $\checkmark$ & & & $\checkmark$ & & & & & & &\
Derived & & & & & & $\checkmark$ & & & $\checkmark$ & & & & & & &\
Operational & & & & & & & & $\checkmark$ & & & & & & & &\
Conceptual & & & & & & & & $\checkmark$ & & & & & & & &\
Objective & & & & & & & & & & & & & $\checkmark$ & & &\
Cognitive & & & & & & & & & & & & & $\checkmark$ & & &\
External (Physical) & & & & & & & $\checkmark$ & & & & & & & & &\
Internal (Logical) & & & & & & & $\checkmark$ & & & & & & & & &\
Low-level (Observable) & & & & & & & & & & $\checkmark$ & & & & $\checkmark$ & &\
High-level (Non-Observable) & & & & & & & & & & $\checkmark$ & & & & $\checkmark$ & &\

\[Tbl:Different\_Context\_Categorization\_Schemes\]

**Primary context:** Any information retrieved without using existing context and without performing any kind of sensor data fusion operations (e.g. GPS sensor readings as location information).

**Secondary context:** Any information that can be computed using primary context. The secondary context can be computed by using sensor data fusion operations or data retrieval operations such as web service calls (e.g. identify the distance between two sensors by applying sensor data fusion operations on two raw GPS sensor values). Further, retrieved context such as phone numbers, addresses, email addresses, birthdays, list of friends from a contact information provider based on a personal identity as the primary context can also be identified as secondary context.

![Context categorisation in two different perspectives: conceptual and operational. It shows why both operational and conceptual categorisation schemes are important in IoT paradigm as the capture different perspectives.[]{data-label="Fig:Context Types and Categories of Context"}](./Figures/44-Context_Types.pdf)

[&gt;m[4cm]{}@ p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} p[0.07cm]{} c]{}

&

User

&

Computing (System)

&

Physical (Environment)

&

Historical

&

Social

&

Networking

&

Things

&

Sensor

&

Who (Identity)

&

Where (Location)

&

When (Time)

&

What (Activity)

&

Why

&

Sensed

&

Static

&

Profiled

&

Derived

&

Operational

&

Conceptual

&

Objective

&

Cognitive

&

External (Physical)

&

Internal (Logical)

&

Low-level (Observable)

&

High-level (Non-Observable)

\

User &&&&&&&&&&&&&&&&&&&&&&&&&\
Computing (System) & 3&&&&&&&&&&&&&&&&&&&&&&&&\
Physical (Environment) & 3& 3&&&&&&&&&&&&&&&&&&&&&&&\
Historical & 3& 2& 2&&&&&&&&&&&&&&&&&&&&&&\
Social & 3& 2& 2&2&&&&&&&&&&&&&&&&&&&&&\
Networking & 3& 2& 3&2& 2&&&&&&&&&&&&&&&&&&&&\
Things & 3& 2& 2&2& 2& 2&&&&&&&&&&&&&&&&&&&\
Sensor & 3& 2& 1&2& 2& 2& 2& &&&&&&&&&&&&&&&&&\
Who (Identity) & 2& 2& 2&2& 2& 2& 2& 2&&&&&&&&&&&&&&&&&\
Where (Location) & 3& 3& 2&2& 2& 2& 2& 3& 3&&&&&&&&&&&&&&&&\
When (Time) & 3& 3& 3&2& 3& 3& 3& 3& 3& 3&&&&&&&&&&&&&&&\
What (Activity) & 3& 2& 2&2& 2& 2& 2& 2& 3& 3& 3&&&&&&&&&&&&&&\
Why & 3& 3& 3&2& 3& 3& 3& 3& 3& 3& 3& 3&&&&&&&&&&&&&\
Sensed & 1& 1& 1&2& 1& 1& 1& 1& 1& 1& 1& 1& 1&&&&&&&&&&&&\
Static & 2& 3& 3&2& 3& 3& 3& 3& 3& 3& 3& 3& 3& 3&&&&&&&&&&&\
Profiled & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 2& 3& 3&&&&&&&&&&\
Derived & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 2& 3& 3& 3&&&&&&&&&\
Operational & 3& 3& 3&2& 3& 3& 3& 3& 3& 3& 3& 3& 3& 2& 2& 2& 2&&&&&&&&\
Conceptual & 1& 1& 1&2& 1& 1& 1& 1& 1& 1& 1& 1& 1& 2& 2& 2& 2& 2&&&&&&&\
Objective & 2& 2& 2&2& 2& 2& 2& 2& 1& 1& 1& 1& 1& 2& 2& 2& 2& 3& 2&&&&&&\
Cognitive & 1& 3& 3&2& 3& 3& 3& 3& 3& 3& 3& 3& 1& 3& 2& 1& 1& 3& 2& 3&&&&&\
External (Physical) & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 2& 1& 2& 3& 3& 2& 2& 2& 3&&&&\
Internal (Logical) & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 2& 3& 2& 1& 1& 2& 2& 2& 1& 3&&&\
Low-level (Observable) & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 3& 1& 2& 3& 3& 2& 2& 2& 3& 1& 3&&\
High-level (Non-Observable) & 2& 2& 2&2& 2& 2& 2& 2& 2& 2& 2& 2& 2& 3& 2& 1& 1& 2& 2& 2& 1& & 1& 3&\

\[Tbl:Relationship\_Between\_Different\_Context\_Categories\]

We acknowledge location, identity, time, and activity as important context information. The IoT paradigm needs to consider more comprehensive categorisation schemes in a hierarchical manner, such as major categories, sub categories and so on. Operational categorisation schemes allow us to understand the issues and challenges in data acquisition techniques, as well as quality and cost factors related to context. In contrast, conceptual categorisation allows an understanding of the conceptual relationships between context. We have to integrate perspective in order to model context precisely. We compare different context categorisation schemes in Table \[Tbl:Comparison of Context Categorization Schemes\]. In addition to the two categorisation schemes we discussed earlier there are several other schemes introduced by different researchers focusing on different perspectives. Further, we highlight relationships between different context categories (also called context types) in different perspectives in Table \[Tbl:Different\_Context\_Categorization\_Schemes\] and in Table \[Tbl:Relationship\_Between\_Different\_Context\_Categories\]. These context categories are not completely different from each other. Each category shares common characteristics with the others. The similarities and difference among categories are clearly presented in Table \[Tbl:Relationship\_Between\_Different\_Context\_Categories\]. Further, we have listed and briefly explained three major context categorisation schemes and their categories proposed by previous researchers. In Table \[Tbl:Different\_Context\_Categorization\_Schemes\], we present each categorisation effort in chronological order from left to right.

Schilit et al. [@P116] (1994): They categorised context into three categories using a conceptual categorisation based technique on three common questions that can be used to determine the context.

1.  Where you are: This includes all location related information such as GPS coordinates, common names (e.g. coffee shop, university, police), specific names (e.g. Canberra city police), specific addresses, user preferences (e.g. user’s favourite coffee shop).

2.  Who you are with: The information about the people present around the user.

3.  What resources are nearby: This includes information about resources available in the area where the user is located, such as machinery, smart objects, and utilities.

[ |p[0.2cm]{}| p[2.9cm]{} p[6.7cm]{} p[6cm]{}| ]{}

&

Categorisation Schemes

&

Pros

&

Cons

\

&

Where, when, who, what, objective

&

Provide a broader guide that helps to identify the related context

Less comprehensive

&

Do not provide information about operational aspects such as cost, time, complexity, techniques, and effort of data acquisition

Do not provide information about frequency of update required

\
&

User, computing, physical, environmental, time, social, networking, things, sensors contexts

&

More clear and structured method to organise context

More extensible and flexible

More comprehensive

&

Do not provide information about operational aspects such as cost, time, complexity, techniques, and effort of data acquisition

Do not provide information about frequency of update required

\
&

Why, cognitive

&

Allow to model mental reasoning behind context

&

Do not provide information about core context, relationships between context or operational aspects such as cost, time, complexity, techniques, and effort of data acquisition

\
&

Sensed, static, profiled, derived

&

Provide information about programming and coding level

Provide information about context source and computational complexity

Allow to track information such as frequency of update required, validation, quality, etc.

Provide information about cost and effort of data acquisition

&

Weak in representing the relationship among context

Difficult to classify context information due to ambiguity. Same piece of data can belong to different categories depending to the situation (e.g. location can be derived as well as sensed)

\
&

Internal (physical), internal (logical), low-level (observable), high-level (non-observable)

&

Provide information about context sources and the process of accessing data (e.g. whether more reasoning is required or not)

Provide information about cost and effort of data acquisition

Provide information about computational complexity

&

Weak in representing the relationship among context

Difficult to classify context information due to ambiguity. Same piece of data can belong to different categories depending to the situation (e.g. temperature can be physical or virtual sensor)

\

\[Tbl:Comparison of Context Categorization Schemes\]

Henricksen [@P389] (2003): Categorised context into four categories based on an operational categorisation technique.

1.  Sensed: Sensor data directly sensed from the sensors, such as temperature measured by a temperature sensor. Values will be changed over time with a high frequency.

2.  Static: Static information which will not change over time, such as manufacturer of the sensor, capabilities of the sensor, range of the sensor measurements.

3.  Profiled: Information that changes over time with a low frequency, such as once per month (e.g. location of sensor, sensor ID).

4.  Derived: The information computed using primary context such as distance of two sensors calculated using two GPS sensors.

Van Bunningen et al. [@P304] (2005): Instead of categorising context, they classified the context categorisation schemes into two broader categories: operational and conceptual.

1.  Operational categorisation: Categorise context based on how they were acquired, modelled, and treated.

2.  Conceptual categorisation: Categorise context based on the meaning and conceptual relationships between the context.

Based on the evaluation of context categorisation, it is evident that no single categorisation scheme can accommodate all the demands in the IoT paradigm. We presented a comparison between conceptual and operational categorisation schemes in Table \[Tbl:Comparison of Context Categorization Schemes\]. To build an ideal context-aware middleware solution for the IoT, different categorisation schemes need to be combined together in order to complement their strengths and mitigate their weaknesses.

Levels of Context Awareness and characteristics {#chapter2:CAF:Levels of Context Awareness}
-----------------------------------------------

Context awareness can be identified in three levels based on the user interaction [@P430].

**Personalisation**: It allows the users to set their preferences, likes, and expectation to the system manually. For example, users may set the preferred temperature in a smart home environment where the heating system of the home can maintain the specified temperature across all rooms.

**Passive context-awareness**: The system constantly monitors the environment and offers the appropriate options to the users so they can take actions. For example, when a user enters a super market, the mobile phone alerts the user with a list of discounted products to be considered.

**Active context-awareness**: The system continuously and autonomously monitors the situation and acts autonomously. For example, if the smoke detectors and temperature sensors detect a fire in a room in a smart home environment, the system will automatically notify the fire brigade as well as the owner of the house via appropriate methods such as phone calls.

In addition, Van Bunningen et al. [@P304] has identified comprehensively, and discussed, eight characteristics of context: context 1) is sensed though sensors or sensor networks, 2) is sensed by small and constrained devices, 3) originates from distributed sources, 4) is continuously changing, 5) comes from mobile objects 6) has a temporal character 7) has a spatial character, 8) is imperfect and uncertain.

Context Awareness Management Design Principles {#chapter2:CAF:Context Awareness Management Design Principles}
----------------------------------------------

Martin et al. [@P294] have identified and comprehensively discussed six design principles related to context-aware management frameworks (middleware). Further, Ramparany et al. [@P340] and Bernardos et al. [@P302] have also identified several design requirements. We summarise the findings below with brief explanations. This list is not intended to be exhaustive. Only the most important design aspects are considered.

**Architecture layers and components**: The functionalities need to be divided into layers and components in a meaningful manner. Each component should perform a very limited amount of the task and should be able to perform independently up to a large extent.

**Scalability and extensibility**: The component should be able to added or removed dynamically. For example. new functionalities (i.e. components) should be able to be add without altering the existing components (e.g. Open Services Gateway initiative). The component needs to be developed according to standards across the solutions, which improves scalability and extensibility (e.g. plug-in architectures).

**Application programming interface (API)**: All the functionalities should be available to be accessed via a comprehensive easy to learn and easy to use API. This allows the incorporation of different solutions very easily. Further, API can be used to bind context management frameworks to applications. Interoperability among different IoT solutions heavily depends on API and their usability.

**Debugging mechanisms and tools**: Debugging is a critical task in any software development process. In the IoT paradigm, debugging would be difficult due to the exponential number of possible alternative interactions. In order to win the trust of the consumers, the IoT should prove its trustworthiness. Integrated debug mechanisms inbuilt into the framework will help to achieve this challenge. For example, the justifications behind the results produced by the reasoners should be available to be evaluated to find possible inaccuracies so further development can be carried out. Some initial work in this area is presented in the Intelligibility Toolkit [@P384].

**Automatic context life cycle management**: Context-aware frameworks should be able to be understand by the available context sources (i.e. physical and virtual sensors), their data structure, and automatically built internal data models to facilitate them. Further, raw context needs to be retrieved and transformed into appropriate context representation models correctly with minimum human intervention.

**context model in-dependency**: Context needs to be modelled and stored separately from context-aware framework related code and data structures, which allows both parts to be altered independently.

**Extended, rich, and comprehensive modelling**: Context models should be able to extend easily. The IoT will need to deal with enormous amount of devices, and will be required to handle vast amounts of domain specific context. It also needs to support complex relationships, constrains, etc. In an ideal context-aware framework for the IoT, multiple different context representation models should be incorporated together to improve their efficiency and effectiveness.

**Multi-model reasoning**: No single reasoning model can accommodate the demands of the IoT. We will discuss reasoning in Section \[chapter2:CAF:Context Reasoning Decision Models\]. Each reasoning model has its own strengths and weaknesses. An ideal framework should incorporate multiple reasoning models together to complement each others’ strengths and mitigate their weaknesses.

**Mobility support**: In the IoT, most devices would be mobile, where each one has a different set of hardware and software capabilities. Therefore, context-aware frameworks should be developed in multiple flavours (i.e. versions), which can run on different hardware and software configurations (e.g. more capabilities for server level software and less capabilities for mobile phones).

**Share information (real-time and historic)**: In the IoT, there is no single point of control. The architecture would be distributed. Therefore, context sharing should happen at different levels: framework-to-framework and framework-to-application. Context model in-dependency has been discussed earlier and is crucial in sharing.

**Resource optimisation**: Due to the scale (e.g. 50 billion devices), a small improvement in data structures or processing can make a huge impact in storage and energy consumption. This stays true for any type of resource used in the IoT.

**Monitoring and detect event**: Events play a significant role in the IoT, which is complement by monitoring. Detecting an event triggers an action autonomously in the IoT paradigm. This is how the IoT will help humans carry out their day-to-day work easily and efficiently. Detecting events in real time is a major challenge for context-aware frameworks in the IoT paradigm.

Context Life Cycle {#chapter2:CDLC}
==================

A data life cycle shows how data moves from phase to phase in software systems (e.g. application, middleware). Specifically, it explains where the data is generated and where the data is consumed. In this section we consider movement of context in context-aware systems. Context-awareness is no longer limited to desktop, web, or mobile applications. It has already become a service: Context-as-a-Service (CXaaS) [@P024]. In other terms, context management has become an essential functionality in software systems. This trend will grow in the IoT paradigm.

There are web-based context management services (WCXMS) that provide context information management throughout the context’s life cycle. Hynes et al. [@P024] have classified data life cycles into two categories: Enterprise Lifecycle Approaches (ELA) and Context Lifecycle Approaches (CLA).

ELA are focused on context. However, these life cycles are robust and well-established, based on industry standard strategies for data management in general. In contrast, CLA are specialised in context management. However, they are not tested or standardised strategies as much as ELA. We have selected ten popular data life cycles to analyse in this survey. In the following list, 1-5 belong to ELA category and 6-10 belong to CLA category. Three dots (...) denotes reconnecting to the first phase by completing the cycle. The right arrow ($\rightarrow$) denotes data transfer form one phase to another.

1.  *Information Lifecycle Management (ILM)* [@P516]: creation and receipt $\rightarrow$ distribution $\rightarrow$ use $\rightarrow$ maintenance $\rightarrow$ disposition $\rightarrow$ ...

2.  *Enterprise Content Management (ECM)* [@P517]: capture $\rightarrow$ manage $\rightarrow$ store $\rightarrow$ preserve $\rightarrow$ deliver $\rightarrow$ ...

3.  *Hayden’s Data Lifecycle* [@P515]: collection $\rightarrow$ relevance $\rightarrow$ classification $\rightarrow$ handling and storage $\rightarrow$ transmission and transportation $\rightarrow$ manipulate, conversion and alteration $\rightarrow$ release $\rightarrow$ backup $\rightarrow$ retention destruction $\rightarrow$ ...

4.  *Intelligence Cycle* [@P170]: collection $\rightarrow$ processing $\rightarrow$ analysis$\rightarrow$ publication $\rightarrow$ feedback $\rightarrow$ ...

5.  *Boyd Control Loop* (also called OODA loop) [@P171]: observe $\rightarrow$ orient $\rightarrow$ decide $\rightarrow$ act $\rightarrow$ ...

6.  *Chantzara and Anagnostou Lifecycle* [@P114]: sense (context provider) $\rightarrow$ process (context broker) $\rightarrow$ disseminate (context broker) $\rightarrow$ use (service provider) $\rightarrow$ ...

7.  *Ferscha et al. Lifecycle* [@P518]: sensing $\rightarrow$ transformation $\rightarrow$ representation $\rightarrow$ rule base $\rightarrow$ actuation $\rightarrow$ ...

8.  *MOSQUITO* [@P519]: context information discovery $\rightarrow$ context information acquisition $\rightarrow$ context information reasoning $\rightarrow$ ...

9.  *WCXMS Lifecycle* [@P024]: (context sensing $\rightarrow$ context transmission $\rightarrow$ context acquisition $\rightarrow$ ... ) $\rightarrow$ context classification $\rightarrow$ context handling $\rightarrow$ (context dissemination $\rightarrow$ context usage $\rightarrow$ context deletion $\rightarrow$ context request $\rightarrow$... ) $\rightarrow$ context maintenance $\rightarrow$ context disposition $\rightarrow$...

10. *Baldauf et al.* [@P402]: sensors $\rightarrow$ raw data retrieval $\rightarrow$ reprocessing $\rightarrow$ storage $\rightarrow$ application.

In addition to the life cycles, Bernardos et al. [@P302] identified three phases in a typical context management system: context acquisition, information processing, and reasoning and decision. After reviewing the above life cycles, we derived an appropriate (i.e. minimum number of phases but includes all essential) context life cycle as depicted in Figure \[Fig:Context\_Data\_Life\_Cycle\].

![This is the simplest form of a context life cycle. These four steps are essential in context management systems and middleware solutions. All the other functions that may offer by systems are value added services.[]{data-label="Fig:Context_Data_Life_Cycle"}](./Figures/09-Context_Data_Life_Cycle.pdf)

This context life cycle consists of four phases. First, context needs to be acquired from various sources. The sources could be physical sensors or virtual sensors (context acquisition). Second, the collected data needs to be modelled and represent according to a meaningful manner (context modelling). Third, modelled data needs to be processed to derive high-level context information from low-level raw sensor data (context reasoning). Finally, both high-level and low-level context needs to be distributed to the consumers who are interested in context (context dissemination). The following discussion is based on these four phases.

[ p[1.5cm]{} p[7.6cm]{} p[7.4cm]{} ]{}

Criteria

&

Push

&

Pull

\

Pros

&

Sensor hardware make the major decisions on sensing and communication

Can be both instant or interval sensing and communication

&

Software of the sensor data consumer makes the major decisions on sensing and communication

Decision on when to collect data is based on reasoning significant amount of data in software level

Can be both instant or interval sensing and communication

\

Cons

&

Decision on when to send data based on reasoning less amount of data

Sensors are required to program when the requirements are changed

&

More communication bandwidth is required where software level has to send data requests to the sensors all the time

\

Applicability

& Can be used when sensors know about when to send the data and have enough processing power and knowledge to reason locally. (e.g. event detection where one or small number of sensors can reason and evaluate the conditions by their own without software level complex data processing and reasoning.)

& Can be used when sensors do not have knowledge on when to send the data to the consumer. (e.g. event detection where large amount of data need to be collected, processed, and reasoned in order to recognize the event.)\

\[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Responsibility\]

[ p[1.5cm]{} p[7.5cm]{} p[7.5cm]{} ]{}

Criteria

&

Instant

&

Interval

\

Pros

&

Save energy due to no redundant network communications are involved

More accurate data can be gather as the network transmission would be triggered as soon as the conditions are met

&

Either sensors can be configured to sense and communicate with data consumers in a predefined frequency or the sensor data consumers can retrieve data explicitly from the sensors in a predefined frequency

Sensors do not need to be intelligent/knowledge or have significant processing and reasoning capabilities

Allows to understand the trends or behaviour by collecting sensor data over time

\

Cons

&

More knowledge is required to identify the conditions and the satisfaction of the conditions

Hardware level (i.e. sensor) or software level should know exactly what to look for

Difficult to detect events which require different types of data from number of different sensors

Comparatively consume more energy for data processing

&

May waste energy due to redundant data communication

Less accurate as the sensor readings can be change over the interval between two data communications

Reasoning need to be done in software level by the data consumer which will miss some occurrence of events due to above inaccuracy

\

Applicability

& Can be used to detect frost events or heat events in agricultural domain. In smart home domain, this method can be used to detect some one entering to a room via door sensors. Ideally, applicable for the situations where expected outcome is well-known by either hardware level (i.e. sensors) or software level & Can be used to collect data from temperature sensors for controlling air condition or measure air pollution where actions are not event oriented but monitoring oriented. Ideally, applicable for the situations where expected outcome is not known by either hardware level (i.e. sensors) or software level

\

\[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Frequency\]

[ p[1.5cm]{} p[5cm]{} p[5cm]{} p[5cm]{} ]{}

Criteria

&

Direct Sensor Access

&

Through Middleware

&

Through Context Server

\

Pros

&

Efficient as it allows direct communication with the sensors

Have more control over sensor configuration and data retrieval process

&

Easy to manage and retrieve context as most of the management tasks are facilitated by the middleware.

Can retrieve data faster with less effort and technical knowledge

&

Less resources required

Can retrieve data faster with less effort and technical knowledge

\

Cons

&

Significant technical knowledge is required including hardware level embedded device programming and configuring

Significant amount of time, effort, cost involved

Updating is very difficult due to tight bound between sensor hardware and consumer application

&

Require more resources (e.g. processing, memory, storage) as middleware solutions need to be employed

Less control over sensor configuration

Moderately efficient as data need to be retrieve through middleware

&

No control over sensor configuration

Less efficient as the context need to be pulled from server over the network

\

Applicability

& Can be used for small scale scientific experiments. Can also be used for situation where limited number of sensors are involved & IoT application will use this methods in most cases. Can be used in situations where large number of heterogeneous sensors are involved & Can be used in situations where significant amount of context are required but have only limited resources (i.e. cannot employ context middleware solutions due to resource limitations) that allows run the consumer application\

\[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Source\]

[ p[1.5cm]{} p[5cm]{} p[5cm]{} p[5cm]{} ]{}

Criteria

&

Physical Sensors

&

Virtual Sensors

&

Logical Sensors

\

Pros

&

Error detection is possible and relatively easy

Missing value identification is also relatively easy

Have access to low-level sensor configuration therefore can be more efficient

&

Provide moderately meaningful data

Provide high-level context information

Provided data are less processed

Do not need to deal with hardware level tasks

&

Provide highly meaningful data

Provide high-level context information

Usually more accurate

Do not need to deal with hardware level tasks

\

Cons

&

Hardware deployment and maintenance is costly

Have to deal with sensor and hardware level programming, design, development, test, debug

Provide less meaningful and low-level raw sensor data

&

Difficult to find errors in data

Filling missing values is not easy as they are mostly non-numerical and unpredictable

&

Difficult to find error in data

Filling missing values is not easy as they are mostly non-numerical

Do not have control over data production process

License fees and other restrictions may apply

\

Applicability

&

Can be used to collect physically observable phenomenon such as light, temperature, humidity, gas, etc.

&

Can be used to collect information that cannot be measure physically such as calendar details, email, chat, maps, contact details, social networking related data, user preferences, user behaviour, etc.

&

Can be used to collect information that are costly and impossible to collect directly through single physical sensor where advance processing and fusing data from multiple sensors are required (e.g. weather information, activity recognition, location recognition, etc.).

\

\[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Sensor\_Types\]

Context Acquisition {#chapter2:CDLC:Context Acquisition}
-------------------

In this section we discuss five factors that need to be considered when developing context-aware middleware solutions in the IoT paradigm. The techniques used to acquire context can be varied based on responsibility, frequency, context source, sensor type, and acquisition process.

### Based on Responsibility

Context (e.g. sensor data) acquisition can be primarily accomplished using two methods [@P334]: push and pull. A comparison is presented in Table \[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Responsibility\].

Pull: The software component which is responsible for acquiring sensor data from sensors make a request (e.g. query) from the sensor hardware periodically (i.e. after certain intervals) or instantly to acquire data.

Push: The physical or virtual sensor pushes data to the software component which is responsible to acquiring sensor data periodically or instantly. Periodical or instant pushing can be employed to facilitate a publish and subscribe model.

### Based on Frequency

Further, in the IoT paradigm, context can be generated based on two different event types: instant events and interval events \[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Frequency\].

Instant (also known as threshold violation): These events occur instantly. The events do not span across certain amounts of time. Open a door, switch on a light, or animal enters experimental crop field are some types of instant events. In order to detect this type of event, sensor data needs to be acquired when the event occurs. Both push and pull methods can be employed.

Interval (also known as periodically): These events span a certain period of time. Raining, animal eating a plant, or winter are some interval events. In order to detect this type of event, sensor data needs to be acquired periodically (e.g. sense and send data to the software every 20 seconds). Both push and pull methods can be employed.

### Based on Source

In addition, context acquisition methods can be categorised into three categories [@P419] based on where the context came from. A comparison is presented in Table \[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Source\].

Acquire directly from sensor hardware: In this method, context is directly acquired from the sensor by communicating with the sensor hardware and related APIs. Software drivers and libraries need to be installed locally. This method is typically used to retrieve data from sensors attached locally. Most devices and sensors today require some amount of driver support and can be connected via USB, COM, or serial ports. However, wireless technologies are becoming popular in the sensor community, which allows data transmission without driver installations. In the IoT paradigm most objects will communicate with each other via a wireless means.

Acquire through a middleware infrastructure: In this method, sensor (context) data is acquired by middleware solutions such as GSN. The applications can retrieve sensor data from the middleware and not from the sensor hardware directly. For example, some GSN instances will directly access sensor hardware and rest of the GSN instances will communicate with other GSN instances to retrieve data.

Acquire from context servers: In this method, context is acquired from several other context storages (e.g. databases, RSS (Really Simple Syndication) feeds, web services) via different mechanisms such as web service calls. This mechanism is useful when the hosting device of the context-aware application has limited computing resources. Resource-rich context servers can be used to acquire and process context.

### Based on Sensor Types {#chapter2:CDLC:CA:Based_on_Sensor_Types}

There are different types of sensors that can be employed to acquire context. In general usage, the term ‘sensor’ is used to refer to tangible sensor hardware devices. However, among the technical community, sensors are refer to as any data source that provides relevant context. Therefore, sensors can be divided into three categories [@P543]: physical, virtual, and logical. A comparison is presented in Table \[Tbl:Comparison\_of\_Context\_Acquisition\_Methods\_based\_on\_Sensor\_Types\].

Physical sensors: These are the most commonly used type of sensors and they are tangible. These sensors generate sensor data by themselves. Most of the devices we use today are equipped with a variety of sensor (e.g. temperature, humidity, microphone, touch). A discussion on commonly used sensor data types and sensors is presented in [@P544]. The data retrieved from physical sensors is called low-level context. They are less meaningful, trivial, and vulnerable to small changes. IoT solutions needs to understand the physical world using imperfect, conflicting and imprecise data.

Virtual sensors: These sensors do not necessarily generate sensor data by themselves. Virtual sensors retrieve data from many sources and publish it as sensor data (e.g. calendar, contact number directory, twitter statuses, email and chat applications). These sensors do not have a physical presence. They commonly use web services technology to send and receive data.

Logical sensors (also called software sensors): They combine physical sensors and virtual sensors in order to produce more meaningful information. A web service dedicated to providing weather information can be called a logical sensor. Weather stations use thousands of physical sensors to collect weather information. They also collect information from virtual sensors such as maps, calendars, and historic data. Finally, weather information is produced by combing both physical and virtual sensors. In addition, the android mobile operating system consists of a number of software sensors such as gravity, linear accelerometer, rotation vector, and orientation sensors.

### Based on Acquisition Process

There are three ways to acquire context: sense, derive, and manually provided.

Sense: The data is sensed through sensors, including the sensed data stored in databases (e.g. retrieve temperature from a sensor, retrieve appointments details from a calendar).

Derive: The information is generated by performing computational operations on sensor data. These operations could be as simple as web service calls or as complex as mathematical functions run over sensed data (e.g. calculate distance between two sensors using GPS coordinates). The necessary data should be available to apply any numerical or logical reasoning technique.

Manually provided: Users provide context information manually via predefined settings options such as preferences (e.g. understand that user doesn’t like to receive event notifications between 10pm to 6.00am). This method can be use to retrieve any type of information.

Context Modelling {#chapter2:CAF:Context Modelling}
-----------------

We discuss the basic definition of context modelling in Section \[chapter2:CAF:CARD:Definition\_of\_Context\_Model\_and\_Context\_Attribute\]. Context modelling is also widely refereed to as context representation. There are several popular context modelling in context-aware computing. Before we present the discussion on context modelling techniques, let’s briefly introduce context modelling fundamentals. Context models can be static or dynamic. Static models have a predefined set of context information that will be collected and stored [@P271]. The requirements that need to be taken into consideration when modelling context information are identified and explained in [@P216] as heterogeneity and mobility, relationships and dependencies, timeliness (also called freshness), imperfection, reasoning, usability of modelling formalisms, and efficient context provisioning. Typically, there are two steps in representing context according to a model:

Context modelling process: In the first step, new context information needs to be defined in terms of attributes, characteristics, relationships with previously specified context, quality-of context attributes and the queries for synchronous context requests.

Organize context according to the model: In the second step, the result of the context modelling step needs to be validated. Then the new context information needs to be merged and added to the existing context information repository. Finally, the new context information is made available to be used when required.

The first step performs the actual modelling of context. However, the factors and parameters that are considered for the modelling context are very subjective. It varies from one solution to another. We use two examples to demonstrate the variance. Currently, there is no standard to specify what type of information needs to be considered in context modelling. We discussed context categories proposed by the researcher in Section \[chapter2:CAF:context Types\]. Even though these categories provide high-level guidelines towards choosing relevant context, choosing specific context attributes is a subjective decision.

*Example 1:* MoCA [@P277] has used an object oriented approach to model context using XML. There are three sections in the proposed context model: structural information (e.g. attributes and dependencies among context types), behavioural information (e.g. whether the context attribute has a constant or variable value), and context-specific abstractions (e.g. contextual events and queries).

*Example 2:* W4 Diary [@P287] uses a W4 (who, what, where, when) based context model to structure data in order to extract high-level information from location data. For example, W4 represents context as tuples (e.g. Who: John, What: walking:4km/h, Where: ANU, Canberra, When: 2013-01-05:9.30am).

In the IoT paradigm, context information has six states [@P335]: ready, running, suspended, resumed, expired, and terminated. These states are also similar to the process states in an operating system. They align context to an event. An example scenario from the smart agriculture domain can be used to explain the state transition of context.

Ready: Every context is in the ready state at the initial stage (e.g. possible event can be ‘an animal eating crop’).

Suspended: When the context seems to be invalid temporally (e.g. sensors detect that animal stops eating crop temporarily).

Resumed: When the context becomes valid from being suspended (e.g. sensors detect animal starts to eat crop again).

Expired: When the context has expired and further information is not available (e.g. sensor data has not been received by the system for the last 60 seconds where all sensor data is considered to be expired (based on policy) within 20 seconds from the time it is collected).

Terminated: When the context is no longer valid (i.e. inferred something else) and further information is not available (e.g. sensors detects that animal moves away from the crops).

[ m[0.05cm]{} m[6.5cm]{} m[10cm]{} ]{}

&

RDF(S)

&

OWL(2)

\

Pros

&

Provide basic elements to describe and organize knowledge. Further, OWL is build on top of RDFS

Relatively simple

Faster processing and reasoning

&

Improved version of RDFS. Therefore adaptability from RDF(S) to OWL is high

Increasing number of tools are supported

More expressive (e.g. larger vocabulary/constraints, rules, more meaningful)

Higher machine interoperability (e.g. strong syntax)

W3C approved standard for semantics (since 2004)

Comes in three versions (i.e. OWL light, OWL DL, OWL Full) where each one has more expressive and reasoning power that previous

\

Cons

&

Lack of inconsistency checking and reasoning

Limited expressiveness (e.g. no cardinality support)

&

Relatively Complex

Low performance (e.g. require more computation power and time)

\

\[Tbl:Comparison of Semantic Technologies\]

The most popular context modelling techniques are surveyed in [@P431; @P184]. These surveys discuss a number of systems that have been developed based on the following techniques. Each of the following techniques has its own strengths and weaknesses. We discuss context modelling techniques at a high-level. The actual implementations of these techniques can vary widely depending on application domain (e.g. implementation details may differ from embedded environments to mobile environments to cloud based environments). Therefore, our focus is on conceptual perspective of each modelling technique no on specific implementation. Our discussion is based on the six most popular context modelling techniques: *key-value, markup schemes, graphical, object based, logic based,* and *ontology based modelling*. A comparison of these models is presented in Table \[Tbl:Comparison\_of\_Context\_Modelling\_and\_Representation\_Techniques\].

### Key-Value Modelling

It models context information as key-value pairs in different formats such as text files and binary files. This is the simplest form of context representation among all the other techniques. They are easy to manage when they have smaller amounts of data. However, key-value modelling is not scalable and not suitable to store complex data structures. Further, hierarchical structures or relationships cannot be modelled using key-value pairs. Therefore, lack of data structuring capability makes it difficult to retrieve modelled information efficiently. Further, attaching meta information is not possible. The key-value technique is an application oriented and application bounded technique that suits the purpose of temporary storage such as less complex application configurations and user preferences.

### Markup Scheme Modelling (Tagged Encoding)

It models data using tags. Therefore, context is stored within tags. This technique is an improvement over the key-value modelling technique. The advantage of using markup tags is that it allows efficient data retrieval. Further, validation is supported through schema definitions. Sophisticated validation tools are available for popular markup techniques such as XML. Range checking is also possible up to some degree for numerical values. Markup schemas such as XML are widely used in almost all application domains to store data temporarily, transfer data among applications, and transfer data among application components. In contrast, markup languages do not provide advanced expressive capabilities which allow reasoning. Further, due to lack of design specifications, context modelling, retrieval, interoperability, and re-usability over different markup schemes can be difficult. A common application of markup based modelling is modelling profiles. Profiles are commonly developed using languages such as XML. However, the concept of markup languages are not restricted only to XML. Any language or mechanism (e.g. JSON) that supports tag based storage allows markup scheme modelling. An example of popular markup scheme modelling is Composite Capabilities/Preference Profiles (CC/PP) [@P529]. There are a significant number of similar emerging applications such as ContextML [@P423] in context-aware computing. Tuples are also used to model context [@P271].

### Graphical Modelling

It models context with relationships. Some examples of this modelling technique are Unified Modelling Language (UML) [@P530] and Object Role Modelling (ORM) [@P531]. In terms of expressive richness, graphical modelling is better than markup and key-value modelling as it allows relationships to be captured into the context model. Actual low-level representation of the graphical modelling technique could be varied. For example, it could be a SQL database, noSQL database, XML, etc. Many other extensions have also been proposed and implemented using this technique [@P389]. Further, as we are familiar with databases, graphical modelling is a well known, easy to learn, and easy to use technique. Databases can hold massive amounts of data and provide simple data retrieval operations, which can be performed relatively quickly. In contrast, the number of different implementations (i.e. different databases and other solutions) makes it difficult with regards to interoperability. Further, there are limitations on data retrieval mechanisms such as SQL. In addition, sophisticated context retrieval requirements may demand very complex SQL queries to be employed. The queries can be difficult to create, use, and manage even with the sophisticated tools that exist today. Adding context information and changing the data structure is also difficult in later stages. However, some of the recent trends and solutions in the noSQL [@P556] movement allows these structure alteration issues to be overcome. Therefore, graphical modelling techniques can be used as persistent storage of context.

### Object Based Modelling

Object based (or object oriented) concepts are used to model data using class hierarchies and relationships. Object oriented paradigm promotes encapsulation and re-usability. As most of the high-level programming languages support object oriented concepts, modelling can integrated into context-aware systems easily. Therefore, object based modelling is suitable to be used as an internal, non-shared, code based, run-time context modelling, manipulation, and storage mechanism. However, it does not provide inbuilt reasoning capabilities. Validation of object oriented designs is also difficult due to the lack of standards and specifications.

### Logic Based Modelling

Facts, expressions, and rules are used to represent information about the context. Rules are used by other modelling techniques, such as ontologies, as well. Rules are primarily used to express policies, constraints, and preferences. It provides much more expressive richness compared to the other models discussed previously. Therefore, reasoning is possible up to a certain level. The specific structures and languages that can be used to model context using rules are varied. However, lack of standardisation reduces the re-usability and applicability. Furthermore, highly sophisticated and interactive graphical techniques can be employed to develop logic based or rule based representations. As a result, even non-technical users can add rules and logic to the systems during run time. Logic based modelling allows new high-level context information to be extracted using low-level context. Therefore, it has the capability to enhance other context modelling techniques by acting as a supplement.

### Ontology Based Modelling

The context is organised into ontologies using semantic technologies. A number of different standards (RDF, RDFS, OWL) and reasoning capabilities are available to be used depending on the requirement. A wide range of development tools and reasoning engines are also available. However, context retrieval can be computationally intensive and time consuming when the amount of data is increased. According to many surveys, in context-aware computing and sensor data management, ontologies are the preferred mechanism of managing and modelling context despite its weaknesses. Due to its popularity and wider adaptation during the last five years in both academia and industry we present a brief discussion on semantic modelling and reasoning. However, our intention is not to survey semantic technologies but to highlight the applicability of semantics in a context-aware domain from an IoT perspective. Comprehensive and extensive amounts of information on semantic technology are available in [@P557; @P558; @P378].

\[chapter2:CAF:CM:Ontology\_Based\_Modelling\]

[ m[1.2cm]{} m[4.8cm]{} m[4.8cm]{} m[5.5cm]{} ]{}

Techniques

&

Pros

&

Cons

&

Applicability

\

Key-Value

&

Simple

Flexible

Easy to manage when small in size

&

Strongly coupled with applications

Not scalable

No structure or schema

Hard to retrieve information

No way to represent relationships

No validation support

No standard processing tools are available

& Can be used to model limited amount of data such as user preferences and application configurations. Mostly independent and non-related pieces of information. This is also suitable for limited data transferring and any other less complex temporary modelling requirements.

\

Markup Scheme Tagged Encoding (e.g. xml)

&

Flexible

More structured

Validation possible through schemas

Processing tools are available

&

Application depended as there are no standards for structures

Can be complex when many levels of information are involved

Moderately difficult to retrieve information

& Can be used as intermediate data organisation format as well as mode of data transfer over network. Can be used to decouple data structures used by two components in a system. (e.g. SensorML [@P256] for store sensor descriptions, JSON as a format to data transfer over network)\

Graphical (e.g. databases)

&

relationships modelling

Information retrieval is moderately easier

Different standards and implementations are available.

Validation possible through constraints

&

Querying can be complex

Configuration may be required

Interoperability among different implementation is difficult

No standards but governed by design principles

& Can be used for long term and large volume of permanent data archival. Historic context can be store in databases.\

Object Based

&

relationships modelling

Can be well integrated using programming languages

Processing tools are available

&

Hard to retrieve information

No standards but govern by design principles

Lack of validation

& Can be used to represent context in programming code level. context runtime manipulation. Very short term, temporary, and mostly stored in computer memory. Also support data transfer over network.\

Logic Based

&

to generate high-level context using low-level context

Simple to model and use

support logical reasoning

Processing tools are available

&

No standards

Lack of validation

Strongly coupled with applications

& Can be used to generate high-level context using low-level context (i.e. generate new knowledge), model events and actions (i.e. event detection), and define constrains and restrictions.

\

Ontology Based

&

Support semantic reasoning

more expressive representation of context

Strong validation

Application independent and sharing

Strong support by standardisations

Fairly sophisticated tools available

&

Representation can be complex

Information retrieval can be complex and resource intensive

& Can be used to model domain knowledge and structure context based on the relationships defined by the ontology. Rather than storing data on ontologies, data can be stored in appropriate data sources (i.e. databases) while structure is provided by ontologies.\

\[Tbl:Comparison\_of\_Context\_Modelling\_and\_Representation\_Techniques\]

Khoo [@P057] has explained the evolution of the web in four stages: basic Internet as Web 1.0, social media and user generated content as web 2.0, semantic web as web 3.0 and IoT as web 4.0. In this identification, semantic web has been given a separate phase to show its importance and the significant changes that semantic technologies can bring to the web in general.

Ontology is the main component in semantic technology that allows it to model data. Based on the previous approaches and survey [@P184], one of the most appropriate formats to manage context is ontologies. Ontologies offer an expressive language to represent the relationships and context. IT also provides comprehensive reasoning mechanisms as well. Ontologies also allow knowledge sharing and they decouple the knowledge from the application and program codes [@P419].

There are several reasons to develop and use ontologies in contrast to other modelling techniques. The most common reasons are to [@P191; @P447] share a common understanding of the structure of information among people or software agents, analyse domain knowledge, separate domain knowledge from operational knowledge, enable reuse of domain knowledge, high-level knowledge inferring, and make domain assumptions explicit. Due to the dynamic nature, the IoT middleware solutions should support applications which are not even known at the middleware design-time. Ontologies allow the integration of knowledge on different domains into applications when necessary.

Studer et al. [@P546] defined the concept of ontology as follows. *“An ontology is a formal, explicit specification of a shared conceptualisation. A conceptualisation refers to an abstract model of some phenomenon in the world by having identified the relevant concepts of that phenomenon. Explicit means that the type of concepts used, and the constraints on their use are explicitly defined. For example, in medical domains, the concepts are diseases and symptoms, the relations between them are causal and a constraint is that a disease cannot cause itself. Formal refers to the fact that the ontology should be machine readable, which excludes natural language. Shared reflects the notion that an ontology captures consensual knowledge, that is, it is not private to some individual, but accepted by a group.”* Another acceptable definition has been presented by Noy and McGuinness [@P447]. Further ontologies are discussed extensively as principles, methods, and applications in perspective [@P445].

Some of the requirements and objectives behind designing an ontology are simplicity, flexibility and extensibility, generality, and expressiveness [@P545]. In addition, some of the general requirements in context modelling and representation are unique identification, validation, reuse, handling uncertainty, and incomplete information [@P185]. A further eight principles for developing ontologies are identified by Korpipaa and Mantyjarvi [@P034] as: domain, simplicity, practical access, flexibility and expandability, facilitate inference, genericity, efficiency, and expressiveness.

Ontologies consists of several common key components [@P197; @P332] such as individuals, classes, attributes, relations, function terms, restrictions, rules, axioms, and events. Furthermore, there are two steps in developing ontologies. First, the domain and scope need to be clearly defined. Then existing ontologies need to be reviewed to find the possibilities of leverage existing in ontologies. One of the main goals of ontologies is the reusability of shared knowledge. By the time this survey was prepared, there were several popular domains that design, develop, and use ontologies. Sensor domain is one of them. A survey of the semantic specification of sensors is presented in [@P103]. They have evaluated and compared a number of ontologies and their capabilities.

There are several popular semantic web ontology languages that can be used to develop ontologies: RDF [@P252], RDFS [@P559], OWL [@P148]. The current recommendation is OWL 2 which is an extended version of OWL. A significant amount of OWL usage has been noticed in the context modelling ad reasoning domain [@P185]. It further emphasises the requirement of having the modelling language, reasoning engines, and mechanism to define rules as a bundle, rather than choosing different available options arbitrarily, to get the real power of semantic technologies. SWRL is one of the available solutions to add rules in OWL [@P216]. SWRL is not a hybrid approach as it is fully integrated into ontological reasoning. In contrast, when the amount of data becomes larger and structure becomes complex, ontologies can becomes exceedingly complex causing the reasoning process to be resource intensive and slow. However, some of the main reasons to choose OWL as the context modelling mechanism are [@P419; @P332].

W3C strongly supports the standardisation of OWL. Therefore, a variety of development tools are available for integrating and managing OWL ontologies, which makes it easier to develop and share.

OWL allows interoperability among other context-aware systems. These features, such as classes, properties and constraints, and individuals are important for supporting ontology reuse, mapping and interoperability.

OWL supports a high-level of inference / reasoning support.

OWL is more expressive. For example, it provides cardinality constraints, which enables imposing additional restrictions on the classes.

We compare the two most popular web ontology languages, RDF(S) and OWL(2) in Table \[Tbl:Comparison of Semantic Technologies\], to highlight the fundamental differences.

![image](./Figures/43-Model_Types_Survey.pdf)

After evaluating several context modelling techniques, it was revealed that incorporating multiple modelling techniques is the best way to produce efficient and effective results, which will mitigate each other’s weaknesses. Therefore, no single modelling technique is ideal to be used in a standalone fashion. There is a strong relationship between context modelling and reasoning. For example, some reasoning techniques prefer some modelling techniques. However, it should not limit the employability of different context reasoning and modelling techniques together. In the next section we discuss reasoning context-aware computing.

Context Reasoning Decision Models {#chapter2:CAF:Context Reasoning Decision Models}
---------------------------------

Context reasoning can be defined as a method of deducing new knowledge, and understanding better, based on the available also be explained as a process of giving high-level context deductions from a set of contexts [@P331]. The requirement of reasoning also emerged due to two characteristics of raw context: imperfection (i.e. unknown, ambiguous, imprecise, or erroneous) and uncertainty. Reasoning performance can be measured using efficiency, soundness, completeness, and interoperability [@P185]. Reasoning is also called inferencing. Contest reasoning comprises several steps. Broadly we can divide them into three phases [@P214].

Context pre-processing: This phase cleans the collected sensor data. Due to inefficiencies in sensor hardware and network communication, collected data may be not accurate or missing. Therefore, data needs to be cleaned by filling missing values, removing outliers, validating context via multiple sources, and many more. These tasks have been extensively researched by database, data mining, and sensor network research communities over many years.

Sensor data fusion: It is a method of combining sensor data from multiple sensors to produce more accurate, more complete, and more dependable information that could not be achieve through a single sensor [@P248]. In the IoT, fusion is extremely important, because there will be billions of sensors available. As a result, a large number of alternative sources will exist to provide the same information.

Context inference: Generation of high-level context information using lower-level context. The inferencing can be done in a single interaction or in multiple interactions. Revisiting an example from a different perspective, W4 Diary [@P287] represented context as tuples John, What: walking:4km/h, Where: ANU,Canberra, When: 2013-01-05:9.30am). This low-level context can be inferred through a number of reasoning mechanisms to generate the final results. For example, in the first iteration, longitude and latitude values of a GPS sensor may be inferred as *PurplePickle cafe in canberra*. In the next iteration *PurplePickle cafe in canberra* may be inferred as *John’s favourite cafe*. Each iteration gives more accurate and meaningful information.

There are a large number of different context reasoning decision models, such as decision tree, naive Bayes, hidden Markov models, support vector machines, k-nearest neighbour, artificial neural networks, Dempster-Shafer, ontology-based, rule-based, fuzzy reasoning and many more. Most of the models originated and are employed in the fields of artificial intelligence and machine learning. Therefore, these models are not specific to context-reasoning but commonly used across many different fields in computing and engineering.

We present the results of a survey conducted by Lim and Dey [@P384] in Figure \[Fig:Survey\_on\_Context\_Reasoning\_Techniques\]. They have investigated the popularity of context reasoning decision models. The survey is based on literature from three major conferences over five years: Computer-Human Interaction (CHI) 2003-2009, Ubiquitous Computing (Ubicomp) 2004-2009, and Pervasive 2004-2009.

In the IoT paradigm, there are many sensors that sense and produce context information. The amount of information that will be collected by over 50 billion sensors is enormous. Therefore, using all this context for reasoning in not feasible for many reasons, such as processing time, power, storage, etc. Furthermore, Guan et al. [@P331] has proved that using more context will not necessarily improve the accuracy of the inference in a considerable manner. They have used two reasoning models in their research: back-propagation neural networks and k-nearest neighbours. According to the results, 93% accuracy has been achieved by using ten raw context. Adding 30 more raw context to the reasoning model has increased the accuracy by only 1.63%. Therefore, selecting the appropriate raw context for reasoning is critical to infer high-level context with high accuracy.

Context reasoning has been researched over many years. The most popular context reasoning techniques (also called decision models) are surveyed in [@P185; @P216; @P215]. Our intention in this paper is not to survey context reasoning techniques but to briefly introduce them so it will help to understand and appreciate the role of context reasoning in the IoT paradigm. We classify context reasoning techniques broadly into six categories: *supervised learning, unsupervised learning, rules, fuzzy logic, ontological reasoning* and *probabilistic reasoning*. A comparison of these techniques is presented in Table \[Tbl:Context\_Reasoning\_Decision\_Models\]

[ m[2.1cm]{} m[4.8cm]{} m[4.5cm]{} m[5cm]{} ]{}

Techniques

&

Pros

&

Cons

&

Applicability

\

Supervised Learning (Artificial neural network, Bayesian Networks, Case-based reasoning, Decision tree learning, Support vector machines)

&

Fairly accurate

Number of alternative models are available

Have mathematical and statistical foundation

&

Require significant amount of data

Every data element need to be converted in to numerical values

Selecting feature set could be challenging

Can be more resource intensive (processing, storage, time)

less semantic so less meaningful

Training data required

Models can be complex

Difficult to capture existing knowledge

& For situation where the feature set is easily identifiable, possible out comes are known, and large data sets (for training as well) are available in numerical terms. (For example: activity recognition, missing value identification)

\

Unsupervised Learning (Clustering, k-Nearest Neighbour)

&

No training data required

No need to know the possible outcome

&

Models can be complex

Less semantic so less meaningful

Difficult to validate

Outcome is not predictable

Can be more resource intensive (processing, storage, time)

& For situations where possible out comes are not known (For example: unusual behaviour detection, analysing agricultural fields to identify appropriate location to plant a specific type of crop)

\

Rules

&

Simple to define

Easy to extend

Less resource (e.g. processing, storage) intensive

&

Should define manually

Can be error prone due to manual work

No validation or quality checking

& For situations where raw data elements need to be converted in to high level context information. Suitable to be used to define events.\

Fuzzy Logic

&

Allow more natural representation

Simple to define

Easy to extend

Less resource (e.g. processing, storage) intensive

Can handle uncertainty

&

Should define manually

Can be error prone due to manual work

No validation or quality checking

May reduce the quality (e.g. precision) of the results due to natural representation

& For situation where low-level context need to be converted in to high-level more natural context information. This type of simplification will make it easy to process further. For example, control automated irrigation system where water will be released when the system detect the soil is ‘dry’\

Ontology based (First-Order Predicate Logic)

&

Allow complex reasoning

Allow complex representation

More meaningful results

Validation and quality checking is possible

Can reason both numerical and textual data

&

Data need to be modelled in a compatible format (e.g. OWL, RDF)

Limited numerical reasoning

Low performance (e.g. require more computation power and time)

& For situations where knowledge is critical. For example, store and reason domain knowledge about agricultural domain. It allows the context information to be store according to the ontology structure and automatically reason later when required\

Probabilistic logic (Dempster-Shafer, hidden Markov Models, naive Bayes)

&

Allows to combine evidence

Can handle unseen situations

Alternative models are available

Can handle uncertainty

provide moderately meaningful results

&

Should know the probabilities

Reason numerical values only

& For situations where probabilities are known and combing evidence from different sources are essential. For example, evidence produced from a camera, infra-red sensors, acoustics sensor, and motion detector can be combined to detect a wind animal infiltrate to a agricultural field\

\[Tbl:Context\_Reasoning\_Decision\_Models\]

### Supervised learning

In this category of techniques, we first collect training examples. Then we label them according to the results we expect. Then we derive a function that can generate the expected results using the training data. This technique is widely used in mobile phone sensing [@P217] and activity recognition [@P187]. *Decision tree* is a supervised learning technique where it builds a tree from a dataset that can be used to classify data. This technique has been used to develop a student assessment system in [@P561]. *Bayesian Networks* is a technique based on probabilistic reasoning concepts. It uses directed acyclic graphs to represent events and relationships among them. It is a widely used technique in statistical reasoning. Example applications are presented in [@P197; @P289]. Bayesian networks are commonly used in combining uncertain information from a large number of sources and deducing higher-level contexts. *Artificial neural networks* is a technique that attempts to mimic the biological neuron system. They are typically used to model complex relationships between inputs and outputs or to find patterns in data. Body sensor networks domain has employed this technique for pervasive healthcare monitoring in [@P267]. *Support vector machines* are widely used for pattern recognition in context-aware computing. It has been used to detect activity recognition of patients in the healthcare domain [@P562] and to learn situations in a smart home environment [@P209].

### Unsupervised learning

This category of techniques can find hidden structures in unlabelled data. Due to the use of no training data, there is no error or reward signal to evaluate a potential solution. Clustering techniques such as *K-Nearest Neighbour* is popularly used in context-aware reasoning. Specifically, clustering is used in low-level (sensor hardware level) sensor network operations such as routing and high level tasks such as indoor and outdoor positioning and location [@P565]. Unsupervised neural network techniques such as Kohonen Self-Organizing Map (KSOM) are used to classify incoming sensor data in a real-time fashion [@P566]. Noise detection and outlier detection are other applications in context-aware computing. Applications of unsupervised learning techniques in relation to body sensor networks are surveyed in [@P267]. The unsupervised clustering method has been employed to capturing user contexts by dynamic profiling in [@P268].

### Rules

This is the simplest and most straightforward methods of reasoning out of all of them. Rules are usually structure in an IF-THEN-ELSE format. This is the most popular method of reasoning according to Figure \[Fig:Survey\_on\_Context\_Reasoning\_Techniques\]. It allows the generation of high level context information using low level context. Recently, rules have been heavily used when combined with ontological reasoning [@P243; @P420; @P421]. MiRE [@P298] is a minimal rule engine for context-aware mobile devices. Most of the user preferences are encoded using rules. Rules are also used in event detection [@P136; @P128]. Rules are expected to play a significant role in the IoT, where they are the easiest and simplest way to model human thinking and reasoning in machines. PRIAMOS [@P139] has used semantic rules to annotate sensor data with context information. Application of rule based reasoning is clearly explained in relation to context-aware I/O control in [@P567].

### Fuzzy logic

This allows approximate reasoning instead of fixed and crisp reasoning. Fuzzy logic is similar to probabilistic reasoning but confidence values represent degrees of membership rather than probability [@P444]. In traditional logic theory, acceptable truth values are 0 or 1. In fuzzy logic partial truth values are acceptable. It allows real world scenarios to be represented more naturally; as most real world facts are not crisp. It further allows the use of natural language (e.g. temperature: slightly warm, fairly cold) definitions rather than exact numerical values (e.g. temperature: 10 degrees Celsius). In other words it allows imprecise notions such as tall, short, dark, trustworthy and confidence to be captured, which is critical in context information processing. In most cases, fuzzy reasoning cannot be used as a standalone reasoning technique. It is usually used to complement another techniques such as rules based, probabilistic or ontological reasoning. Gaia [@P568] has used fuzzy logic in context providers to handle uncertainty. Several examples of applying fuzzy logic to represent context information are presented in [@P547; @P548].

### Ontology based

: It is based on description logic, which is a family of logic based knowledge representations of formalisms. Ontological reasoning is mainly supported by two common representations of semantic web languages: RDF(S) [@P252] and OWL(2) [@P148]. We discussed ontology based modelling in Section \[chapter2:CAF:CM:Ontology\_Based\_Modelling\]. Semantic web languages are also complemented by several semantic query languages: RDQL, RQL, TRIPLE and number of reasoning engines: FACT [@P253], RACER, Pellet [@P150]. Rules such as SWRL [@P243] are increasingly popular in ontological reasoning. The advantage of ontological reasoning is that it integrates well with ontology modelling. In contrast, a disadvantage is that ontological reasoning is not capable of finding missing values or ambiguous information where statistical reasoning techniques are good at that. Rules can be used to minimise this weakness by generating new context information based on low-level context. Missing values can also be tackled by having rules that enable missing values to be replaced with suitable predefined values. However, these mechanism will not perform accurately in highly dynamic and uncertain domains. Ontological reasoning is heavily used in a wide range of applications, such as activity recognition [@P187], hybrid reasoning [@P187], and event detection [@P128]. A survey on semantic based reasoning is presented in [@P215]. It also compares a number of context aware frameworks based on modelling technique, reasoning techniques, and architectures used in their systems. Comprehensive and extensive amounts of information on semantic technology are available in [@P557; @P558; @P378]. In addition, a semantic based architecture for sensor data fusion is presented in [@P072; @P073; @P071].

### Probabilistic logic

This category of techniques allows decisions to be made based on probabilities attached to the facts related to the problem. It can be used to combine sensor data from two different sources. Further, it can be used to identify resolutions to conflicts among context. Most often these techniques are used to understand occurrence of events. Probabilistic logic has been used in [@P444] to encode access control policies. *Dempster-Shafer*, which is based on probabilistic logic, allows different evidence to be combined to calculate the probability of an event. Dempster-Shafer is commonly used in sensor data fusion for activity recognition. In [@P548; @P238], it has been used to understand whether there is a meeting in the room. Other example applications are presented in [@P236; @P235]. *hidden Markov Models [@P553]* are also a probabilistic technique that allows state to be represented using observable evidence without directly reading the state. For example, it provides a method to bridge the gap between raw GPS sensor measurements and high level information such as a user destination, mode of transportation, calendar based observable evidence such as user calendar, weather, etc. hidden Markov Models are commonly used in activity recognition in context-aware domains. For example, it has been used to learn situation models in a smart home [@P209].

Up to now, we have presented and discussed a number of context modelling and reasoning techniques. However, it is clear that each technique has its own strengths and weakness. No single technique can be used to accomplish perfect results. Therefore, the best method to tackle the problem of context awareness it to combine multiple models in such a way that, as a whole, they reduce weaknesses by complementing each other. For example, Alternative Context Construction Trees (ACCT) [@P326] is an approach that enables the concurrent evaluation and consolidation of different reasoning models such as logic rules, Bayesian networks and CoCoGraphs [@P560]. There are two reasons that context information can become uncertain, as discussed in \[chapter2:CDLC:ESRF:QCRV\]. Therefore, employing or incorporating strategies that can reason under uncertainty such as Bayesian networks, Dempster-Shafer or fuzzy logic is essential in such situations. The process of how the multiple techniques can be combined together is presented in [@P216; @P463]. We briefly explain the hybrid context modelling and reasoning approach as follows.

At the lowest level, statistical techniques can be used to fuse sensor data. Then, fuzzy logic can be employed to convert fixed data in to more natural terms. In the future, Dempster-Shafer can be used to combine sensor data from different sources. In addition, machine learning techniques, such as support vector machines and artificial neural networks, can be used for further reasoning. After completing statistical reasoning, the high level data can be modelled using semantic technologies such as ontologies. Ontological reasoning can be applied to infer additional context information using domain knowledge at the higher level. A similar process is explained in detail in [@P463].

Context Distribution {#chapter2:CAF:Context Distribution}
--------------------

Context distribution is a fairly straightforward task. It provides methods to deliver context to the consumers. From the consumer perspective this task can be called context acquisition, where the discussion we presented in Section \[chapter2:CDLC:Context Acquisition\] is completely applicable. Therefore all the factors we discussed under context acquisition need to be considered for context distribution as well. Other than that there are two other methods to that are used commonly in context distribution:

Query: Context consumer makes a request in terms of a query, so the context management system can use that query to produce results.

Subscription (also called publish / subscribe): Context consumer can be allowed to subscribe with a context management system by describing the requirements. The system will then return the results periodically or when an event occurs (threshold violation). In other terms, consumers can subscribe for a specific sensor or to an event. However, in underline implementations, queries may also use to define subscriptions. Further, this method is typically use in real time processing.

Existing Research Prototypes and Systems {#chapter2:PRE}
========================================

In this section, first we present our evaluation framework and then we briefly discuss some of the most significant projects and highlight their significance. Later, we identify the lessons we can learn from them towards context-aware development in the IoT paradigm in Section \[chapter2:LL\]. The projects are discussed in the same order as in Table \[Tbl:Evaluation\_of\_Previous\_Research\_Efforts\]. Our taxonomy is summarized in Table \[Tbl:Summarized taxonmy\].

Evaluation Framework {#chapter2:CDLC:Evaluation of Surveyed Research Efforts}
--------------------

We used abbreviations as much as possible to make sure that the structure allowed all 50 projects to be presented in a single page, which enables the readers to analyse and identify positive and negative patterns that we have not explicitly discussed. In Table \[Tbl:Evaluation\_of\_Previous\_Research\_Efforts\], we use a dash ([–]{}) symbol across all columns to denote that the functionality is either missing or not mentioned in related publications that are available. In order to increase the readability, we have numbered the columns of the Table \[Tbl:Evaluation\_of\_Previous\_Research\_Efforts\] corresponding to the taxonomy numbered below. Our taxonomy and several other features that will provide additional value in IoT solutions are visually illustrated in Figure \[Fig:Taxonomy\_and\_Conceptual\_Framework\].

### **Project Name**

This is the name given to the project by the authors of the related publications. Most of the project names are abbreviations that are used to refer to the project. However, some project do not have an explicit project name, here we used a dash ([–]{}) symbol.

### **Citation**

We provide only one citation due to space limitations. Other citations are listed under each project’s descriptions and highlights in Section \[chapter2:PRE\].

### **Year**

Table \[Tbl:Evaluation\_of\_Previous\_Research\_Efforts\] is ordered according to chronological order (i.e. from oldest to newest) based on the year of publication.

### **Project Focus**

Based on our evaluation, each project has its own focus on whether to build a system, a toolkit, or a middleware solution. The following abbreviations are used to denote the focus: system (S), toolkit (T), and middleware (M). Systems focus on developing an end-to-end solution where it involves hardware, software and application layer. Systems cannot be used as middleware. It is designed to provide one or a few tasks. Building different functionalities on top of the system is not an option. Systems are designed and developed for a use by the end users. Toolkits are not designed to be used by the end users. They are employed by system, application, and middleware developers. They provide very specific functionalities. Toolkits are usually designed according to well-known design principles and standards and always released with proper documentation that shows how to use them at programming code level. Middleware [@P064] can be explained as a software layer that lies between the hardware and application layers. It provides reusable functionalities that are required by the application to meet complex customer requirements. They are usually built to address common issues in application development such as heterogeneity, interoperability, security, and dependability. A goal of middleware is to provide a set of programming abstractions to help software development where heterogeneous components need to be connected and communicate together. Middleware is designed to be used by application developers, where the middleware solution handles most of the common functionalities leaving more time and effort for the application developers to deal with application functionalities.

### **Modelling**

This has been discussed in detail in Section \[chapter2:CAF:Context Modelling\]. We use the following abbreviations to denote the context modelling techniques employed by the project: key-value modelling (K), markup Schemes (M), graphical modelling (G), object oriented modelling (Ob), logic-based modelling (L), and ontology-based modelling (On).

### **Reasoning**

This has been discussed in detail in Section \[chapter2:CAF:Context Reasoning Decision Models\]. We use the following abbreviations to denote the context reasoning techniques employed by the project: supervised learning (S), un-supervised learning (U), rules (R), fuzzy logic (F), ontology-based (O), and probabilistic reasoning (P). The symbol ($\checkmark$) is used where reasoning functionality is provided but the specific technique is not mentioned.

### **Distribution**

This has been discussed in detail in Section \[chapter2:CAF:Context Distribution\]. We use the following abbreviations to denote the context distribution techniques employed by the project: publish/subscribe (P) and query (Q).

### **Architecture**

This varied widely from one solution to another. Architecture can be classified into different categories based on different perspectives. Therefore, there is no common classification scheme that can be used for all situations. We consider the most significant architectural characteristics to classify the solution. Different architectural styles are numbered as follows. (1) Component based architecture where the entire solution is based on loosely coupled major components, which interact each other. For example, Context Toolkit [@P143] has three major components which perform the most critical functionalities of the system. (2) Distributed architecture enables peer-to-peer interaction in a distributed fashion, such as in Solar [@P569]. (3) Service based architecture where the entire solution consists of several services working together. However, individual access to each service may not be provided in solutions such as Gaia [@P444]. (4) Node based architecture allows to deployment of pieces of software with similar or different capabilities, which communicate and collectively process data in sensor networks [@P344]. (5) Centralised architecture which acts as a complete stack (e.g. middleware) and provides applications to be developed on top of that, but provides no communication between different instances of the solution. (6) Client-server architecture separates sensing and processing from each other, such as in CaSP [@P317].

### **History and Storage**

Storing context history is critical [@P290] in both traditional context-aware computing and the IoT. Historic data allows sensor data to be better understood. Even though most of the IoT solutions and applications are focused on real time interaction, historic data has its own role to play. Specifically, it allows user behaviours, preferences, patterns, trends, needs, and many more to be understood. In contrast, due to the scale of the IoT, storing all the context for the long term may not feasible. However, storage devices are getting more and more powerful and cheap. Therefore, it would be a tradeoff between cost and understanding. The symbol ($\checkmark$) is used denote that context history functionality is facilitated and employed by the project.

### **Knowledge Management**

This functionality is broader than any others. Most of the tasks that are performed by IoT middleware solutions require knowledge in different perspectives, such as knowledge on sensors, domains, users, activities, and many more. One of the most popular techniques to represent knowledge in context-aware computing is using ontologies. However, several other techniques are also available such as rules. Knowledge can be used for tasks such as automated configuration of sensors to IoT middleware, automatic sensor data annotation, reasoning, and event detection. The symbol ($\checkmark$) is used to denote that knowledge management functionality is facilitated and employed by the project in some perspective.

### **Event Detection** {#chapter2:CDLC:ESRF:Event_Detection}

This is one of the most important functionalities in IoT solutions. IoT envisions machine-to-machine (M2M) and machine-to-person communication. Most of these interactions are likely to occur based on an event. Events can referred to many things, such as an observable occurrence, phenomenon, or an extraordinary occurrence. We define one or more conditions and identify it as an occurrence of an event once all the defined conditions are satisfied. In the IoT, sensors collect data and compare it with conditions to decide whether the data satisfies the conditions. An occurrence event is also called a *event trigger*. Once an event has been triggered, a notification or action may be executed. For example, detecting current activity of a person or detecting a meeting status in a room, can be considered as events. Mostly, event detection needs to be done in real-time. However, events such as trends may be detected using historic data. The symbol ($\checkmark$) is used to denote that event detection functionality is facilitated and employed by the project in some perspective.

### **Context Discovery and Annotation**

We use the following abbreviations to denote context discovery and annotation facilitated and employed by the project: context discovery (D) and context annotation (A). Context annotation allows context related information and raw sensors data to be attached, modelled, and stored. Some of the most common and basic information that needs to be captured in relation to context are context type, context value, time stamp, source, and confidence. Context-aware geographical information retrieval approach [@P421] has proposed a mechanism to map raw sensor data to semantic ontologies using SWRL. This is critical in all types of systems. Even though, statistical reasoning systems can use raw sensor data directly, semantic mapping before the reasoning allows more information to be extracted. Context information only becomes meaningful when it is interpreted with respect to the user. This can be achieved by knowledge base integration and reasoning using ontologies. Another application is discussed in [@P420]. Ontologies and other context modelling techniques allow structure data to be more meaningful which express relationships among data.

End-users in the IoT paradigm are more interested in high-level information compared to low-level raw sensor data [@P285]. The following examples explain the difference between high-level information and low-level raw sensor data. It is raining (high-level information) can be derived from humidity is 80% (low-level sensor data). Further, high-level sensor data can be explained as semantic information as it provides more meaning to the end users. Challenges of semantic sensor webs are identified and discussed in [@P031]. This is the most common form of discovery.

### **Level of Context Awareness**

Context-awareness can be employed at two levels: low (hardware) level and high (software) level. At the hardware level, context-awareness is used to facilitate tasks such as efficient routing, modelling, reasoning, storage and event detection (considering energy consumption and availability) [@P288]. At the hardware level, data and knowledge available for decision making is less. Further, sensors are resource constraint devices, so complex processing cannot be performed at the hardware level. However, applying context-aware technologies in the hardware level allows resources to be saved, such as network communication costs by preliminary filtering. The software level has access to a broader range of data and knowledge as well as more resources, which enables more complex reasoning to be performed. We use the following abbreviations to denote the level of context awareness facilitated and employed by the project: high level (H) and low level (L).

### **Security and Privacy**

This is a major concern in context-aware computing in all paradigms. However, the IoT paradigm will intensify the challenges in security and privacy. In the IoT, sensors are expected to collect more information about users (i.e. people) in all aspects. This includes both physical and conceptual data, such as location, preferences, calendar data, and medical information to name a few. As a result, utmost care needs to be taken when collecting, modelling, reasoning, and with persistent storage. Security and privacy need to be handled at different levels in the IoT. At the lowest level, the hardware layer should ensure security and privacy during collecting and temporary storage within the device. Secure protocols need to ensure communication is well protected. Once the data is received, application level protection needs to be in placed to monitor and control who can see or use context and so on. Different projects use different techniques such as policies, rules, and profiles to provide security and privacy. The symbol ($\checkmark$) denoted the presence of security and privacy related functionality in the project, in some form.

### **Data Source Support**

There are different sources that are capable of providing context. Broadly we call them *sensors*. We discussed different types of sensors in Section \[chapter2:CAF\]. Based on the popularity of the data sources supported by each solution, we selected the following classification. (P) denotes that the solution supports only physical sensors. Software sensors (S) denotes that the solution supports either virtual sensors, logical sensors or both. (A) denotes that the solution supports all kinds of data sources (i.e. physical, virtual, and logical). (M) denotes that the solution supports mobile devices.

### **Quality of Context** {#chapter2:CDLC:ESRF:QCRV}

We denote the presence of conflict resolution functionality using (C) and context validation functionality using (V). Conflict resolution is critical in the context management domain [@P310]. There has to be a consistency in collecting , aggregating, modelling, and reasoning. In the IoT paradigm, context may not be accurate. There are two reasons for context information not to be certain. First is that the sensor technology is not capable of producing 100% accurate sensor data due to various technical and environmental challenges. Secondly, even with sensors that produce 100% accurate sensor data, reasoning models are not 100% accurate. In summary, problems in sensor technology and problems in reasoning techniques contribute to context conflicts. There are two types of context conflicts that can occurred and they are defined in [@P310]:

Internal context conflict: Fusing two or more context elements that characterises the situation from different dimensions of the same observed entity in a given moment may lead to internal context conflict. (e.g. motion sensor detects that a user is in the kitchen and calendar shows that the user is supposed to be in a meeting. Therefore, it is unable to correctly deduce the current location by fusing two data sources: calendar and motion sensor.)

External context conflicts: The context conflict/inconsistency that may occur between two or more bits of context that describe the situation of an observed entity from the same point of view. (e.g. two motion sensors located in the same area provide two completely different readings, where one sensor detects a person and other sensor detects three people.)

Context validation ensures that collected data is correct and meaningful. Possible validations are checks for range, limit, logic, data type, cross-system consistency, uniqueness, cardinality, consistency, data source quality, security, and privacy.

[ c l m[11cm]{} ]{} & Taxonomy & Description\
5 & Modelling & Key-value modelling (K), Markup schemes (M), Graphical modelling (G), Object oriented modelling (Ob), Logic-based modelling (L), and Ontology-based modelling (On)\
6 & Reasoning & Supervised learning (S), Un-supervised learning (U), rules (R), Fuzzy logic (F), Ontology-based (O), and Probabilistic reasoning (P)\
7 & Distribution & Publish/subscribe (P) and Query (Q)\
8 & Architecture & Component based architecture (1) , Distributed architecture (2), Service based architecture (3), Node based architecture (4) , Centralised architecture (5), Client-server architecture (6)\
9 & History and Storage & Available ($\checkmark$)\
10 & Knowledge Management & Available ($\checkmark$)\
11 & Event Detection & Available ($\checkmark$)\
12 & Context Discovery and Annotation & context Discovery (D) and context Annotation (A)\
13 & Level of Context Awareness & High level (H) and Low level (L).\
14 & Security and Privacy & Available ($\checkmark$)\
15 & Data Source Support & Physical sensors (P), Software sensors (S), Mobile devices (M), Any type of sensor (A)\
16 & Quality of Context & Conflict resolution (C), context Validation (V)\
17 & Data Processing & Aggregate (A), Filter (F)\
18 & Dynamic Composition & Available ($\checkmark$)\
19 & Real Time Processing & Available ($\checkmark$)\
20 & Registry Maintenance & Available ($\checkmark$)\

\[Tbl:Summarized taxonmy\]

### **Data Processing**

We denote the presence of context aggregation functionality using (A) and context filter functionality using (F). Aggregation can be explained in different ways; for example, Context Toolkit [@P143] has a dedicated component called context aggregator to collect data related to a specific entity (e.g. person) from different context sources and act as a proxy to context applications. They do not perform any complex operations; just collect similar information together. This is one of the simplest forms of aggregation of context.

Context filter functionality makes sure the reasoning engine processes only important data. Specially in IoT, processing all the data collected by all the sensors is not possible due to scale. Therefore, IoT solutions should process only selected amounts of data that allows it to understand context accurately. Filtering functionality can be presented in different solutions in different forms: filter data, filter context sources, or filter events. Filtering helps both at the low (hardware) level and software level. At the hardware level, it helps to reduce the network communication cost by transmitting only important data. At the high-level, filtering can save process energy by only processing important data.

Context processing can be classified into three categories (also called layers) [@P185]. Typical methods and techniques used in each layer are also presented as follows:

*Activity and context recognition layer*: Feature extraction, classification, clustering, fuzzy rules

*Context and representation layer*: Conceptual models, logic programming, ontology based representation and reasoning, databases and query languages, rule based representation and reasoning, cased based representation and reasoning, representing uncertainty, procedural programming

*Application and adaptation layer*: Rules, query languages, procedural programming

Data fusion, which is also considered a data processing technique, is critical in understanding sensor data. In order to lay a solid foundation to our discussion, we adopt the definition provided by Hall and Llinas [@P248] on sensor data fusion. *“Sensor data fusion is a method of combining sensor data from multiple sensors to produce more accurate, more complete, and more dependable information that could not be possible to achieve through a single sensor [@P248].”* For example, in positioning, GPS does not work indoors. In contrast, there are a variety of other indoor positioning schemes that can be used. Therefore, in order to continuously track the positioning regardless of indoor or outdoor, sensor data fusion is essential [@P115]. Data fusion methods, models, and classification techniques in the wireless sensor networks domain are comprehensively surveyed in [@P130].

In order to identify context, it is possible to combine data from different data sources. For example, consider a situation where we want to identify the location of a user. The possible sources that can be used to collect evidence regarding the location are GPS sensors, motion sensor, calendar, email, social networking services, chat clients, ambient sound (sound level, pattern), users nearby, camera sensors, etc. This long list shows the possible alternatives. It is always a tradeoff between required resource (e.g. processing power, response time) and accuracy. Processing and combining all the above sensor readings would produce a more accurate result; however, it would require more resources and time. There is a significant gap between low-level sensor readings and high-level ‘situation-awareness’ [@P287]. Collecting low-level sensor data is becoming significantly easier and cheaper than ever due to advances in sensing technology. As a result, enormous amounts of sensor data (e.g. big data [@ZMP003]) is available. In order to understand big data, a variety of different reasoning techniques need to employed as we discussed in Section \[chapter2:CAF:Context Reasoning Decision Models\].

### **Dynamic Composition**

As explained in Solar [@P569], IoT solutions must have a programming model that allows dynamic composition without requiring the developer or user to identify specific sensors and devices. Dynamic organising is critical in environments like the IoT, because it is impossible to identify or plan possible interaction at the development stage. Software solutions should be able to understand the requirements and demands on each situation, then organise and structure its internal components according to them. Components such as reasoning models, data fusion operators, knowledge bases, and context discovery components can be dynamically composed according to the needs. The symbol ($\checkmark$) denoted the presence of dynamic composition functionality in the project in some form. \[chapter2:CDLC:ESRE:Dynamic\_Composition\]

\[t!\]

[ m[1.9cm]{} c m[0.25cm]{} c c c c c c c c c c c c c c c c c ]{}

Project Name &

Citations

& Year &

Project Focus

&

Modelling

&

Reasoning

&

Distribution

&

Architecture

&

History and Storage

&

Knowledge Management

&

Event Detection

&

Context Discovery and Annotation

&

Level of Context Awareness

&

Security and Privacy

&

Data Source Support

&

Quality of Context

&

Data Processing

&

Dynamic Composition

&

Real Time Processing

&

Registry Maintenance

\

\(1) & (2) & (3) & (4) &(5) & (6)& (7)& (8)& (9) & (10) & (11) & (12) & (13) & (14) & (15) & (16) & (17) & (18) & (19) & (20)\
\
Context Toolkit & [@P143] & 2001 & T & K & $\checkmark$ & Q & 1,5 & $\checkmark$ & [–]{}& [–]{}& [–]{}& H & [–]{}& A & [–]{}& A & [–]{}& [–]{}& [–]{}\
\
Solar & [@P569] & 2002 & M & K,M,Ob & R & P & 2 & [–]{}& [–]{}& $\checkmark$ & D & H & $\checkmark$ & P & $\checkmark$ & A & $\checkmark$ & [–]{}& [–]{}\
Aura & [@P555] & 2002 & M & M & R & P & 2 & [–]{}& [–]{}& $\checkmark$ & D & H & [–]{}& A & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
\
CoOL & [@P190] & 2003 & T & On & R,O & Q & 1 & [–]{}& $\checkmark$ & $\checkmark$ & D & H & [–]{}& S & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
CARISMA & [@P386] & 2003 & M & M & R & Q & 2 & [–]{}& [–]{}& [–]{}& [–]{}& H & [–]{}& M & C & [–]{}& [–]{}& [–]{}& [–]{}\
\
CoBrA & [@P419] & 2004 & M & On & R,O & Q & 1 & $\checkmark$ & $\checkmark$ & $\checkmark$ & [–]{}& H & $\checkmark$ & A & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
Gaia & [@P444] & 2004 & M & F,On & S,P, F & Q & 2,3 & $\checkmark$ & $\checkmark$ & $\checkmark$ & D & H & $\checkmark$ & A & [–]{}& [–]{}& $\checkmark$ & [–]{}& $\checkmark$\
SOCAM & [@P570] & 2004 & M & On & R,O & Q,P & 3 & $\checkmark$ & $\checkmark$ & $\checkmark$ & D & H & [–]{}& A & [–]{}& A & [–]{}& [–]{}& $\checkmark$\
\
CARS & [@P311] & 2005 & S & K & U & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$ & A & H & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
CASN & [@P288] & 2005 & M & F,On & F,O & P & 2 & [–]{}& $\checkmark$ & [–]{}& D & L & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
SCK & [@P332] & 2005 & M & M,On & R,O & Q & 1 & $\checkmark$ & $\checkmark$ & $\checkmark$ & A,D & H & [–]{}& A & V & [–]{}& [–]{}& [–]{}& $\checkmark$\
TRAILBLAZER & [@P305] & 2005 & S & K & R & Q & 2 & [–]{}& [–]{}& [–]{}& D & L & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
\
BIONETS & [@P316] & 2006 & M & On & R,O & Q & 1 & [–]{}& $\checkmark$ & [–]{}& A & H & [–]{}& A & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
PROCON & [@P278] & 2006 & S & K & R & Q & 2 & [–]{}& [–]{}& $\checkmark$ & D & L & [–]{}& P & [–]{}& A,F & [–]{}& [–]{}& [–]{}\
CMF (MAGNET) & [@P344] & 2006 & M & M & R & P,Q & 2,4 & $\checkmark$ & [–]{}& [–]{}& D & H & [–]{}& A & C & [–]{}& $\checkmark$ & [–]{}& [–]{}\
e-SENSE & [@P266] & 2006 & M & [–]{}& R & Q & [2,4]{} & [–]{}& $\checkmark$ & [–]{}& D & H & $\checkmark$ & P & [–]{}& F & [–]{}& [–]{}& [–]{}\
\
HCoM & [@P336] & 2007 & M & G,On & R,O & Q & 5 & $\checkmark$ & $\checkmark$ & [–]{}& D & H & [–]{}& S & V & F & [–]{}& [–]{}& $\checkmark$\
CMS & [@P340] & 2007 & M & On & O & P,Q & [1,2]{} & $\checkmark$ & [–]{}& $\checkmark$ & S & H & [–]{}& A & [–]{}& A & [–]{}& [–]{}& $\checkmark$\
MoCA & [@P338] & 2007 & M & M,Ob & O & P,Q & [4,5]{} & [–]{}& [–]{}& $\checkmark$ & D & H & $\checkmark$ & A & V & [–]{}& [–]{}& $\checkmark$ & $\checkmark$\
CaSP & [@P317] & 2007 & M & M,On & O & P,Q & 6 & $\checkmark$ & [–]{}& [–]{}& D & H & [–]{}& A & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
SIM & [@P349] & 2007 & M & K,G & R & [–]{}& 2 & $\checkmark$ & [–]{}& [–]{}& [–]{}& H & [–]{}& P & C & A & [–]{}& [–]{}& [–]{}\
— & [@P335] & 2007 & M & On & O & Q & [ ]{} & [–]{}& [–]{}& $\checkmark$ & D & H & [–]{}& P & V & A & [–]{}& [–]{}& [–]{}\
\
COSMOS & [@P403] & 2008 & M & Ob & R & Q & [2,4]{} & [–]{}& [–]{}& $\checkmark$ & [–]{}& H & [–]{}& P & [–]{}& A & $\checkmark$ & [–]{}& $\checkmark$\
DMS-CA & [@P308] & 2008 & S & M & R & Q & 5 & [–]{}& [–]{}& $\checkmark$ & [–]{}& H & [–]{}& A & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
CDMS & [@P293] & 2008 & M & K,M & R & Q & 2 & $\checkmark$ & [–]{}& $\checkmark$ & D & H & [–]{}& A & [–]{}& A,F & [–]{}& [–]{}& $\checkmark$\
— & [@P197] & 2008 & M & On & O,P & Q & 5 & [–]{}& $\checkmark$ & [–]{}& D & H & [–]{}& [–]{}& V & [–]{}& [–]{}& [–]{}& [–]{}\
— & [@P333] & 2008 & M & On & R,O & P,Q & 5 & [–]{}& [–]{}& $\checkmark$ & D & H & [–]{}& P & [–]{}& A & [–]{}& [–]{}& [–]{}\
AcoMS & [@P339] & 2008 & M & M,G,On & R,O & P & 5 & [–]{}& $\checkmark$ & $\checkmark$ & A & H & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
CROCO & [@P334] & 2008 & M & On & R,O & Q & [ ]{} & $\checkmark$ & $\checkmark$ & [–]{}& D & H & $\checkmark$ & A & C,V & [–]{}& [–]{}& [–]{}& $\checkmark$\
EmoCASN & [@P274] & 2008 & S & K & R & Q & [2,4]{} & [–]{}& [–]{}& [–]{}& D & L & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
\
Hydra & [@P105] & 2009 & M & K,On,Ob & R,O & Q & 3 & $\checkmark$ & $\checkmark$ & $\checkmark$ & [–]{}& H & $\checkmark$ & P & V & [–]{}& [–]{}& [–]{}& [–]{}\
UPnP & [@P300] & 2009 & M & K,M & R & Q & 4 & $\checkmark$ & [–]{}& $\checkmark$ & D & H & $\checkmark$ & A & [–]{}& A & $\checkmark$ & [–]{}& $\checkmark$\
COSAR & [@P187] & 2009 & M & On & S,O & Q & 5 & [–]{}& $\checkmark$ & $\checkmark$ & A & H & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
SPBCA & [@P420] & 2009 & M & On & R,O & Q & 2 & [–]{}& [–]{}& $\checkmark$ & A & H & $\checkmark$ & A & [–]{}& [–]{}& [–]{}& [–]{}& [–]{}\
C-CAST & [@P280] & 2009 & M & M & R & P,Q & 5 & $\checkmark$ & [–]{}& $\checkmark$ & D & H & [–]{}& A & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
— & [@P312] & 2009 & M & On & O & P & 5 & $\checkmark$ & [–]{}& $\checkmark$ & D & H & [–]{}& A & [–]{}& A & [–]{}& [–]{}& [–]{}\
CDA & [@P341] & 2009 & M & Ob & [–]{}& Q & [4,6]{} & [–]{}& [–]{}& [–]{}& [–]{}& H & [–]{}& V & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
SALES & [@P314] & 2009 & M & M & R & Q & [2,4]{} & [–]{}& [–]{}& $\checkmark$ & D & L & [–]{}& P & [–]{}& F & [–]{}& [–]{}& $\checkmark$\
MidSen & [@P275] & 2009 & M & K & R & P,Q & 5 & [–]{}& $\checkmark$ & $\checkmark$ & D & H & [–]{}& P & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
\
SCONSTREAM & [@P309] & 2010 & S & G & R & Q & 5 & $\checkmark$ & [–]{}& $\checkmark$ & [–]{}& H & [–]{}& P & [–]{}& [–]{}& [–]{}& $\checkmark$ & [–]{}\
— & [@P328] & 2010 & M & M & P & Q & [2,4]{} & $\checkmark$ & [–]{}& $\checkmark$ & [–]{}& H & [–]{}& A & [–]{}& F & $\checkmark$ & [–]{}& [–]{}\
Feel@Home & [@P346] & 2010 & M & G,On & O & P,Q & [2,4]{} & [–]{}& $\checkmark$ & $\checkmark$ & [–]{}& H & $\checkmark$ & A & [–]{}& [–]{}& [–]{}& [–]{}& $\checkmark$\
CoMiHoC & [@P347] & 2010 & M & Ob & R,P & Q & 5 & [–]{}& $\checkmark$ & $\checkmark$ & D & H & [–]{}& A & V & [–]{}& [–]{}& [–]{}& [–]{}\
Intelligibility & [@P384] & 2010 & T & [–]{}& R,S,P & Q & [1,5]{} & [–]{}& [–]{}& $\checkmark$ & D & H & [–]{}& A & V & [–]{}& [–]{}& [–]{}& [–]{}\
ezContext & [@P294] & 2010 & M & K,Ob & R & Q & 5 & $\checkmark$ & $\checkmark$ & $\checkmark$ & [–]{}& H & [–]{}& A & [–]{}& A & [–]{}& [–]{}& $\checkmark$\
UbiQuSE & [@P322] & 2010 & M & M & R & Q & 5 & $\checkmark$ & [–]{}& $\checkmark$ & D,A & H & [–]{}& A & [–]{}& [–]{}& [–]{}& $\checkmark$ & [–]{}\
COPAL & [@P571] & 2010 & M & M & R & P,Q & [1,5]{} & [–]{}& [–]{}& $\checkmark$ & D & H & $\checkmark$ & & V & A,F & [–]{}& $\checkmark$ & $\checkmark$\
\
Octopus & [@P285] & 2011 & S & $\checkmark$ & $\checkmark$ & P & [2,4]{} & [–]{}& [–]{}& $\checkmark$ & D & H & [–]{}& A & [–]{}& A & $\checkmark$ & [–]{}& [–]{}\
— & [@P327] & 2011 & M & [–]{}& $\checkmark$ & P & 2 & [–]{}& [–]{}& [–]{}& D & H & [–]{}& P & [–]{}& A & [–]{}& [–]{}& $\checkmark$\
— & [@P289] & 2011 & S & K,Ob & S,P & & [2,4]{} & $\checkmark$ & $\checkmark$ & $\checkmark$ & D,A & H & [–]{}& M & V & A,F & [–]{}& [–]{}& $\checkmark$\

### **Real Time Processing**

Most of the interactions are expected to be processed in real time in the IoT. This functionality has been rarely addressed by the research community in the context-aware computing domain. The most important real time processing task is event detection as we explained in Section \[chapter2:CDLC:ESRF:Event\_Detection\]. However, context reasoning, and query processing can also be considered as essential real time processing tasks. Real time processing solutions are focused on processing faster than traditional methods, which allows sensor stream data processing [@P309]. The symbol ($\checkmark$) denoted the presence of real time processing functionality in some form.

### **Registry Maintenance and Lookup Services**

We use the ($\checkmark$) symbol to denote the presence of registry maintenance and lookup services functionality in the project. This functionality allows different components such as context sources, data fusion operators, knowledge bases, and context consumers to be registered. This functionality is also closely related to dynamic composition where it needs to select relevant and matching components to be composed together. Registries need to be updated to reflect (dis)appearing components.

Evaluation of Research Efforts {#chapter2:CDLC:Evaluation of Surveyed Research Efforts2 }
------------------------------

**Context Toolkit** [@P143] aims to facilitating development and deployment of context-aware applications. This is one of the earliest efforts of providing framework support for context-aware application development. Context Toolkit contains a combination of features and abstractions to support context-aware application developers. It introduces three main abstractions: context widget (to retrieve data from sensors), context interpreter (to reason sensor data using different reasoning techniques), and context aggregator. The research around Context Toolkit is still active and a number of extensions have been developed to enhance its context-aware capabilities. Enactor [@P393] provides a context decision modelling facility to the Context Toolkit. Further, the Intelligibility Toolkit [@P384] extends the Enactor framework by supporting more decision models for context reasoning. Context Toolkit identifies the common features required by context-aware applications as capture and access of context, storage, distribution, and independent execution from applications.

**Aura** [@P555] is a task oriented system based on distributed architecture which focuses on different computational devices used by human users every day. The objective is to run a set of applications called *personal aura* in all devices in order to manage user tasks in a context-aware fashion across all the devices smoothly. Aura addresses two major challenges. First, aura allows a user to preserve continuity in his/her work when moving between different environments. Second, it is capable of adapting to the on-going computation of a particular environment in the presence of dynamic resource variability. Aura consists of four major components: context observer (collects context and send it to task and environment managers), task manager (also called prism, four different kinds of changes: user moves to another environment, environment, task, and context), environment manager (handles context suppliers and related service), and context suppliers (provides context information). XML based markup schemes are used to describe services. .

**CARISMA** [@P386] (Context-Aware Reflective middleware System for Mobile Applications) is focused on mobile systems where they are extremely dynamic. Adaptation (also called reflection) is the main focus of CARISMA. context is stored as application profiles (XML based), which allows each application to maintain meta-data under two categories: passive and active. The passive category defines actions that middleware would take when specific events occur using rules, such as shutting down if battery is low. However, conflicts could arise when two profiles defines rules that conflict each other. The active category allows relationships to be maintained between services used by the application, the policies, and context configurations. This information tells how to behave under different environmental and user conditions. A conflict resolution mechanism is also introduced in CARISMA based on macroeconomic techniques. An auction protocol is used to handle the resolution as they support greater degrees of heterogeneity over other alternatives. In simple terms, rules are used in auctions with different constraints imposed on the bidding by different agents (also called applications). Final decisions are made in order to maximise the social welfare among the agents.

**CoBrA** [@P419] (Context Broker Architecture) is a broker-centric agent architecture that provides knowledge sharing and context reasoning for smart spaces. It is specially focused on smart meeting places. CoBrA addresses two major issues: supporting resource-limited mobile computing devices and addressing concerns over user privacy. Context information is modelled using OWL ontologies. Context brokers are the main elements of CoBrA. A context broker comprises the following four functional components: context knowledge base (provides persistent storage for context information), context reasoning engine (performs reasoning over context information stored in storage), context acquisition module (retrieve context from context sources), and policy management module (manages policies, such as who has access to what data). Even though the architecture is centralised, several brokers can work together through a broker federation. Context knowledge is represented in Resource Description Framework (RDF) triples using Jena.

**Gaia** [@P444] is a distributed context infrastructure uncertainty based reasoning. Ontologies are used to represented context information. Gaia has employed a Prolog based probabilistic reasoning framework. The architecture of Gaia consists of six key components: context provider (data acquisition from sensors or other data sources), context consumer (different parties who are interest in context), context synthesiser (generate high-level context information using raw low-level context), context provider lookup service (maintains a detailed registry of context providers so the appropriate context providers can be found based on their capabilities when required), context history service (stores history of context), and ontology server (maintains different ontologies).

**SOCAM** [@P570] (Service Oriented Context-Aware Middleware) is an ontology based context-aware middleware. It separates the ontologies into two levels: upper level ontology for general concepts and lower level ontologies domain specific descriptions. SOCAM architecture comprises several key components: context provider (acquires data from sensors and other internal and external data sources and converts the context in to OWL representation), context interpreter (performs reasoning using reasoning engine and stores the processed context information in the knowledge base), context-aware services (context consumers), and services locating service (context providers and interpreter are allowed to register so other components can search for appropriates providers and interpreters based on their capabilities).

**e-SENSE** [@P266] enables ambient intelligence using wireless multi-sensor networks for making context-rich information available to applications and services. e-SENSE combines body sensor networks (BSN), object sensor networks (OSN), and environment sensor networks (ESN) to capture context in the IoT paradigm. The features required by context-aware IoT middleware solutions are identified as sensor data capturing, data pre-filtering, context abstraction data source integration, context extraction, rule engine, and adaptation.

**HCoM** [@P336] (Hybrid Context Management) is a hybrid approach which combines semantic ontology and relational schemas. This approach claims that standard database management systems alone cannot be used to manage context. In contrast, semantic ontologies may not perform well in terms of efficiency and query processing with large volumes of data. So the hybrid approach is required. HCoM architecture consists of five layers: acquisition layer, pre-processing layer, data modelling and storage layer, management modelling layer, and utilising layer. HCoM has identified several key requirements that a context management solution should have that are encapsulated in several components: context manager (aggregates the results and sends the data to reasoning engine), collaboration manager (if context selector decides the existing context information is not sufficient to perform reasoning, the collaboration manager attempts to gather more data from other possible context sources), context filter (once the context is received, it validates and decide whether it needs to be stored in RCDB), context selector (based on the user request, it decides what context should be used in reasoning processing based on the accuracy, time, and required computational resources), context-onto (manages the ontologies and acts as a repository), rules and policy (users are allowed to add rules to the system), RCDB (stores the captured context in a standard database management system), rule-mining (a data base that consists of rules that tell what actions to perform when), and interfaces (provides interface to the context consumers).

**MoCA** [@P338] is a service based distributed middleware that employs ontologies to model and manage context. The primary conceptual component is context domain. The context management node (CMN) is infrastructure that is responsible for managing the context domain. Similar to most of the other context management solutions, the three key components in MoCA are: context providers (responsible for generating or retrieving context from other sources available to be used by the context management system), context consumers (consume the context gathered and processed by the system), and context service (responsible for receiving, storing, and disseminating context information). MoCA uses an object oriented model for context handling, instead of an ontology-based model due to the weaknesses posed by ontologies in terms of scalability and performance. XML is used to model context. The XML files are fed into the context tool in order to check validation. Then the program codes are generated automatically to acquire data. These program codes will acquire context and insert the data into context repositories.

**CaSP** [@P317] (Context-aware Service Platform) is a context gathering framework for mobile solutions based on middleware architecture. The platform provides six different functionalities: context sensing, context modelling, context association, context storage, and retrieval. The paper also provides a comprehensive evaluation of existing context sensing solutions. CaSP consists of typical context management components which handle the mentioned functionalities.

**SIM** [@P349] (Sensor Information Management) is focused on the smart home domain which addresses location tracking. SIM uses an agent based architecture according to the standard specifications provided in Foundation for Intelligent Physical Agents. Its emphasis is on collecting sensor data from multiple sources and aggregating them together to analyse and derive more accurate information. SIM collects two types of information: node level and attribute level. In node level, node ID, location, and priority are collected. Attributes are stored in attribute information base comprising attribute and the corresponding measurement. A location tracking algorithm has been introduced using a mobile positioning device. A position manager handles tracking. SIM has the capability to resolve conflicts in sensor information based on sensor priority. Conflict resolution is handled by a context manager with the help of aggregation, classification, and decision components. Even though SIM is not focused on hardware level context management, the approach is closer to low-level instead of high-level compared to other projects.

**COSMOS** [@P403] is middleware that enables the processing of context information in ubiquitous environments. COSMOS consists of three layers: context collector (collects information from the sensors), context processing (derives high level information from raw sensor data), and context adaptation (provides access to the processed context for the applications). In contrast to the other context solutions, the components of COSMOS are context nodes. In COSMOS, each piece of context information is defined as a context node. COSMOS can support any number of context nodes which are organised into hierarchies. Context node is an independently operated module that consists of its own activity manager, context processor, context reasoner, context configurator, and message managers. Therefore, COSMOS follows distributed architecture which increases the scalability of the middleware.

**DMS-CA** [@P308] (Data Management System-Context Architecture) is based on smart building domain. XML is used to define rules, contexts, and services. Further, an event driven rule checking technique is used to reason context. Rules can be configured by mobile devices and push them to the server to be used by the rule checking engine. Providing a mobile interface to build rules and queries is important in a dynamic and mobile environment such as the IoT.

**ACoMS** [@P339] (Autonomic Context Management System) can dynamically configure and reconfigure its context information acquisition and pre-processing functionality to perform fault tolerant provisioning of context information. ACoMS architecture comprises application context subscription manager stores (manages context information requests from the applications using a subscribe mechanism), context source manager (performs actions such as low-level communication with context sources, context source discovery, registration, and configuration), and reconfiguration manager (performs monitoring tasks such as mapping context sources to context information).

**CROCO** [@P334] (CROss application COntext management) is an ontology based context modelling and management service. CROCO identifies several requirements to be a cross application, such as application plug-in capability. CROCO has three responsibilities where they are distributed among three separate layers: data management (perform operations such as storing inferred data for historic use, develop and maintain fact database), consistency checking and reasoning (consistency manager is responsible for checking the consistency, such as data types, and cardinality when sensor data arrives before it is feed in to reasoning or storage; reasoning manager performs reasoning based on the facts stored in the fact data base), and context update and provision (allows context consumers to register themselves, retrieve context from context sources, and provide query interface to the consumers).

**EMoCASN** [@P274] (Environment Monitoring Oriented Context Aware Sensor Networks) proposes a context-aware model for sensor networks (CASN). This modelling approach is narrowly focused on managing sensor networks using low level context such as node context, task context, and data context. For example, CASN uses low level context such as remaining energy of a node, location of the sensor, and orientation of the sensor to decide energy efficient routing.

**Hydra**[^6] [@P105] is an IoT middleware that aims to integrate wireless devices and sensors into ambient intelligence systems. Hydra comprises a Context Aware Framework (CAF). CAF provides the capabilities of both high-level, powerful reasoning, based on the use of ontologies and lower-level semantic processing based on object-oriented/key-value approach. CAF consists of two main components: Data Acquisition Component (DAqC) and the Context Manager (CM). DAqC is responsible for connecting and retrieving data from sensors. CM is responsible for context management, context awareness, and context interpretation. A rule engine called Drools platform [@P395] has been employed as the core context reasoning mechanism. CAF models three distinct types of context: device contexts (e.g. data source), semantic contexts (e.g. location, environment, and entity), and application contexts (e.g. domain specific). Hydra identifies context reasoning rule engine, context storage, context querying, and event/action management as the key components of a context-aware framework.

**C-Cast** [@P280] is middleware that integrates WSN into context-aware systems by addressing context acquisition, dissemination, representation, recognising, and reasoning about context and situations. C-Cast lays its architecture on four layers: sensor, context detection, context acquisition, and application. In C-Cast, context providers (CP) are the main components. Each context provider handles one task. For example, WeatherCP collects weather information and Address-bookCP collects related addresses. Any amount of CPs can be added to the system to extend the system wide functionality. Each context provider independently handles data acquisition, context processing (e.g. filter and aggregate context), context provider management (e.g. handles subscriptions), and context access and dissemination (e.g. handles queries). C-Cast claims that complex reasoning and intuitive reasoning can only be achieved by using rich representation models. In contrast, C-CAST avoids using ontologies to model context claiming ontologies are too resource intensive.

**SALES** [@P314] (Scalable context-Aware middleware for mobiLe EnviromentS) is a context-aware middleware that achieves scalability in context dissemination. The main components of this middleware are nodes. These nodes are not sensor nodes but servers, computers, laptops, PDAs, and mobile phones. SALES consists of four types of nodes. XML schemes are used to store and transfer context.

**MidSen** [@P275] is context-aware middleware for WSN. The system is based on Event-Condition-Action (ECA) rules. It highlights the importance of efficient event detection by processing two algorithms: event detection algorithm (EDA) and context-aware service discovery algorithm (CASDA). MidSen has proposed a complete architecture to enable context awareness in WSN. It consists of the following key components: knowledge manager, application notifiers, knowledge base, inference engine, working memory, application interface, and network interface.

**Feel@Home** [@P346] is a context management framework that supports interaction between different domains. The proposed approach is demonstrated using three domains: smart home, smart office, and mobile. The context information is stored using OWL [@P148]. Feel@Home supports two different interactions: intra-domain and cross domain. The cross domain interaction is essential in the IoT paradigm. Further, this is one of the major differences between sensor networks and the IoT. Sensor networks usually only deal with one domain. However, IoT demands the capability of dealing with multiple domains. In addition, context management frameworks should not be limited to a specific number of domains. Feel@Home consists of three parts: user queries, global administration server (GAS), and domain context manager (DCM). User queries are first received by GAS. It decides what the relevant domain needs to be contacted to answer the user query. Then, GAS redirects the user query to the relevant domain context managers. Two components reside in GAS, context entry manager (CEM) and context entry engine (CEE), which performs the above task. DCM consists of typical context management components such as context wrapper (gathers context from sensors and other sources), context aggregator (triggers context reasoning), context reasoning, knowledge base (stores context), and several other components to manage user queries, publish/subscribe mechanism. The answers to the user query will return by using the same path as when received.

**CoMiHoc** [@P347] (Context Middleware for ad-HoC network) is a middleware framework that supports context management and situation reasoning. CoMiHoc proposes a CoMoS (Context Mobile Spaces), a context modeling, and situation reasoning mechanism that extends the context spaces [@P195]. CoMiHoc uses Java Dempster-Shafer library [@P441]. CoMiHoc architecture comprises six components: context provisioner, request manager, situation reasoner, location reasoner, communication manager, and On-Demand Multicast Routing Protocol (ODMRP).

**ezContext** [@P294] is a framework that provides automatic context life cycle management. ezContext comprises several components: context source (any source that provides context, either physical sensors, databases or web service), context provider (retrieves context from various sources whether in push (passive) or pull (active) method, context manager (manages context modelling, storage and producing high-level context using low-level context), context wrapper (encapsulate retrieved context into correct format, in this approach, key-value pairs), and providers’ registry (maintains list of context providers and their capabilities). JavaBeans are used as the main data format.

**Octopus** [@P285] is an open-source, dynamically extensible system that supports data management and fusion for IoT applications. Octopus develops middleware abstractions and programming models for the IoT. It enables non-specialised developers to deploy sensors and applications without detailed knowledge of the underlying technologies and network. Octopus is focused on the smart home/office domain and its main component is *solver*. Solver is a module that performs sensor data fusion operations. Solvers can be added and removed from the system at any time based on requirements. Further solvers can be combined together dynamically to build complex operations.

Lessons Learned {#chapter2:LL}
===============

### Development Aids and Practices

### Mobility, Validity, and Sharing

### On Demand Data Modelling

### Hybrid Reasoning

### Hardware Layer Support

### Dynamic Configuration and Extensions

### Distributed Processing

### Other Aspects

![image](./Figures/61-Conceptual_Framework.pdf)

Challenges and Future Research Directions {#chapter2:LLFRD}
=========================================

As we mentioned earlier, one of our goal in this survey is to understand how context-aware computing can be applied in the IoT paradigm based on past experience. Specifically, we evaluated fifty context-aware projects and highlighted the lessons we can learn from them in the IoT perspective. In this section our objective is to discuss six unique challenges in the IoT where novel techniques and solution may need to be employed.

### Automated configuration of sensors {#chapter2:LLFRD:Automated_configuration_of_sensors}

In traditional pervasive/ubiquitous computing, we connect only a limited number of sensors to the applications (e.g. smart farm, smart home). In contrast, the IoT envisions billions of sensors to be connected together over the Internet. As a result, a unique challenge would arise on connection and configuration of sensors to applications. Due to the scale, it is not feasible to connect sensors manually to an application or to a middleware [@ZMP005]. There has to be an automated or at least semi-automated process to connect sensors to applications. In order to accomplish this task, applications should be able to understand the sensors (e.g. sensors’ capabilities, data structures they produce, hardware/driver level configuration details). Recent developments such as Transducer Electronic Data Sheet (TEDS) [@P258], Open Geospatial Consortium (OGC) Sensor Web Enablement related standards such as Sensor Markup Languages (SensorML) [@P256], sensor ontologies [@P103], and immature but promising efforts such as Sensor Device Definitions [@ZMP002] show future directions to carry out the research work further, in order to tackle this challenge.

### Context discovery

Once we connect sensors to a software solution, as mentioned above, there has to be a method to understand the sensor data produced by the sensors and the related context automatically. We discussed context categorisation techniques comprehensively in Section \[chapter2:CAF:context Types\]. There are many types of context that can be used to enrich sensor data. However, understanding sensor data and appropriately annotating it automatically in a paradigm such as the IoT, where application domains vary widely, is a challenging task. Recent developments in semantic technologies [@P191; @P103; @P088] and linked data [@P520; @P068] show future directions to carry out further research work. Semantic technology is popularly used to encode domain knowledge.

### Acquisition, modelling, reasoning, and distribution

After analysing acquisition, modelling, and reasoning in different perspectives, it is evident that no single technique would serve the requirements of the IoT. Incorporating and integrating multiple techniques has shown promising success in the field. Some of the early work such as [@P216; @P463] have discussed the process in detail. However, due to the immaturity of the field of IoT, it is difficult to predict when and where to employ each technique. Therefore, it is important to define and follow a standard specification so different techniques can be added to the solutions without significant effort. Several design principles have been proposed by [@P143; @P384] as a step towards standardisation of components and techniques. The inner-workings of each technique can be different from one solution to another. However, common standard interfaces will insure the interoperability among techniques.

### Selection of sensors in sensing-as-a-service model

This is going to be one of the toughest challenges in the IoT. It is clear that we are going to have access to billions of sensors. In such an environment, there could be many different alternative sensors to be used. For example, let us consider a situation where an environmental scientist wants to measure environmental pollution in New York city. There are two main problems: (1) ‘what sensors provide information about pollution?’ [@ZMP004] (2) when there are multiple sensors that can measure the same parameter (e.g. pH concentration in a lake), ‘what sensor should be used?’ [@ZMP006] In order to answer question (1), domain knowledge needs to be incorporate with the IoT solution. Manually selecting the sensors that will provide information about environmental pollution is not feasible in the IoT due to its scale. In order to answer question (2), quality frameworks need to be defined and employed. Such a framework should be able to rank the sensors based on factors such as accuracy, relevancy, user feedback, reliability, cost, and completeness. Similar challenges have been addressed in the web service domain during the last decade [@P563; @P564] where we can learn from those efforts.

### Security, privacy, and trust

This has been a challenge for context-aware computing since the beginning. The advantage of context is that it provides more meaningful information that will help us understand a situation or data. At the same time, it increases the security threats due to possible misuse of the context (e.g. identity, location, activity, and behaviour). However, the IoT will increase this challenge significantly. Even though security and privacy issues are addressed at the context-aware application level, it is largely unattended at the context-aware middleware level. In the IoT, security and privacy need to be protected in several layers: sensor hardware layer, sensor data communication (protocol) layer, context annotation and context discovery layer, context modelling layer, and the context distribution layer. IoT is a community based approach where the acceptance of the users (e.g. general public) is essential. Therefore, security and privacy protection requirements need to be carefully addressed in order to win the trust of the users.

### Context Sharing {#chapter2:LLFRD:Context_Data_Sharing}

This is largely neglected in the context-aware middleware domain. Most of the middleware solutions or architectures are designed to facilitate applications in isolated factions. Inter-middleware communication is not considered to be a critical requirement. However, in the IoT, there would be no central point of control. Different middleware solutions developed by different parties will be employed to connect to sensors, collect, model, and reason context. Therefore, sharing context information between different kinds of middleware solutions or different instances of the same middleware solution is important. Sensor data stream processing middleware solutions such as GSN [@P050] have employed this capability to share sensor data among different instances (e.g. installed and configured in different computers and locations) where context is not the focus. However, in contrast to sensor data, context information has strong relationships between each other (e.g. context modelled using RDF). Therefore, relationship models also need to be transferred and shared among different solutions, which enables the receiver to understand and model the context accurately at the receivers end.

Conclusions {#chapter2:Conclusions}
===========

The IoT has gained significant attention over the last few years. With the advances in sensor hardware technology and cheap materials, sensors are expected to be attached to all the objects around us, so these can communicate with each other with minimum human intervention. Understanding sensor data is one of the main challenges that the IoT would face. This vision has been supported and heavily invested by governments, interest groups, companies, and research institutes. For example, context awareness has been identified as an important IoT research need by the Cluster of European Research Projects on the IoT (CERP-IoT) [@P019] funded by the European Union. The EU has allocated a time frame for research and development into context-aware computing focused on the IoT to be carried out during 2015-2020.

In this survey paper, we analysed and evaluated context-aware computing research efforts to understand how the challenges in the field of context-aware computing have been tackled in desktop, web, mobile, sensor networks, and pervasive computing paradigms. A large number of solutions exist in terms of systems, middleware, applications, techniques, and models proposed by researchers to solve different challenges in context-aware computing. We also discussed some of the trends in the field that were identified during the survey. The results clearly show the importance of context awareness in the IoT paradigm. Our ultimate goal is to build a foundation that helps us to understand what has happened in the past so we can plan for the future more efficiently and effectively.

Acknowledgment {#acknowledgment .unnumbered}
==============

Authors acknowledge support from SSN TCP, CSIRO, Australia and ICT OpenIoT Project, which is co-funded by the European Commission under seventh framework program, contract number FP7-ICT-2011-7-287305-OpenIoT. The Author(s) acknowledge help and contributions from The Australian National University.

[Charith Perera]{} received his BSc (Hons) in Computer Science in 2009 from Staffordshire University, Stoke-on-Trent, United Kingdom and MBA in Business Administration in 2012 from University of Wales, Cardiff, United Kingdom. He is currently pursing his PhD in Computer Science at The Australian National University, Canberra, Australia. He is also working at Information Engineering Laboratory, ICT Centre, CSIRO and involved in OpenIoT Project (Open source blueprint for large scale self organizing cloud environments for IoT applications), which is co-funded by the European Commission under seventh framework program. His research interests include Internet of Things, pervasive and ubiquitous computing with a focus on sensor networks, middleware, context aware computing, mobile computing and semantic technologies. He is a member of the Association for Computing Machinery (ACM) and the Institute of Electrical and Electronics Engineers (IEEE).

[Arkady Zaslavsky]{} is the Science Leader of the Semantic Data Management science area at Information Engineering Laboratory, ICT Centre, CSIRO. He is also holding positions of Adjunct Professor at ANU, Research Professor at LTU and Adjunct Professor at UNSW. He is currently involved and is leading a number of European and national research projects. Before coming to CSIRO in July 2011, he held a position of a Chaired Professor in Pervasive and Mobile Computing at Luleå University of Technology, Sweden where he was involved in a number of European research projects, collaborative projects with Ericsson Research, PhD supervision and postgraduate education. Between 1992 and 2008 Arkady was a full-time academic staff member at Monash University, Australia. Arkady made internationally recognised contribution in the area of disconnected transaction management and replication in mobile computing environments, context-awareness as well as in mobile agents. He made significant internationally recognised contributions in the areas of data stream mining on mobile devices, adaptive mobile computing systems, ad-hoc mobile networks, efficiency and reliability of mobile computing systems, mobile agents and mobile file systems. Arkady received MSc in Applied Mathematics majoring in Computer Science from Tbilisi State University (Georgia, USSR) in 1976 and PhD in Computer Science from the Moscow Institute for Control Sciences (IPU-IAT), USSR Academy of Sciences in 1987. Before coming to Australia in 1991, Arkady worked in various research positions at industrial R&D labs as well as at the Institute for Computational Mathematics of Georgian Academy of Sciences where he lead a systems software research laboratory. Arkady Zaslavsky has published more than 300 research publications throughout his professional career and supervised to completion more than 30 PhD students. Arkady Zaslavsky is a Senior Member of ACM, a member of IEEE Computer and Communication Societies.

[Peter Christen]{} is an Associate Professor in the Research School of Computer Science at the Australian National University. He received his Diploma in Computer Science Engineering from ETH Zürich in 1995 and his PhD in Computer Science from the University of Basel in 1999 (both in Switzerland). His research interests are in data mining and data matching (entity resolution). He is especially interested in the development of scalable and real-time algorithms for data matching, and privacy and confidentiality aspects of data matching and data mining. He has published over 80 papers in these areas, including in 2012 the book ‘Data Matching’ (by Springer), and he is the principle developer of the *Febrl* (Freely Extensible Biomedical Record Linkage) open source data cleaning, deduplication and record linkage system.

[Dimitrios Georgakopoulos]{} is a Research Director at the CSIRO ICT Centre where he heads the Information Engineering Laboratory that is based in Canberra and Sydney. The laboratory has 70 researchers and more than 40 visiting scientists, students, and interns specializing in the areas of Service/Cloud Computing, Human Computer Interaction, Machine Learning, and Semantic Data Management. Dimitrios is also an Adjunct Professor at the Australian National University. Before coming to CSIRO in October 2008, Dimitrios held research and management positions in several industrial laboratories in the US. From 2000 to 2008, he was a Senior Scientist with Telcordia, where he helped found Telcordia’s Research Centers in Austin, Texas, and Poznan, Poland. From 1997 to 2000, Dimitrios was a Technical Manager in the Information Technology organization of Microelectronics and Computer Corporation (MCC), and the Chief Architect of MCC’s Collaboration Management Infrastructure (CMI) consortial project. From 1990-1997, Dimitrios was a Principal Scientist at GTE (currently Verizon) Laboratories Inc. Dimitrios has received a GTE (Verizon) Excellence Award, two IEEE Computer Society Outstanding Paper Awards, and was nominated for the Computerworld Smithsonian Award in Science. He has published more than one hundred journal and conference papers. Dimitrios is the Vice-Chair of the 12th International Semantic Web Conference (ISWC 2013) in Sydney, Australia, 2013, and the General Co-Chair of the 9th IEEE International Conference on Collaborative Computing (CollaborateCom 2013) in Austin, Texas, USA, 2013. In 2011, Dimitrios was the General chair of the 12th International Conference on Web Information System Engineering (WISE), Sydney, Australia, and the 7th CollaborateCom, Orlando, Florida, October 2011. In 2007, he was the Program Chair of the 8th WISE in Nancy France, and the 3rd CollaborateCom in New York, USA. In 2005, he was the General chair of the 6th WISE in New York. In 2002, and he served as the General Chair of the 18th International Conference on Data Engineering (ICDE) in San Jose, California. In 2001, he was the Program Chair of the 17th ICDE in Heidelberg, Germany. Before that he was the Program Chair of 1st International Conference on Work Activity Coordination (WACC) in San Francisco, California, 1999, and has served as Program Chair in a dozen smaller conferences and workshops.

[^1]: Charith Perera, Arkady Zaslavsky and Dimitrios Georgakopoulos are with the Information and Communication Centre, Commonwealth Scientific and Industrial Research Organisation, Canberra, ACT, 2601, Australia (e-mail: firstname.lastname@csiro.au)

[^2]: Peter Christen is with the Research School of Computer Science, The Australian National University, Canberra, ACT 0200, Australia. (e-mail: peter.christen@anu.edu.au)

[^3]: Manuscript received xxx xx, xxxx; revised xxx xx, xxxx.

[^4]: The term *‘context*’ implicitly provide the meaning of *‘information*’ according to the widely accepted definition provided by [@P104]. Therefore, it is inaccurate to use the term ‘*context information*’ where *‘information*’ is explicitly mentioned. However, research community and documents on the web frequently use the term ‘*context information*’. Therefore, we also use both terms interchangeably.

[^5]: We use both terms, ‘*objects*’ and ‘*things*’ interchangeably to give the same meaning as they are frequently used in IoT related documentation. Some other terms used by the research community are ‘smart objects’, ‘devices’, ‘nodes’.

[^6]: The name ‘Hydra’ has changes its name due to name conflict between another project registered under same name in Germany. The new name of the middleware is the ‘LinkSmart’ middleware.
