=Paper= {{Paper |id=Vol-428/paper-2 |storemode=property |title=Using Rules for the Integration of Heterogeneous and Autonomous, Context-Aware Systems |pdfUrl=https://ceur-ws.org/Vol-428/paper2.pdf |volume=Vol-428 |dblpUrl=https://dblp.org/rec/conf/ecai/MosenIH08 }} ==Using Rules for the Integration of Heterogeneous and Autonomous, Context-Aware Systems== https://ceur-ws.org/Vol-428/paper2.pdf
     Using Rules for the Integration of Heterogeneous and
            Autonomous Context-Aware Systems
                            David Mosén1 and Arantza Illarramendi2 and Mohand-Said Hacid3


Abstract. In this paper we introduce NUBIA, a middleware that              system, whereas a combined management across domains is handled
combines, through business rules, information generated by hetero-         through NUBIA.
geneous and autonomous systems. Communication between NUBIA
and systems is loosely-coupled and highly compatible, as Web Ser-          To test the middleware and demonstrate its usefulness, we
vices and other standards are used. The main component of NUBIA            constructed a typical homecare scenario, oriented towards a single
is a rule engine, sensible to temporal knowledge and with integrated       inhabitant (i.e. the user), although visits pose no actual problem.
functions (e.g. frequencies, percentages). A user friendly interface al-   Abundant previous work about homecare can be found [2] [3], and
lows entering, using a script language, customized rules, whose con-       we refer to it for a more thorough study on the subject. However,
ditions depend on the information sent from the systems. For each          our aim is to show how an integral homecare system can be build
rule, settings such as the maximum firing frequency and the activa-        adding up independent, separately developed, components. Thus,
tion within a group may be defined. Moreover, NUBIA also supports          the personal healthcare application, provided by SaludNova [4], and
a rule editor role, which allows a more realistic viewpoint of context-    the domotics system we integrated were already developed, in order
aware rules customization. Finally, automatic rule translation to the      to test out the integration issue in a real scenario.
user’s language and a role-oriented interface facilitate the interaction      Benefits from integration through rules of the mentioned systems
with NUBIA.                                                                can be seen in several cases. For example, the healthcare system
                                                                           lacks fall detection, so if domotics determines using its sensors
                                                                           that the user fell, a warning is sent to NUBIA, which in turn warns
1   INTRODUCTION                                                           the healthcare system. In the same way, the domotics system can
The term context awareness has evolved through time, but has always        be commanded to turn off the oven and stove if the user suffers a
maintained a sense of somehow gathering data from the environment.         heart failure. Further, if a risk situation requires both systems to
In the last years, the definition of context by Dey et al. [1] seems to    detect certain alarms, then a third system, in charge of handling joint
be the most widely embraced. It states that context is ”any informa-       alarms, is notified. As a final example, this additional alarm system
tion that can be used to characterize the situation of entities that are   can also be notified of errors in the main systems (see Subsection
considered relevant to the interaction between a user and an appli-        3.2.1).
cation, including the user and the application themselves. Context is
typically the location, identity and state of people, groups and com-      Summing up, the main features of NUBIA are the following
putational and physical objects”. Notice that this definition implies      ones:
that context is not necessarily physical, so it can be sensed through
                                                                           1. Because sensed context is information sent from connected sys-
virtual sensors (e.g. Web Services).
                                                                              tems through Web Services, it is a context-aware application too.
   Nowadays, context-aware systems work in general in an au-
                                                                           2. It allows combining context-aware systems information through
tonomous way and do not interact among them. However, connecting
                                                                              customized business rules sensible to knowledge extracted from a
them can, in many situations, increase the advantages that they pro-
                                                                              stored history.
vide separately. Let us take the example of two systems, in charge
                                                                           3. Finally, it provides a user friendly graphical interface, which sup-
of monitoring a house and vital signs of a person, respectively. A
                                                                              ports different user roles (final, rules editors and administrators).
connection between them can boost alertness in a home for elderly
people scenario, where a single unit reacts to information about both
the house and the owner’s health. Of course, each system should still      2 RELATED WORK
be able to be in control of its own domain.
                                                                           Concerning related works, we can observe that trends in software
   For a tight coupling among systems, a complex manual process
                                                                           development move toward generic design patterns. In that direction,
may be needed. With this in mind, we present in this paper NUBIA,
                                                                           there seems to be an agreement on the need for finding a context-
a middleware that integrates, through loosely-coupled connections,
                                                                           aware standardized architecture [5]. This area has been widely stud-
any kind of context-aware systems, independently of the domain that
                                                                           ied, with several proposals of context-aware frameworks [6] [7]. We
they consider, while preserving the autonomy of each system. Thus,
                                                                           also present a proposal of a standardized architecture; however, our
internal management in each domain remains within the respective
                                                                           goal in this paper is to focus on the use of rules for getting the inte-
1 University of the Basque Country, Spain, email: david@mosen.es           gration of context-aware systems.
2 University of the Basque Country, Spain, email: a.illarramendi@ehu.es       On context integration, the work by Tao Gu et al. on SOCAM [8],
3 Univ. Claude Bernard Lyon, France, email: mshacid@liris.univ-lyon1.fr
                                                                           an architecture for developing context-aware services, is the closest
to our proposal. We basically differentiate on what is integrated, as    3.1     Context handling module
we aim at autonomous context-aware systems integration, while SO-
CAM directly integrates physical context. Anyhow, both proposals         Taking into account that systems can communicate heterogeneous
carry out the idea of reasoning with the context to offer some kind of   context, there is a need for its classification into predefined groups.
service to external applications.                                        This process is called categorization.
   Similarly to NUBIA, the system proposed by Agarwal et al. on
electronic medical records [9] uses business rules to combine gath-      3.1.1    Categorization
ered history information, namely, from RFID sensors and patient
monitoring. Thus, our proposal is similar in the sense that we use       Two categorization viewpoints exist [11]: conceptual, based on what
gathered information in business rules. However, in the case of NU-      the context symbolizes (e.g. person, network, physical environment),
BIA, information used is context which comes from any kind of            and measurement, based on how the context is represented (e.g. a
context-aware system, thus not restricted to the medical field.          value, a predicate). There exists a bigger tendency to follow the con-
   Finally, our approach towards personalization, based on cus-          ceptual categorization [12] [13]. However, we chose a measurement
tomized rules managed by a rule editor, can be situated among those      categorization in order to explore its possibilities in relation to the
that appear on the existing literature, neatly explained by Henrick-     management of history knowledge. Hence, context is classified into
sen & Indulska [10]. They classify personalization approaches on         the following four categories:
context-aware systems into three categories: end user programming,
machine learning and preference-based. The one used in NUBIA is          1. Single. Simple events, which happen at a very precise moment.
similar to the end user programming, but it provides as a novelty a         Alerts and punctual detections fit into this context category.
scheme where the user relies on a rule editor to make the adjustments    2. Discrete. The context can only take one value once at a time from
he/she requires.                                                            a finite set of values, each of which represents a state. Examples
                                                                            in this category are device’s power state, which toggle between
                                                                            on and off, and generally any context whose possible states are
                                                                            well-defined.
3   NUBIA ARCHITECTURE                                                   3. Continuous. In this case, the value representing the context is a
                                                                            real number, so we can make comparisons to see whether it is
                                                                            within a certain range. Uncountable data belong to this category.
The middleware core is divided into three main units. First, the         4. Descriptive. Compound content cannot be represented by any of
context handling module, which transforms context to a standardized         the three categories above. This category is based on the descrip-
representation and deals with history knowledge. The rule engine            tion statement and uses the notion of predicate. A person’s loca-
module, which manages the combined information using business               tion, for example, is represented as location(person,place).
rules. Finally, the communication module, which provides the
context handling module with the context coming from systems,               Furthermore, context reported by systems may correspond to dif-
and allows the rule engine to communicate about actions to execute       ferent levels of reasoning, ranging from raw data to thoroughly rea-
in the systems. Hence, notice that communication flows both ways         soned knowledge. Figure 2 shows a layered scheme [14] where con-
between NUBIA and systems.                                               text information flows to the middleware from any of the two first
                                                                         layers of a context-aware system.
In this section, we briefly explain the main features of the                Nevertheless, the category to which context belongs is the only
mentioned modules, which can be seen in Figure 1.                        relevant distinction and context is manipulated based on it. For ex-
                                                                         ample, a light switch, the energy level of an electron and a storm
                                                                         emergency level are all considered as discrete context, regardless the
                                                                         complexity of the process to obtain them.




                                                                                     Figure 2. Information flow in a layered scheme




                   Figure 1. NUBIA’s architecture                        3.1.2    The summarizing log
                                                                         NUBIA manages a special type of history, called a summarizing
                                                                         log, which gets updated every time some context information is
                                                                         received from a system. A typical history logs everything, for an
eventual use, without any further modification than the addition             some context is sensed. If, given the new situation, the conditions of
of new records. In a summarizing log, instead, a logging action              a rule are true, it fires.
causes a modification that updates key information about the current            Second, reactive rule engines. In this case rules fire when their
situation. This logging method helps to extract knowledge from the           conditions are true as well, but they need some event to happen in
history, that we refer as temporal knowledge.                                order to get evaluated. Hence their name, Event Condition Action
                                                                             (ECA). This class of rule engine is suited for most context-aware
Stored information such as number of times in a state or elapsed time        systems, because sensed context adjusts well to the concept of event.
within a range, together with interesting timestamps, are enough to          Thus, the system does not need to explicitly invoke the rule engine,
infer the above mentioned temporal knowledge (e.g. frequencies,              as it is already aware of generated (context) events.
time since last state shift).                                                   In NUBIA, many defined conditions depend on time, so they can-
   Let us suppose that we want to know the frequency of a given              not be evaluated only when some context information arrives, be-
simple event. Two fields are required in the summarizing log: the first      cause temporal knowledge must also be taken into consideration.
time the event is registered, and the times count. Thus, the frequency       There are two possible mechanisms to deal with this situation. Let
can be calculated:                                                           us take the following as an example condition:
   f requency = (now − f irst time)/times count                                 The light has been in state off for 5 minutes
   There is also information directly extracted from the summarizing            The first option (continuous evaluation) is to constantly check
log, as it is useful without any further operation. Examples are:            whether 5 minutes have elapsed since the last shift to off. The
within which ranges from a defined set is some continuous value;             alternative (evaluation scheduling) is to schedule the system to
and the number of times in a certain state. For these two cases, the         invoke the rule engine 5 minutes after each time the light changes to
following information could be part of the log:                              the off state. This alternative is more efficient, as it uses processing
                                                                             resources more wisely. However, it is also non-trivial, because
(name:corporalTemp(at)temp(at)biometrics, currentValue:36.6)                 depending on the condition semantics, evaluations should be sched-
(range:[36.0,36.9], lastBegan:12060000004 , lastEnded:-)                     uled in different ways (e.g. with a certain frequency for a limited
(range:[36.0,36.6],                                                          time, when the event is detected). In either case (continuous or
   lastBegan:1206000800, lastEnded:1206000900)                               scheduled evaluation), the middleware is in charge of telling its rule
(range:[36.8,max], lastBegan:1206001000, lastEnded:-)                        engine when to evaluate the rules (i.e. events do not directly trigger
                                                                             the rules) so we chose to implement them as production rules. In
(name:faintRisk(at)alarms(at)biometrics, currentState:low,                   particular, rules are implemented using JBoss Rules [19], following
   lastShift:1206010000, shifts:7)                                           a forward-chaining production structure.
(state:low, times:5, last:1206010000)
(state:average, times:2, last:12060000300)                                   The right hand side of the rules comprises two kinds of actions:
(state:high, times:0, last:-)                                                internal and external.
                                                                                External actions are not executed by the middleware, but in a con-
Conditions in the rules (see Section 3.2) are checked against                nected system. In addition to sending context information, systems
all this knowledge, temporal and non-temporal.                               may expose actions to NUBIA through Web Services, so that they
                                                                             can be ordered to execute the actions.
Finally, notice that summarizing logs are not aimed at applica-                 Internal actions control NUBIA itself and gathered information.
tions with infrequent or full history reasoning [16] [17], as they           This includes error count resetting. NUBIA detects both incoming
are not powerful enough. Context-aware systems, however, have                communication errors (i.e. context reported by a system is invalid or
a strong requirement on time, and a summarizing log helps to get             the message is corrupt) and outgoing communication errors (i.e. the
quick response times. Moreover, it is compatible with a full-fledged         system to which to connect is unreachable). Data can also be reset
history, so that the best of both worlds is available.                       if, for example, the information about a certain context should be
                                                                             initialized. Finally, a system may refuse to execute an ordered action,
                                                                             so this can be used in the condition part too.
3.2     Rule engine module
This module evaluates rules that trigger depending on the context            3.2.2    Settings
knowledge extracted from the summarizing log. The rule engine is
independent from the communication process. As a result, systems             Some of the incorporated settings in the rule engine include:
can continue to report context information even if the rule engine is           Maximum firing frequency. Controls repetition of rule firing. Even
not active.                                                                  if a rule is evaluated to true, it will not be fired unless the defined time
                                                                             has elapsed. In that case, it will only fire if it is still true. For example,
                                                                             the user may want to be notified of new mail after at least 2 hours
3.2.1    Rule structure                                                      since the last notification, even if mail arrives in the meanwhile.
                                                                                Activation group. This setting has been extended from the JBoss
Two classes of business rule engines exist. First, and the one used
                                                                             Rules option with the same name. The rule within an activation group
in our proposal, a production rule engine deals with rules with ”IF
                                                                             with the highest priority is executed; the rest, albeit evaluated as true,
condition THEN action” semantics. Usually, an external agent in-
                                                                             do not get a chance to be executed until the time defined by the
vokes the engine, so in the scenario of a context-aware system with
                                                                             group’s maximum firing frequency goes by (all rules in a group have
production rules, the system typically invokes the engine whenever
                                                                             the same maximum firing frequency). For example, if the user has a
4 Timestamps are described in Unix time [15] (seconds elapsed since 01 Jan   tumble, the system should call a relative, but if, additionally, the user
  1970, 00:00:00 UTC).                                                       suffers a heart-attack, this action may be overridden by a call to the
emergency number.                                                           Dynamic invocation allows client applications to invoke Web Ser-
   Other settings, such as firing count limit and expiry dates, may         vices whose descriptions are unknown until the application is used.
eventually be included as well. The existance of some of these set-         As an example implementation, the Dynamic Invocation Interface
tings in JBoss Rules might facilitate their implementation.                 (DII) [18] for CORBA supports this functionality. NUBIA needs the
                                                                            dynamic invocation, given that it is aimed at working with before-
                                                                            hand unknown systems.
3.2.3   NIRE language
                                                                               For a higher decoupling from inner operation, serialized XML are
As a final point concerning the rule engine module, we designed a           sent, so if more communication-related functionalities are added to
script language to facilitate the definition of rules and check their va-   the middleware, only the XML representation would change, whilst
lidity, so that they do not cause errors during execution. The NUBIA        Web Services in connected systems and the middleware would
Input Rule Editing (NIRE) language provides the following benefits:         remain the same. The following XMLs are examples of incoming
                                                                            and outgoing messages, respectively:
1. Transparency and independence from the underlying rule imple-
   mentation engine.                                                        
2. A compact syntax, with no unneeded verbosity.                            
3. Translation extensibility through XML, allowing the definition of        0.32
   new rule translations to other user languages without recompiling        
   the application.
                                                                            
   The following is an example of a rule in NIRE. Notice that settings
                                                                            
are not defined in the language, as they are introduced through the
                                                                            off
graphical interface.
                                                                            
if
  is-true                                                                      Despite Web Services are the best communication option because
     presence@locator@wear $somebody                                        of its wide de facto standardization, there are systems that do not
  last-time-in-range                                                        fully accept them, such as smartphones, most of which cannot host a
     temperature@temp01@domotics 15 27 > 3600                               web server. To cope with this difficulty, socket communication stands
  time > 18:00:00                                                           in NUBIA as an alternative to Web Services.
then
  turn-heater (using heater@domotics) "on"
  display (phone(at)aux-phone)                                              4   INTERFACE
     "$somebody is home, turning heater on."

   The rule has a typical ”IF condition THEN action” structure. Each        The task of integrating autonomous context-aware systems is not
of the first two conditions are stated over a certain context, while the    easy, so NUBIA provides a graphical interface that focuses on the
third is an internal NUBIA condition which controls the time of the         separation of the different types of users (i.e. roles) for a more spe-
day. Each action is defined by a name and its corresponding device          cific interaction with each of them. Therefore, before we show the
and system. In this rule, both actions require one parameter each, de-      main features of the GUI, we present the user roles considered by
limited by double quotation marks. Concerning symbols, ”@” (i.e.            NUBIA.
at) denotes in which device and system a context is sensed or an ac-
tion is executed, whereas the dollar symbol, denotes variables. Thus,
the first condition states that somebody must be detected, and saves
his/her name in the ”somebody” variable.
   If the chosen translation language is English, the user would see
this resulting text:
   If presence is true for a certain person ’somebody’, temperature
has not been between 15 and 27 ◦ C in the last hour and it is more
than 6 in the afternoon, then turn heater on and display in the phone
”’somebody’ is home, turning heater on.”.


3.3     Communication
Information flows between systems and NUBIA in both ways: con-
text information is reported to the middleware and orders to execute
actions are sent back. In either case, Web Services are used. Thus,
to make communication possible, developers who wish to have their
systems integrated need to: make methods to be used by NUBIA
available through a Web Service; and report desired context to NU-                    Figure 3. Some windows from NUBIA’s interface
BIA’s Service.
   Usually, applications use a fixed set of Web Services, but some-
times they may require to call beforehand unknown Web Services.
4.1    Roles                                                              into account, the average response time starts at 10 milliseconds with
                                                                          a few defined rules, each of which adds a 4 microseconds overhead.
Relation with end users is a thoroughly studied issue in context-            This last fact confers the middleware scalability concerning rules.
aware systems. Giving users control over a system they use implies        Finally, the fast processing of Web Service messages supports heavy
they need to learn, in some degree, how to interact with it. Different    communication between NUBIA and the context-aware systems, so a
approaches towards this interaction exist [10], but they lack either      great scalability is also achieved in the amount of integrated systems
power of control or simplicity, so we define a role that fills the gap    and communication with them.
between the end user and the administrator, to keep the user some-
how in control and yet increase simplicity in their interaction with
the system. Thus, for our middleware NUBIA, we establish a three          ACKNOWLEDGEMENTS
tiered role division to better focus on each role requirements:           This work is supported by the Spanish Ministry of Education and
                                                                          Science (TIN2007-68091-C02-01) and the Basque Government (IT-
1. Administrator. There only exists one, and defines which systems        427-07).
   to connect to NUBIA and their specifications, probably handed
   by other administrators or developers. Also, he/she configures set-
   tings such as working mode (dedicated server or shared machine)        REFERENCES
   and application defaults. Finally, the administrator is in charge of    [1] A. Dey, D. Salber, and G. Abowd, A conceptual framework and a
   account management.                                                         toolkit for supporting the rapid prototyping of context-aware applica-
2. Rule editor. Manages rules without the need to know about appli-            tions, Human-Computer Interaction, vol. 16, pp. 97-166, 2001.
                                                                           [2] A. Cesta & F. Pecora, Integrating Intelligent Systems for Elder Care in
   cation programming or technical details. A user with a little bit
                                                                               RoboCare, W.C. Mann & A. Helal (Eds): Promoting Independence for
   of technical knowledge may manage rules and act as a rule editor            Older Persons with Disabilities, IOS Press, pp. 65-73, 2006.
   too.                                                                    [3] G. Virone et al., An Advanced Wireless Sensor Network for Health Mon-
3. End user. Can only see the defined rules and decide whether to              itoring, D2H2, Arlington, Virginia, 2006.
   start or stop NUBIA.                                                    [4] SaludNova Sociedad Cooperativa, website: http://www.saludnova.com/
                                                                               (as of April 2008).
                                                                           [5] M. Baldauf & S. Dustdar, A Survey on Context-Aware Systems, Techni-
In this scheme, roles are incremental, with the administrator having           cal Report Number TUV-1841-2004-24, November 2004.
privileges as a rule editor and user as well.                              [6] J.E. Bardram, The Java Context Awareness Framework (JCAF), Tech.
                                                                               Report CfPC 2004-PB-61, Centre for Pervasive Computing, Aarhus,
                                                                               Denmark, 2003.
4.2    Ease of interaction                                                 [7] K. Henricksen & J. Indulska, A Software Engineering Framework for
                                                                               Context-Aware Pervasive Computing, Second IEEE International Con-
A configuration wizard à la MySQL [20] (see figure 3) guides the              ference on Pervasive Computing and Comms. (PERCOM 2004), March
administrator to easily configure, for example, system defaults and            2004.
                                                                           [8] T. Gu, H. Pung , D. Zhang A service-oriented middleware for building
working mode.                                                                  context-aware services, Journal of Network and Computer Applications
   Systems specifications are defined in XML, so they can be                   28(1): 1-18, 2005.
checked through an XML-schema and translated to internal rep-              [9] S. Agarwal, Context-Aware System to Create Electronic Medical En-
resentation through an XSL transformation. This way, portability,              counter Records, Technical Report Number TR-CS-06-05, 2006.
                                                                          [10] K. Henricksen & J. Indulska, Personalising Context-Aware Applica-
independence and easy handling are achieved and hence, the                     tions, in OTM Workshop on Context-Aware Mobile Systems, Springer-
administrator selects the file with the definitions and NUBIA does             Verlag, pages 122–131, 2005.
the rest.                                                                 [11] M.A. Razzaque, Categorization and Modeling of Quality in Context
                                                                               Information, in Proceedings of the IJCAI Workshop on AI and Auto-
Maximum firing frequency, validity expiration or activation                    nomic Communications, 2005.
                                                                          [12] Eleftheria Katsiri & Alan Mycroft, A first-order logic model for context-
policies within a group are settings that allow a more refined exe-            awareness in distributed sensor-driven systems, RSPSI Workshop,
cution control. Nevertheless, defined defaults (by the administrator           2006.
or NUBIA itself) make simple rule creation an easier task. A rule         [13] Anjum Shehzad, Hung Q. Ngo, Kim Anh Pham and Sungyoung Lee,
preview, an auxiliary panel with available data and syntax documen-            ”Formal Modeling in Context Aware Systems”, KI-Workshop Model-
                                                                               ing and Retrieval of Context (MRC2004), 2004.
tation, and an accurate error checking facilitate rule creation even      [14] S.W. Loke, Context aware pervasive systems : the architecture of a new
more.                                                                          breed of applications (ISBN: 0849372550), Abstract layered architec-
   Automatic translation of rules to the user’s language allows less           ture (page 25) . Boca Raton, FL : Auerbach Publications, 2006.
technical users to easily understand them, whilst not giving extra        [15] Unix       time     article   from       Wikipedia,      available     at
work to the rule editor.                                                       http://en.wikipedia.org/wiki/Unix time.
                                                                          [16] G.M. Youngblood et al., Automation Intelligence for the Smart Envi-
                                                                               ronment, IJCAI-05, page 1513, 2005.
                                                                          [17] V. Jakkula & D. Cook, Anomaly detection using temporal data mining
5     CONCLUSIONS                                                              in a smart home environment, Methods of Information in Medicine,
                                                                               2008.
We have presented a middleware that successfully connects, with           [18] BEA Documentation on the Dynamic Invocation Interface, available at
loosely coupled Web Services, autonomous context-aware systems,                http://e-docs.bea.com/tuxedo/tux80/creclien/dii.htm (as of April 2008).
combining and making use of their information to trigger business         [19] JBoss Rules, http://www.jboss.com/products/rules (as of April 2008).
                                                                          [20] MySQL 5.0 Server Configuration Wizard, documentation available at
rules. Interaction is made through an easy to use interface, designed
                                                                               http://dev.mysql.com/doc/refman/5.0/en/mysql-config-wizard.html.
taking roles into account.
   Using the implemented prototype, we observed the following be-
havior: a rule may be triggered by incoming context information or
because some defined time has elapsed. Taking both possible cases