Rule-based Metaprogramming for Smart Spaces 

Research output: ThesisLicenciate's thesis


The motivation of this work is goes back to the objective of achieving interoperability in multiparty environments such as ubiquitous systems. Full interoperability in an open environment requires mutually sharing the behavior of the participants, so that the behavioral interoperability becomes as relevant as interoperability of data. This requires analysis or evaluation of behavioral descriptions from untrusted parties in a controlled manner. Furthermore we need to manage the evaluation process based on the content and provenance of the descriptions and other information on which the descriptions operate. This information allows one to choose which behaviour is to be used and which data is to be operated on. To enable this vision we propose to present behavioral descriptions as Answer Set Programming (ASP) rules. In this work we present a method for the evaluation of ASP rules based on metaprogramming: the evaluator for the rules is implemented using ASP rules themselves. To facilitate metaevaluation, we transform rules to a reified format, which enables representing rules as facts, and construct the metaevaluator to work directly on this reified format. Facts corresponding to reified rules and the metaevaluation rules are then treated by native ASP tools. We give a proof that our metaevaluator adheres to the stable model semantics for ASP evaluation. Having rules in the reified format is beneficial as behavioral rules can then be shared and manipulated as any other data. We have implemented a mechanism which maintains the provenance information of data during the rule evaluation along with hooks to allow control over the context of the use of that data. This allows attaching arbitrary metainformation to rules and facts and allows independently creating policies which control on how different data is handled in the ASP solving phase. In addition to the metaevaluation phase, we have implemented syntactical safety analysis of reified rules. These methods enable sharing, analyzing and executing behavioral descriptions in a controlled manner within the same semantic ASP framework, providing one solution for the interoperability problem. The evaluation of ASP rules has two logical phases: grounding and actual solving. We have separated provenance handling and syntactic analysis to the metagrounding phase with the intention that rules and data, which do not match the provenance criteria, are never delivered to the solving phase. To the best of our knowledge, this work presents the first implementation of a metagrounder for ASP programs. According to performance analysis, the metagrounder is not yet competitive with current grounder technology.
Original languageEnglish
QualificationLicentiate's degree
Awarding Institution
  • Aalto University
  • Niemelä, Ilkka, Supervising Professor
  • Janhunen, Tomi, Thesis Advisor
Publication statusPublished - 2015
MoE publication typeG3 Licentiate thesis


  • Answer set programming
  • Metaevaluation
  • Grounding
  • Ubiquitous systems
  • Smart spaces
  • Semantic web
  • Rules
  • Logic programming
  • Knowledge representation
  • Semantics
  • Stable models


Dive into the research topics of 'Rule-based Metaprogramming for Smart Spaces '. Together they form a unique fingerprint.

Cite this