An Ontology-Based Reasoning Framework for Context-Aware Applications††thanks: The final publication is available at Springer via http://dx.doi.org/10.1007/978-3-319-25591-0_34
Context-aware applications process context information to support users in their daily tasks and routines. These applications can adapt their functionalities by aggregating context information through machine-learning and data processing algorithms, supporting users with recommendations or services based on their current needs. In the last years, smartphones have been used in the field of context-awareness due to their embedded sensors and various communication interfaces such as Bluetooth, WiFi, NFC or cellular. However, building context-aware applications for smartphones can be a challenging and time-consuming task. In this paper, we describe an ontology-based reasoning framework to create context-aware applications. The framework is based on an ontology as well as micro-services to aggregate, process and represent context information.
Keywords:OWL Android Ontology Context Framework
In the last few years, mobile phones have evolved from devices, used for voice communication and sending text messages only, to powerful smartphones with multiple embedded sensors and communication interfaces such as WiFi, Bluetooth, NFC or cellular. With their increasing processing capabilities and sensors such as accelerometers, gyroscopes, and magnetometers, smartphones are now being used for internet browsing, social networking, playing games, watching videos or listening to music . Other fields of smartphone applications are activity recognition and context-awareness. In the area of activity recognition, for example, smartphones are used to recognize Activities of Daily Living (ADL) ,. Context-aware applications can be utilized in the field of Ambient-Assisted-Living (AAL) and home automation. These types of applications monitor the environment to aggregate context information to provide recommendations or services to the user. Typically, this information is extracted from sensor data, represented as time series, by using machine-learning and data processing algorithms. Existing frameworks in this field can be divided into two categories based on the way contexts are represented. The first category includes frameworks that describe context information without semantic e.g. as plain programming objects such as strings or class objects using object-oriented models ,,,. However, these object-oriented models are not suitable for knowledge and data sharing in heterogeneous pervasive environments . The second category consists of frameworks supporting semantic representations of context information ,,. These frameworks exploit ontologies, first-order logics or other description technologies to represent context information semantically. Building context-aware applications on smartphones that represent context information semantically as well as aggregate and process contexts through sensor information is still a challenging task.
In this paper, we present an ontology-based framework to create context-aware applications. In addition to the ontology, we extend the current state of the art frameworks by integrating micro-services to aggregate and process context information. By supporting reasoners such as Pellet , HermiT  and JFact , the framework can deduce complex contexts from already aggregated context information by using the reasoning paradigm of the Web-Ontology-Language (OWL). In the following sections, we present the architecture of our framework including a schematic overview over its components. A discussion about the limitations of the framework and a conclusion with a summary of future work is given at the end of this paper.
The framework is based on an OWL ontology to model and represent context information. By using an ontology, complex contexts can be deduced by using the reasoning paradigm of OWL. In combination with the ontology, the framework exploits micro-services to aggregate and process context information from embedded smartphone or environmental sensors. Micro-services refer to standalone applications providing a background service only. These background services implement one or multiple functionalities such as context classification, prediction or sensor data aggregation, which can be used by applications or other micro-services. A schematic view of the framework architecture is given in Figure 1.
The micro-service architectural style is a mechanism, where a dedicated application provides one or multiple services, each one of them running in its process. In our framework, services communicate over an Inter-Process-Communication interface (IPC) with other services or the framework core. Figure 1 depicts three possible types of micro-services. Since the framework has to exploit sensors to aggregate and process sensor data, the first type of micro-services (Sensing) is used to establish a connection to different sensors. Either embedded smartphone sensors such as the accelerometer, gyroscope or magnetometer or environmental sensors such as movement sensors or door contacts can be used. Establishing a connection to environmental sensors, for example, can be done by implementing a micro-service requesting a web-service abstracting sensor information e.g. in a smart home environment. Already aggregated sensor data can be distributed to other micro-services or the framework core by IPC. The second type of micro-services (Classification) is used to classify context information from sensor data. Existing approaches such as  can be implemented as services to classify context information such as standing, sitting, walking, and lying. The third type of micro-services (Prediction) is used for context prediction. Generally, existing context prediction algorithms such as  or  exploit context histories to build prediction models. These algorithms predict future contexts providing further information about the next context of the user. To support context prediction algorithms, the framework provides access to already aggregated context information in form of a context history stored on the smartphone’s file-system.
2.2 Framework core
The framework core is the central component of the framework. It maintains the ontology and provides an interface to establish IPC connections to installed micro-services. The interface controls the life-cycle of micro-services. For this reason, the core maintains a service-repository of installed micro-services in the form of a database. The repository is needed to establish connections to installed services. If the user installs or removes a service, the framework core updates the corresponding entry in the database. Additionally, the framework core process information from micro-services such as aggregated contexts, raw sensor data or context predictions. While most context classification or prediction approaches rely on sensor or context histories to classify or predict new context information, the framework core saves this information on the smartphone’s local file-system. Already classified contexts are added to the ontology.
2.3 Framework ontology
The framework uses an OWL ontology to model and represent context information. The ontology describes the terminology of the context model in the form of conceptual classes and relationships between these classes. These classes and relations define the structure of the underlying model and are stored inside a terminological box (TBox). Instances of conceptual classes, their attributes and relationships are stored inside an assertional box (ABox). With the reasoning paradigm of OWL ontologies, the framework can deduce complex contexts from already aggregated information. In a smart environment, for example, the ontology can infer that a user is making coffee by using dense sensing .
An experimental evaluation of the framework was carried out by implementing a context-based communication filter for Android based smartphones. The filter blocks certain communication such as phone calls, text messages or emails by aggregating and processing context information of the user in a smart home environment located in our department. Similar to the evaluation in , we experienced memory and performance issues on the tested smartphones (Google Nexus 4, 5 and 6) when reasoning larger ontologies111More than 6.000 Axioms. Besides memory and performance issues, applications using the framework may have time constraints when deducing new context information from already aggregated contexts. These time constraints may be violated when using reasoners that are not optimized for large ontologies or when using power-limited smartphones. Besides the limitations caused by different ontology sizes and reasoners being used, efforts regarding the privacy and security of context information have to be made. Although, context information is stored on the smartphone’s local file-system, the exchange of data e.g. using environmental sensors, has to be secured by using current state of the art encryption technologies such as TLS (Transport Layer Security).
Context-aware applications process context information to support users in their daily tasks and routines. Building context-aware applications for smartphones that represent context information semantically as well as aggregate and process contexts through smartphone or environmental sensor is still a challenging task. In this paper, we presented an ontology-based framework to create context-aware applications. By utilizing an ontology, context information can be described semantically. In addition to the ontology, we implemented micro-services to aggregate and process context information from embedded smartphone or environmental sensors. By utilizing reasoners such as Pellet, HermiT or JFact, the framework can deduce complex contexts from already aggregated context information by using the reasoning paradigm in OWL. In the future, we plan to publish the framework, making it available to the community. Also, we plan to take into account semantic rule languages such as SWRL (Semantic-Web-Rule-Language), as well as other reasoners to extend the functionalities of the framework.
This work has been co-funded by the Social Link Project within the Loewe Program of Excellence in Research, Hessen, Germany
-  Carlson, D., Schrader, A.: Dynamix: An open plug-and-play context framework for android. In: IOT. pp. 151–158. IEEE (2012)
-  Chen, H., Perich, F., Finin, T., Joshi, A.: Soupa: standard ontology for ubiquitous and pervasive applications. In: Mobile and Ubiquitous Systems: Networking and Services, 2004. MOBIQUITOUS 2004. The First Annual International Conference on. pp. 258–267 (Aug 2004)
-  Chen, L., Hoey, J., Nugent, C., Cook, D., Yu, Z.: Sensor-based activity recognition. Systems, Man, and Cybernetics, Part C: Applications and Reviews, IEEE Transactions on 42(6), 790–808 (Nov 2012)
-  Falaki, H., Mahajan, R., Kandula, S., Lymberopoulos, D., Govindan, R., Estrin, D.: Diversity in smartphone usage. In: Proceedings of the 8th International Conference on Mobile Systems, Applications, and Services. pp. 179–194. MobiSys ’10, ACM, New York, NY, USA (2010), http://doi.acm.org/10.1145/1814433.1814453
-  Ferreira, D., Kostakos, V., Dey, A.K.: Aware: mobile context instrumentation framework. Frontiers in ICT 2, 6 (2015)
-  Glimm, B., Horrocks, I., Motik, B., Stoilos, G., Wang, Z.: Hermit: An owl 2 reasoner. Journal of Automated Reasoning 53(3), 245–269 (2014), http://dx.doi.org/10.1007/s10817-014-9305-1
-  Gopalratnam, K., Cook, D.J.: Active lezi: An incremental parsing algorithm for sequential prediction. International Journal on Artificial Intelligence Tools 13(04), 917–929 (2004), http://www.worldscientific.com/doi/abs/10.1142/S0218213004001892
-  Gu, T., Pung, H.K., Zhang, D.: Toward an osgi-based infrastructure for context-aware applications. IEEE Pervasive Computing 3(4), 66–74 (2004)
-  Kwapisz, J.R., Weiss, G.M., Moore, S.A.: Activity recognition using cell phone accelerometers. SIGKDD Explor. Newsl. 12(2), 74–82 (Mar 2011), http://doi.acm.org/10.1145/1964897.1964918
-  Meditskos, G., Dasiopoulou, S., Efstathiou, V., Kompatsiaris, I.: Sp-act: A hybrid framework for complex activity recognition combining owl and sparql rules. In: Pervasive Computing and Communications Workshops (PERCOM Workshops), 2013 IEEE International Conference on. pp. 25–30 (March 2013)
-  Paspallis, N., Papadopoulos, G.A.: A pluggable middleware architecture for developing context-aware mobile applications. Personal Ubiquitous Comput. 18(5), 1099–1116 (Jun 2014), http://dx.doi.org/10.1007/s00779-013-0722-7
-  Raento, M., Oulasvirta, A., Petit, R., Toivonen, H.: Contextphone: a prototyping platform for context-aware mobile applications. Pervasive Computing, IEEE 4(2), 51–59 (Jan 2005)
-  Roy, N., Misra, A., Cook, D.: Infrastructure-assisted smartphone-based adl recognition in multi-inhabitant smart environments. In: Pervasive Computing and Communications (PerCom), 2013 IEEE International Conference on. pp. 38–46. IEEE Computer Society (March 2013)
-  S., S., Bhattacharya, S., R., P.: Context aware framework. In: Sénac, P., Ott, M., Seneviratne, A. (eds.) Mobile and Ubiquitous Systems: Computing, Networking, and Services. vol. 73, pp. 358–363. Springer Berlin Heidelberg (2012), http://dx.doi.org/10.1007/978-3-642-29154-8_40
-  Shoaib, M., Scholten, H., Havinga, P.: Towards physical activity recognition using smartphone sensors. In: Ubiquitous Intelligence and Computing, 2013 IEEE 10th International Conference on and 10th International Conference on Autonomic and Trusted Computing (UIC/ATC). pp. 80–87 (Dec 2013)
-  Sigg, S., Haseloff, S., David, K.: An alignment approach for context prediction tasks in ubicomp environments. Pervasive Computing, IEEE 9(4), 90–97 (October 2010)
-  Sirin, E., Parsia, B., Grau, B.C., Kalyanpur, A., Katz, Y.: Pellet: A practical owl-dl reasoner. Web Semantics: Science, Services and Agents on the World Wide Web 5(2), 51 – 53 (2007), http://www.sciencedirect.com/science/article/pii/S1570826807000169, software Engineering and the Semantic Web
-  Tsarkov, D., Horrocks, I.: Fact++ description logic reasoner: System description. In: Proc. of the Int. Joint Conf. on Automated Reasoning (IJCAR 2006). Lecture Notes in Artificial Intelligence, vol. 4130, pp. 292–297. Springer (2006)
-  Yus, R., Bobed, C., Esteban, G., Bobillo, F., Mena, E.: Android goes semantic: Dl reasoners on smartphones. In: Bail, S., Glimm, B., Gonçalves, R.S., Jiménez-Ruiz, E., Kazakov, Y., Matentzoglu, N., Parsia, B. (eds.) ORE. CEUR Workshop Proceedings, vol. 1015, pp. 46–52. CEUR-WS.org (2013)