Towards Real-Time Context Awareness for Mobile Users: A Declarative Meta-Programming Approach

  • Seng W. LokeEmail author
Part of the Annals of Information Systems book series (AOIS, volume 13)


We envision a future with thousands of publicly available context sources acquired via sensors supplying real-time information about mobile users’ current circumstances with information on the Web. Such information can be harnessed for real-time decision making in daily life. Since context sources and information can be combined in myriad ways and be reasoned about in different ways, there is a need for some means to represent such aggregations, to create new aggregations, or to reason with such aggregations. Our basic idea is that the way context is aggregated to infer situations can be encapsulated and modularised in what we call “situation programs.” As we use a declarative programming approach, situation programs are readable, yet executable – a situation program encapsulates rules and queries to context sources, which can be executed to determine if a particular situation is occurring. Situation programs are treated as first-class entities and can be exchanged or loaded to increase the repertoire of situations an application can detect, or to provide alternative ways for an application to detect a situation or reason about situations. We describe our initial prototype Logic Programming for Context-Aware Programming System (LogicCAP-S) based on the language LogicCAP, and discuss extensions towards the mobile environment.


Context awareness Mobile users Declarative programming ­Situation programs Sensor mashups Context mashups 



The author thanks Do Manh Thang for implementation of the current desktop prototype, and anonymous reviewers for their valuable input. This chapter contains portions reprinted, with permission, from the paper “Towards declarative programming for sensor-based situation-aware applications: The LogicCAP approach”, published in the Proceedings of the International Conference on Intelligent Sensors, Sensor Networks and Information Processing, 2008, ISSNIP’08, pp. 447–452, ©2008 IEEE.


  1. Barwise, J. and J. Perry, Situations and Attitudes. Cambridge: MIT Press, 1983.Google Scholar
  2. Bettini, C., O. Brdiczka, K. Henricksen, J. Indulska, D. Nicklas, A. Ranganathan and D. Riboni, “Survey of Context Modelling and Reasoning Techniques”, Pervasive and Mobile Computing, 6, 2, 2009, 161–180.CrossRefGoogle Scholar
  3. CarTel, Project Overview, 2010, URL =
  4. Chen, G., M. Li and D. Kotz, “Data-Centric Middleware for Context-Aware Pervasive Computing,” Pervasive and Mobile Computing, 4, 2, 2008, 216–253.CrossRefGoogle Scholar
  5. ContextToolkit, Context Toolkit User’s Guide, 2003, URL =
  6. Dey, A.K., “Understanding and Using Context,” Personal and Ubiquitous Computing Journal, 5, 1, 2001, 4–7.CrossRefGoogle Scholar
  7. Gurgen, L., C. Roncancio, C. Labbé, A. Bottaro and V. Olive, “SStreaMWare: A Service Oriented Middleware for Heterogeneous Sensor Data Management”, in Proceedings of the Fifth International Conference on Pervasive Services, Sorrento, Italy 2008, 121–130.Google Scholar
  8. Henricksen, K. and J. Indulska, “Developing Context-Aware Pervasive Computing Applications: Models and Approach,” Pervasive and Mobile Computing, 2, 1, 2006, 37–64.CrossRefGoogle Scholar
  9. Hong, J.I., “An Architecture for Privacy-Sensitive Ubiquitous Computing”, Ph.D. Thesis, University of California at Berkeley, Computer Science Division, Berkeley, 2005, URL =∼jasonh/publications/jihdiss.pdfGoogle Scholar
  10. JSR-179, Location API for J2ME, 2009, URL =
  11. Loke, S.W., “Representing and Reasoning with Situations for Context-Aware Pervasive Computing: A Logic Programming Perspective”, The Knowledge Engineering Review, 19, 3, 2004, 213–233.CrossRefGoogle Scholar
  12. Loke, S.W., “On Representing Situations for Context-Aware Pervasive Computing: Six Ways to Tell If You Are in a Meeting,” in Proceedings of PerComWorkshops, Pisa, Italy 2006a, 35–39.Google Scholar
  13. Loke, S.W., Context-Aware Pervasive Systems: Architectures for a New Breed of Application. Auerbach (CRC),
  14. Loke, S.W., “Towards Declarative Programming for Sensor-Based Situation-Aware Applications”, in Proceedings of the International Conference on Intelligent Sensors, Sensor Networks and Information Processing (ISSNIP 2008), 2008, Sydney, Australia 447–452.Google Scholar
  15. Neely, S., M. Stabeler and P. Nixon, “SensorMash: Exploring System Fidelity through Sensor Mashup”, Poster at the Sixth International Conference Pervasive Computing, Sydney, 2008.Google Scholar
  16. Nexof (Reference Architecture), Context Model and Universal APS, 2010, URL =
  17. Nurmi, P., J. Kukkonen, E. Lagerspetz, J. Suomela and P. Floréen, “BeTelGeuse – A Tool for Bluetooth Data Gathering”, in Proceedings of BodyNets ‘07, Florence, Italy 2007, URL =
  18. Padovitz, A., S.W. Loke and A. Zaslavsk, “On Uncertainty in Context-Aware Computing: Appealing to High-Level and Same-Level Context for Low-Level Context Verification”, in Proceedings of the International Workshop on Ubiquitous Computing, Porto, Portugal 2004, 62–72.Google Scholar
  19. Lindgren, List of Parallel Prolog Implementations, 2010, URL =∼thomasl/par-prolog.htmlGoogle Scholar
  20. PRISM Prolog System, PRISM: Programming in Statistical Modeling, 2010, URL = //
  21. Raento, M., A. Oulasvirta, R. Petit and H. Toivonen, “ContextPhone – A Prototyping Platform for Context-Aware Mobile Applications,” IEEE Pervasive Computing, 4, 2, 2005, 51–59.CrossRefGoogle Scholar
  22. Ranganathan, A. and R.H. Campbell, “An Infrastructure for Context-Awareness Based on First Order Logic,” Personal and Ubiquitous Computing, 7, 2003, 353–364.CrossRefGoogle Scholar
  23. Riva, O., “Contory: A Middleware for the Provisioning of Context Information on Smart Phones,” in Proceedings of the Seventh ACM International Middleware Conference, Melbourne, Australia 2006, 219–239.Google Scholar
  24. Robinson, R. and J. Indulska, “XCML: A Runtime Representation for the Context Modelling Language,” in Proceedings of PerCom Workshops, White Plains, New York City, USA 2007, 20–26.Google Scholar
  25. Sensor, ML, Sensor Model Language, 2010, URL=
  26. Steller, L., S. Krishnaswamy, S. Cuce, J. Newmarch and S.W. Loke, “A Weighted Approach for Optimised Reasoning for Pervasive Service Discovery Using Semantics and Context”, in Proceedings of the International Conference on Enterprise Information Systems (ICEIS),Barcelona, Spain 2008, 113–118.Google Scholar
  27. Tavakoli, A., D. Chu, J. Hellerstein, P. Levis and S. Shenker, “A Declarative Sensornet Architecture,” ACM SIGBED Review, Special Edition on International Workshop on Wireless Sensor Network Architecture, 4, 3, Cambridge, Massachusetts, USA 2007, 55–60.CrossRefGoogle Scholar
  28. Thea, A., Web Ontology Language – OWL Parser for (SWI) Prolog, 2010, URL=
  29. TIME (Transport Information Monitoring Environment), The TIME Project, 2010, URL =
  30. Whitehouse, K., F. Zhao and J. Liu, “Semantic Streams: A Framework for Composable Semantic Interpretation of Sensor Data,” in Proceedings of the Third European Workshop on Wireless Sensor Networks, Zurich, Switzerland 2006, 5–20.Google Scholar
  31. Ye, J., L. Coyle, S. Dobson and P. Nixon, “Ontology-based Models in Pervasive Computing Systems,” Knowledge Engineering Review, 22, 4, 2007, 315–347.CrossRefGoogle Scholar
  32. Ye, J., L. Coyle, S. Dobson and P. Nixon, “Representing and Manipulating Situation Hierarchies Using Situation Lattices,” Journal of Revue d’Intelligence Artificielle, 22, 5, 2008.Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2011

Authors and Affiliations

  1. 1.Department of Computer Science and Computer EngineeringLa Trobe UniversityMelbourneAustralia

Personalised recommendations