rule generation method in smart home based on...
TRANSCRIPT
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
293
doi:10.21311/001.39.10.35
Rule Generation Method in Smart Home Based on Habits
Pingquan Wang1, 2* 1Beijing Key Laboratory of Intelligent Telecommunication Software and Multimedia, Beijing University of Posts
and Telecommunications, Beijing 100876, Beijing, China 2Huh-hot University for Nationalities, Huh-hot 010010, Huh-hot, China
*Corresponding author (E-mail: [email protected])
Hong Luo, Yang Sun Beijing Key Laboratory of Intelligent Telecommunication Software and Multimedia, Beijing University of Posts
and Telecommunications, Beijing 100876, Beijing, China
Abstract In this paper, we propose a habit-based SWRL generation and reasoning approach in smart home. Definition and recognition of habits of daily living can provide humanized smart home for assisted living application, especially for people with memory deficits. This paper presents Recognizing Habit of Daily Living (RHDL) by discovering and monitoring smart home context information. The habit and habit association of using electrical appliances are defined explicitly for the first time. The generation rules between habit/complexhabit and SWRL are designed, and the reasoning is based on the Semantic Web Rule Language (SWRL). The ontology model for the RHDL is designed and the prototype system of RHDL is implemented using protege and Jess tools. Key words: SWRL, Smart Home, Habit, Ontology, RHDL.
1. INTRODUCTION
Smart home has been widely applied recently, it provides different kinds of services to inhabitants, such as comfort service, healthcare service and security service(Das and Cook, 2002; Virone and Noury, 2002;Mihailidis and Carmichael, 2004;Zhang and Mcclean, 2008), etc. The traditional smart home usually uses the “device-centric” construction method. For example, the smart home controllers are designed according to the equipment functions, such as turn on, turn off, adjust, etc. The method of “device-centric” takes more into account of the device rather than the owner of the smart home. Therefore, in this paper we present a habit-based SWRL generation and Reasoning approach which is a ``user-centric" method. Definition and recognition of habits of daily living can provide humanized smart home for assisted people’ lives, especially for elder with memory deficits.
In traditional smart home, the device's control rules are set manually. When the device works alone, it runs normally, however, multi-devices work together, they always cause the problem of feature interactions(Leelaprute and Matsuo, 2008). For example, Bob as the owner of the smart home registers all the electrical apparatus in the energy conservation service, while Jordan as the family member always watches TV more than one hour. Then the energy conservation service turns off the TV when it finds the TV working for a long time, and Jordan has to turn on the TV again. Besides, in tradition method, the higher-coupling between rules and reasoning engine makes the rule system difficult to be changed and inherited. For example, the living environments are subject to gradual transformations as they are modified by the user inhabiting them in various way. Smart home shares similar characteristics as home dweller would want to change or add new dependencies to the application logic from time to time. This includes adding new subsystems or appliances for new services. It is worth mentioning that such modification or adding new dependencies should be done without affecting the running applications. However, the current implementation of subsystems integration shows that such modification in smart home environment is difficult due to the tight coupling between configured subsystems (Leong and Ramli, 2009).
In this paper, we propose a habit-based SWRL generation and reasoning approach, and create a smart home ontology model by OWL-S. We define the generation rules between habit/complxhabit and SWRL. The automation of the smart home is realized by the reasoning results of SWRL rules.
In this paper, we make the following contributions: (1) We define the habit associations of using electrical apparatus for the first time. (2) We classify the smart home into user, location, device, environment, habits, and define the smart home
ontology model by the OWL-L. (3)We define the SWRL Generation Rule between habit and complex habit.
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
294
2. RELATED WORKS
2.1. Smart Home In the smart home, the user's operation sequence of using different kinds of devices could be seen as
association rules. The association rules was first proposed by Agrawal in (Agrawal, 1993), and used in market basket analysis providing rules, such as the consumer who bought product A and in the meantime, he would buy product B. The association rules are universal in smart home, for instance, the user always turns the light on, and
in the meantime switches on the computer, opens air conditioning when the temperature is above 30℃. There were several mining methods for the association rules, frequent mining, clustering method, etc. FP-Gowth algorithm was used for mining the strong association rules in the frequent itemset(Han and Pei, 1970). Apriori algorithm was used for identifying the activities associations in (Han and Pei, 2000). For getting the activity sequence, start time and persistent period, the K-mean was adopted in (Nazerfard and Rashidi, 2010). In (Virone and Noury, 2002), Fuzzy C-means was used for solving the setpoint temperature control problem. 2.2. OWL Ontology and SWRL
The heterogeneous data has already restricted and hindered the further application of smart home. Ontology was a formal representation for different kinds of knowledge(Madhavan and Bernstein, 2001;Son and Park, 2011), and it could provide knowledge sharing and reuse, and it has been widely used in the field of context-aware and smart home application (Xu and Lee, 2009). The relation of device and service was modeled and managed by ontology in (Aroyo and Traverso, 2009). Web Ontology Language (OWL) was the most recent development in standard ontology language from the World Wide Web Consortium (W3C) (Horrocks and Ian, 2004), it was used to specify the knowledge base. The owl ontology was composed of Individuals, Properties and Classes, based on a different logical model which makes it possible for concepts to be defined as well as described. OWL could describe the relation of classes and the constraints between attributes, it was XML-based which makes it inter-operable between different networks. Besides, the acceptance of OWL as a defacto language for its representation and the development of tools such as protege for its construction have favored its wide use in many fields, especially in the Semantic Web(Maedche and Alexander, 2002). The knowledge could be shared and reused through Uniform Resource Identifier easily. As far as the representation of production rules is concerned, Semantic Web Rule Language (SWRL) has been adopted by W3C as the representing standard for production rules based on ontology and it is a combination of the OWL DL and OWL Lite sublanguages with the Unary/Binary Datalog RuleML sublanguages of the Rule Markup Language. SWRL combines the OWL knowledge base and inference rule, it is a language which able to build up rules to perform reasoning about OWL ontology instances and infer new knowledge about them. Moreover, there are several plug-ins for the editing of rules in the protege tool, which have favored its spreading and its using. There are current some reasoning engine based on OWL and SWRL that allow maintaining consistency and inferring values for the attributes of classes in the ontology, such as Jess, Algernon and SweetRules (Bae, 2014). 3. ONTOLOGY FOR RHDL
3.1 RHDL Architecture To some extent, the user's activity characteristics are influenced by their habits. For example, some people
may drink water first when they get up while others may wash. The two different activity characteristics are related to their different living habits. The surveys done in people’s daily activities found that 47 % of the participants daily activities would occur at the same time and space, and the consistency in people's daily lives form their habits (Wood and Quinn, 2003). Therefore, in this paper we design the smart home system based on user's habit which provides personalized service. The system framework is shown in Figure 1, which consists of four parts, including smart home environment module, smart home monitoring module, habit pattern monitoring module, smart home management module. The smart home environment module includes different kinds of electrical apparatus, environmental sensors and the users. The electrical apparatus are important component of the home. The “on”, “off” and “adjust” states always stand for the important activities in progress at home, for example, the user turns on the TV at noon, stands for the beginning of rest activity in the living room, moreover, turns off the TV, stands for the ending of rest activity. We could collect the “on/off/adjust” operations by installing the extra smart switches. The environment sensors collect the environmental parameters such as temperature, humidity, etc. The environment information has a direct relationship with the operation of
electrical apparatus, for example, the user adjusts the air-condition to 26 ℃ on account of the indoor
temperature is higher than 30 ℃, and adjusts the air-condition to 27 ℃ when the indoor temperature is lower
than 20℃. The user is an important part of the smart home because of the ultimate goal of smart home is to meet the user's needs. In this paper, we hope to build the smart home system based on user's habits. However, there are multiple users living in a smart home, and their habits may cross together, therefore, the users have to wear the smart bracelets for distinguishing the identities. The smart home monitoring module extracts the context
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
295
information from environment. There are two kinds of contexts, history context and real-time context. Habit pattern monitoring module is responsible for habit learning and context reasoning, it is consisted of three parts, Habit Learning, SWRL Rule generation and Reason. Habit Learning clusters the history context and get the habits. SWRL Rule generation translates the habits into SWRL Rules, Ontology Base stores the smart home ontology classes, such as user, position, environment, habit, etc. Based on ontology base and SWRL rules, the Reason infers new results. Smart Home Management translates the reasoning results into device control commands.
Smart Home Monitoring
2
Abstraction
HistoryContext
Real-timecontext
Smart Home Environment
Smart Home Management
1
4
Habit Learning
SWRL RuleGeneration
Reason
Ontology Base
3 Habit Pattern Monitoring
RHDL Reasoning
Control Message
Operating record and environment record
Figure 1.System architecture of RHDL
User
Time
Habit/Complex Habit
Location
Device
Environment
Belong to
hasTime
hasTime
hasLocation
OperatedByhasLocation
hasDevicehasEnvironmet
HasEnvironment
hasLocation
Figure 2. OWL-based ontology relationship for RHDL
3.2 Ontology for RHDL
The context reasoning process is on the base of ontology, the semantic web ontology stands for the real-time context. The Reason module gets the real-time context and infer new result based on the semantic web ontology. Therefore, we build the ontology relationship model as shown in the Figure 2. It is composed of several domains ontology: User, Time, Location, Device, Habit/Complex Habit, Environments. The properties establish the relationship between different ontologies, such as the OperatedBy connects User and Device,
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
296
stands for the Device individual is operated by the User individual. The user ontology describes the features of user by the properties of name, age, etc. Environment ontology describes the information of smart home environment by different kinds of sensors such as temperature sensor, humidity sensor, light sensor, etc. Device ontology describes the electrical apparatus in the smart home by device category, operation type, etc,which could solve the problem of device heterogeneity. The Location ontology and Time ontology describe the features of location and time in smart home. Habit/Complex Habit ontology describes the user's habit feature, the habits are related to time, location, user, environments.
We use the protege-OWL (or protege for short) (Noy and Mcguiness, 1995), a free, open-source, graphical ontology editor and knowledge base framework, to define the knowledge model for our work. OWL provides three increasing expressive sublanguages. In our research we used the OWL-DL, which is based on Description Logics (DL). The Figure3 shows the smart home ontology model which built by protege. The Habits class is consist of two subclass, Habit and ComplexHabit. The Habit has 6 subclass, and the ComplexHabit has 16 subclass. The Properties are binary relations on individuals, i.e (Horridge, 2004). The properties link individuals together, Table 1 shows the object properties in the OWL-based ontology relationship for RHDL. For example, the property hasOperation might link the domain class Device to the range class Operate.
SmartHome
Device
Time
Habits
User
Environment
Location
Restroom
kitchen
Bed_room
Living_room
value
temSensro
Resident
visitor
Habit
ComplexHabit
TimeAndEnvironment-related ON/OFF habit + TimeAndEnvironment-related ON/OFF habit
Time-related ON/OF F habit+Time-related ON/OF F habit
Time-related Adjust habit+Time-related Adjust habit
Time-related Adjust habit+ Environment-related ON/OF F habit
TimeAndEnvironment-related ON/OF F habit+ Environment-related ON/OF F habit
TimeAndEnvironment-related ON/OF F habit+ Environment-related Ajust habit
Time-related ON/OFF habit
Time-related Adjust habit
Environment-related ON/OFF habit
Environment-related Adjust habit
……
……
Figure 3.Smart home ontology model built by protégé
Table 1. Object properties in the OWL-based ontology for RHDL Object Properties Domain Range
Followed operate operate
hasOperation Device Operate
hasTime Operate Time
Belongto Habits User
hasLocation User,Device Location
hasDevice Habits Device
hasEnvironment Environment value
OperatedBy Device User
hasOperateTime Habits,Device Time
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
297
4. HABIT ANDCOMPLEXHABIT
The smart home which is designed in according to user's habits will get more humanized user experience. We could get user's habit of using electrical apparatus by analyzing the monitoring records, and we define the habit as follows:
Definition 1: Habit :: ( , ,{ , }, , , ) Habit Habit user device t e L op htype (1)
User stands for the owner of the habit; device stands for name of the electrical apparatus; op stands for the operation type, and ( , , )op on off adjust ; t stands for the time feature of habit, when the operations are on and
off, ( , , ) on off zonet t t t , ont is the on time of the device, offt is the off time of the device. zonet stands for the time
zone of the on or off, the on or off operation always happens in a time zone, for example the user is used to turn on the light between 8:00 and 8:15, hence, we set the timezone as 15 minutes. When the operation type is adjust,
( , ) adjust adjustzonet t t , adjustt is the adjust time of the device, adjustzonet stands for the time zone of the adjust. e stands
for the feature of the environment. The habit is always related to more than one environment, therefore
1 2{ , ,... }
nk k ke e e e , among them 1 2, ,...
nk k ke e e stands for nk environment features. we can calculate e as follows,
1 21 2 1 2.... , ... 1, 0 1 nk k n k n ne a e a e a e a a a a among them na stands for the weight of the
environment feature; L stands for the location of the habit; htype stands for the habit type, we divide the habit into 6 types according to time, environment and operation type, they are Time-related ON/OFF habit, Time-related Adjust habit, Environment-related ON/OFF habit, Environment-related Adjust habit, TimeAndEnvironment-related ON/OFF habit, TimeAndEnvironment-related Adjust habit. Take the Time-related ON/OFF habit for example, it stands for the habit which is related to time, and the operation is ON/OFF pair. In real life, the user may have a Time-related ON/OFF habit as that he is used to turning on light at 8:00 and turning off it at 12:00.
The habits may form a complex relationship on the basis of time, environment and operation features. We could name these habits as complex habit. Two habits may have an association of sequence, inclusion or parallel, etc. These association relationship of habits could be translated into the control rules in smart home. For example, the user A is used to turn on light at 8:00 and close it at 12:00, another user B is used to adjust the air-
condition to 26 ℃when the temperature is higher than 30 ℃, and the adjust operation always happens between 8:00 and 12:00. Thus, these two habits may form a complex habit, and the association relation of them is Inclusion. We could define the complex habit as follows:
Definition 2: ComplexHabit :: ([ 1, 2], , ) ComplxHabit HabitSet Habit Habit HSType HabitRelation (2)
Habit1, Habit2 are two habits in the ComplexHabit; HSType stands for the type of the ComplexHabit, we define 16 kinds of ComplexHabit as shown in Table. 2, HabitRelation stands for the relationship of the two habits. We define 7 kinds of basic association: Selection, Cross, Parallel, Sequence, Inclusion, Start, Finishes. As shown in Table. 2. Different type of Complexhabit may have the associations corresponding, for example, Two TimeAndEnvironment-related ON/OFF habits may have relationships of Selection, Cross, Parallel, Sequence, Inclusion, Start, Finishes.
Table 2.ComplexHabit and Association HSType Association
TimeAndEnvironment-related ON/OF F habit
+ TimeAndEnvironment-related ON/OF F habit
Selection, Cross, Parallel, Sequence,
Inclusion, Start, Finishes
TimeAndEnvironment-related Adjust habit
+TimeAndEnvironment-related Adjust habit
Selection, Cross, Sequence
Time-related ON/OF F habit +Time-related ON/OF F habit
Selection, Cross, Parallel, Sequence,
Inclusion, Start, Finishes
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
298
Time-related Adjust habit +Time-related Adjust habit
Selection, Cross, Sequence
Environment-related ON/OF F habit
+Environment-related ON/OF F habit
Selection, Cross, Parallel, Sequence,
Inclusion, Start, Finishes
Time-related ON/OF F habit + Time-related Adjust habit
Selection, Parallel Sequence,
Inclusion
Time-related ON/OF F habit + Environment-related ON/OF F
habit
Selection, Cross, Parallel, Sequence,
Inclusion, Start, Finishes
Time-related ON/OF F habit + Environment-related Adjust
habit
Selection, Parallel, Sequence,
Inclusion
Time-related Adjust habit + Environment-related ON/OF F
habit
Selection, Parallel, Sequence,
Inclusion TimeAndEnvironment-related
ON/OF F habit+ TimeAndEnvironment-related
Adjust habit
Selection, Parallel, Sequence,
Inclusion
TimeAndEnvironment-related ON/OF F habit + Time-related
ON/OF F habit
Selection, Cross, Parallel, Sequence,
Inclusion, Start, Finishes
TimeAndEnvironment-related ON/OF F habit
+ Time-related Adjust habit
Selection, Parallel, Sequence,
Inclusion TimeAndEnvironment-related
ON/OF F habit + Environment-related ON/OF F
habit
Selection, Cross, Parallel, Sequence, Inclusion, Start,
Finishes
TimeAndEnvironment-related ON/OF F habit
+ Environment-related Ajust habit
Selection, Parallel, Sequence,
Inclusion
4.1Habit Association
In this section, we will define the habit association explicitly. We have two habits and describe them as follows:
1 1 1 1 1 1 1 1 1
1 1 1 1
11 1 1 1
1 1 1
11 1 1
:: ( , ,{ , }, , , ),
( , , )/ ,
( , , )
( , ),
( , )
on off zone
on off zone
adjust adjustzone
adjust adjustzone
Habit Habit user dev t e L op htype
t t t tif op on off set
e e e e
t t tif op adjust set
e e e
(3)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
299
2 2 2 2 2 2 2 2 2
2 2 2 2
22 2 2 2
2 2 2
22 2 2
:: ( , ,{ , }, , , ),
( , , )/ ,
( , , )
( , ),
( , )
on off zone
on off zone
adjust adjustzone
adjust adjustzone
Habit Habit user dev t e L op htype
t t t tif op on off set
e e e e
t t tif op adjust set
e e e
(4)
Moreover, we define the time distance of t1, t2 as α:
1 2
2 21 2 1 2
1 2
1 2
21 2
, / ,
( ) ( ) .
, ,
( ) .
on on off off
adjust adjust
if op op are on off operations
t t t tt t
if op op are adjust operations
t t
(5)
The threshold of time distance is α, if 1 2 t t , then 1t is similar to 2t , and it can be expressed as
1 2t t . We define the environment distance as β:
1 2
2 21 2 1 2
1 2
1 2
21 2
, / ,
( ) ( ) .| |
, ,
( ) .
on on off off
adjust adjust
if op op are on off operations
e e e ee e
if op op are adjust operations
e e
(6)
The threshold of environment distance as μ, if 1 2| | e e , then 1e is similar to 2e , and it can be
expressed as 1 2e e .
Definition 3: Selection Association.In the same condition of time and environment, 1Habit and 2Habit only
happen one. They meet one of following three cases.
1 2
1 2
, /
Time - rea (1 lated Adjust habits ;)
,
Habit Habit areTime related ON OFF habits
C se or
t t
(7)
1 2
1 2
, /
a (2) ;
,
Habit Habit areEnvironment related ON OFF
C se habit or Environment related Adjusthabit
e e
(8)
Definition 4: Inclusion Association. In the same condition of time and environment, 2Habit happen in the
ON=OFF interval of 1Habit and they meet one of following three cases.
1
2
1 2 2 1 1 2 1
/ ,
/
a (1) Adjust ;
,
" tan" " "
on on off off on adjust off
Habit isTime related ON OFF habit
Habit isTime related ON OFF habit or
C se Time related habit
t t t t or t t t
s ds for antecedent to
(9)
1
2
1 2 2 1 1 2 1
/ ,
/
a (2) Adjust ;
,
" " tan " "
on on off off on adjust off
Habit is Environment relatedON OFF habit
Habit is Environment relatedON OFF habit
C se orEnvironment related habit
e e e e or e e e
s ds for antecedent to
(10)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
300
1
2
1 1 2 2
1 1 2 2 2
/ ,
/
;a (3)
( , ) ( , ) ,
( , ) ( , ) (
off off adjust adjust
on on on on o
Habit is TimeAndEnvironment related
ON OFFhabit Habit is
TimeAndEnvironment relatedON OFFhabit
or TimeAndEnvironment relatedAdjusthabitC se
t e t e
t e t e t 2 1 1
1 1 2 2 1 1
, ) ( , )
( , ) ( , ) ( , ) ,
" tan " "(2)"
ff off off off
on on adjust adjust off off
e t e
or t e t e t e
s ds for antecedent to
(11)
Definition 5: Sequence Association. In the same condition of time and environment, 1Habit always happens
ahead of 2Habit , and they meet one of following nine cases.
1 2
1 2
/ ;a (1)
, " " tan " "
off on
Habit and Habit areTime related ON OFF habitC se
t t s ds for antecedent to (12)
1 2
1 2
Adj ;a (2)
, " " tan "
s
"
u t
adjust adjust
Habit and Habit areTime related habitC se
t t s ds for antecedent to (13)
1 2
1 2
is
Time - related Adjust hab
/ ,
a (3) ;
," " "
t
tan "
i
off adjust
Habit isTime related ON OFF habit Habit
C se
t t s ds for antecedent to
(14)
1 2
1 1
is
Time - related Adjust habi
/ ,
a (4) ;
," " ta
t
n " "
off on
Habit is Time related ON OFF habit Habit
C se
e e s ds for antecedent to
(15)
1 2
1 2
Adjust habi, ;a (5)
," " tan " "
t
adjust adjust
Habit Habit are Environment relatedC se
e e s ds for antecedent to (16)
1
2
1 2
/
a (6) ;
, " " tan " "
off adjust
Habit is Environment related ON OFF habit
C se Habit is Environment related Adjust habit
e e s ds for antecedent to
(17)
1 2
1 1 2 2
,
/ ;
" "
a (7)( , ) ( , ) ,
tan " "
off off on on
Habit Habit areTimeAndEnvironment related
ON OFF habitC se
t e t e
s ds for antecedent to
(18)
1 2
1 1 2 2
" "
,
;a (8)
( , ) ( , ) ,
"tan "
adjust adjust adjust adjust
Habit Habit areTimeAndEnvironment related
Adjust habitC se
t e t e
s ds for antecedent to
(19)
1
2
1 1 2 2
/ ,
a (9) ;
( , ) (
" " " "
, ) ,
tan
off off adjust adjust
Habit isTimeAndEnvironment related
ON OFF habit Habit are
C se TimeAndEnvironment related Adjust habit
t e t e
s ds for antecedent to
(20)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
301
Definition 6: Cross Association. In the same condition of time and environment, The ON/OFF time of 1Habit
and 2Habit cross together, and they meet one of following three cases.
1 2
2 1 2
,
/ ;(1)
,
" " tan " "
on off off
Habit Habit areTime related
ON OFF habitsCase
t t t
s ds for antecedent to
(21)
1 2
2 1 2
,
/ ;(2)
" " tan " "
on off off
Habit Habit are Environment related
ON OFF habitsCase
e e e
s ds for antecedent to
(22)
1 2
2 2 1 1 2 2
,
/ ;(3)
( , ) ( , ) ( , )
" " tan " "
on on off off off off
Habit Habit areTimeAndEnvironment related
ON OFF habitsCase
t e t e t e
s ds for antecedent to
(23)
Definition 7:Parallel Association. In the same condition of time and environment, 1Habit and 2Habit go
together, and they meet one of following three cases.
1 2
1 2
, /
(1) Adjust ;
,
Habit Habit areTime relatedON OFFhabits
Case or Time related habits
t t
(24)
1 2
1 2
, /
(2) ;
,
Habit Habit areEnvironment relatedON OFFhabit
Case or Environment relatedAdjusthabit
e e
(25)
1 2
1 2 1 2
,
/(3)
;
, , ,
Habit Habit areTimeAndEnvironment related
ON OFFhabitor TimeAndEnvironmentCase
relatedAdjusthabit
t t e e
(26)
Definition 8:Start Association. The ON time of 1Habit and 2Habit is similar, but their OFF time is not similar,
and 1Habit and 2Habit meet one of following three cases.
1 2
1 2 1 2
, / ;
(1) , , ! ,
"! " " "
on on off off
Habit Habit areTime relatedON OFFhabit
Case t t t t
where delegate is not similar
(27)
1 2
1 2
1 2
, / ;
(2) ,
! ,
,
"! "
off off
Habit Habit are Environment related ON OFFhabit
Case e e
e e where delegate is not similar
(28)
1 2
1 2 1 2 1 2 1 2
,
/ ;(3)
, ! , ! ,
"! " " "
,
on on on on off off off off
Habit Habit areTimeAndEnvironment
relatedON OFFhabitCase
e e t t e e t t
where delegate is not similar
(29)
Definition 9:Finishes Association. The OFF time of 1Habit and 2Habit is similar, but their ON time is not
similar, and 1Habit , 2Habit meet one of following three cases.
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
302
1 2
1 2 1 2
, / ;
(1) ! ,
"! " "
,
"
off off on on
Habit Habit areTime relatedON OFFhabit
Case t t t t
where delegate is not similar
(30)
1 2
1 2 1 2
,
/ ;(2)
! ,
"! " " "
off off on on
Habit Habit are Environment related
ON OFFhabitCase
e e e e
where delegate is not similar
(31)
1 2
1 2 1 2 1 2 1 2
,
/ ;(3)
, ! , !
"! " " "
off off off off on on on on
Habit Habit are Environment related
ON OFFhabitCase
e e t t e e t t
where delegate is not similar
(32)
4.2 Habit Learning
The habit and complex habit could be obtained from the history context information. We define the context information as follow: Data(user, time, device, operation environment, Location) and use the clustering method to obtain the habit and complex habit. We choose the Fuzzy C-means as the clustering method, because it does not need to set the cluster number in advance, and it is fit for the scene changes(Vazquez and Kastner, 2011).
Ontology
Smart Home
STEP1
STEP2
STEP3STEP4
Classes
ObjectProperties
IndividualsData
properties
Habit/ComplexHabit
SWRL Generation Rule
SWRLJess Tab
OWL+SWRL->Jess
Jess->OWL
Reasoning
Facts
Jess RuleEngine
OWL Facts
Figure 4. RHDL reasoning
5. REASONING
We get the habit and complexhabit in the Section 4, and using them to reason. In this Section, we will introduce the RHDL reasoning process in detail. The RHDL Reasoning consists of SWRL rule generation, Ontology base and Reason as shown in Figure 1. We use the protege4.8 to create ontology model. Protege is a free, open-source platform that provides a growing user community with a suit of tools to construct domain models and knowledge-based applications with ontologies, it was developed by the Stanford Center for
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
303
Biomedical Informatics Research at the Stanford University School of Medicine. The protege provides the construction methods of classes, properties and individuals. We choose Java Expert System Shell(Jess) as the semantic reasoner for RHDL reasoning. The Jess provides both an interactive command line interface and a java-based API to its rule engine. This engine can be embedded in Java applications and provides a flexible two-way runtime communication between Jess and Java(Zhao and Liu, 2008) . SWRLJessTab and JessTab are successful implementations of Jess as extensions to protege. The RHDL reasoning process is shown in Figure 4. Firstly, there are four steps to create the ontology model in protege 4.8, such as Classes, Object Properties, Data properties and Individuals. Secondly, SWRL Generation Rule module translates the Habit/Complex Habit into SWRL rules. Thirdly, the SWRL rules are translated into the Jess rules in SWRL JessTab, and the Jess rule engine infers new results from the SWRLs, the reason results are translated into OWL by the JessTab and output the OWL Facts.
5.1 SWRL Generation Rule
The habit and Complex habit need to be translated into SWRL rules. The SWRL could make use of the vocabulary of an OWL ontology and provide some support to reason in a consistent way with the ontology. The
SWRL rules are written as antecedent-consequent pairs, i.e. 1 2 ... na a a b . In SWRL terminology, the
antecedent is referred to as the rule body and the consequent is referred to as the head. The head and body consist of a conjunction of one or more atoms.
In this section, we will define the SWRL generation rules of habit and complex habit. The generation rules can be classified into two categories: the habit generation rules and complex habit generation rules. The Properties have defined in Table. II and the habit, Habit1, Habit2 have defined in Section 4.
1) The generation rules of habit: � The SWRL generation rules of ON/OFF habit
:
( ) ( , ) ( )
( , ) ( , )
( )
:
( ) ( , )
( )
Body
user p hasLocation p L Device dev
hasLocation dev L hasOperation dev ON
EnvTimeCondition ON
Head
Device dev hasOperation dev OFF
EnvTimeCondition OFF
(33)
The SWRL generation rules Adjust habit
hasOperation(dev,
:
( ) ( ) ( )
adjust(a))
:
Body
user p Device dev EnvTimeCondition Adjust
Head (34)
2) The generation rules of Complex habit � The SWRL generation rules of Selection Association
1:
: ( )
( 1. ) 1.
: ( ) ( , )
( )
Swrl
Body user p EnvTimeCondition
Habit ON Habit ON
Head Device dev hasOperation dev OFF
EnvTimeCondition OFF
(35)
2 :
: 1. ( )
( 1. )
: ( 1. ,
2. )
Swrl
Body Habit OFF person p
EnvTimeCondition Habit OFF
Head NohappenInSameTime Habit OFF
Habit OFF
(36)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
304
3 :
: 2. ( )
( 2. )
: ( 1. ,
2. )
Swrl
Body Habit ON person p
EnvTimeCondition Habit ON
Head NohappenInSameTime Habit ON
Habit ON
(37)
4 :
: 2. ( )
( 2. )
: ( 1. ,
2. )
Swrl
Body Habit OFF person p
EnvTimeCondition Habit OFF
Head NohappenInSameTime Habit OFF
Habit OFF
(38)
5 :
: 1. ( 1)
: ( 1. , 2. )
Swrl
Body Habit Adjust EnvTimeCondition Habit
Head NohappenInSameTime Habit Ajust Habit Adjust
(39)
� The SWRL generation rules of Cross Association 1:
: 1. ( )
( 1. )
: ( 1. , 2. )
( ) ( 2. )
Swrl
Body Habit ON user p
EnvTimeCondition Habit ON
Head followed Habit ON Habit ON
user q EnvTimeCondition Habit ON
(40)
2 :
: 2.
( 2. )
: ( 2. , 1. )
( 1. )
Swrl
Body Habit ON EnvTimeCondition
Habit ON
Head followed Habit ON Habit OFF
EnvTimeCondition Habit OFF
(41)
3 :
: 1.
( 1. )
: ( 1. , 2. )
( 2. )
Swrl
Body Habit OFF EnvTimeCondition
Habit OFF
Head followed Habit OFF Habit OFF
EnvTimeCondition Habit OFF
(42)
� The SWRL generation rules of Parallel Association 1:
: 1. ( 1)
: ( 1, 2)
Swrl
Body Habit Adjust EnvTimeCondition Habit
Head happenTogether Habit Habit
(43)
2 :
: 1.
( 1. )
: ( 1. , 2. )
Swrl
Body Habit ON EnvTimeCondition
Habit ON
Head happenTogether Habit ON Habit ON
(44)
3 :
: 1.
( 1. )
: ( 1. , 2. )
Swrl
Body Habit OFF EnvTimeCondition
Habit OFF
Head happenTogether Habit OFF Habit OFF
(45)
� The SWRL generation rules of Inclusion Association
1:
: 1. ( 1. )
: ( 1. , 2)
( 2)
Swrl
Body Habit ON EnvTimeCondition Habit ON
Head Followed Habit ON Habit
EnvTimeCondition Habit
(46)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
305
2 :
: 2. ( 2)
: ( 2. , 1. )
( 1. )
Swrl
Body Habit Adjust EnvTimeCondition Habit
Head Followed Habit Ajust Habit OFF
EnvTimeCondition Habit OFF
(47)
3 :
: 1. ( 1. )
: ( 1. , 2. )
( 1. )
Swrl
Body Habit ON EnvTimeCondition Habit ON
Head Followed Habit ON Habit ON
EnvTimeCondition Habit ON
(48)
4 :
: 2. ( 2. )
: ( 2. , 1. )
( 1. )
Swrl
Body Habit OFF EnvTimeCondition Habit OFF
Head Followed Habit OFF Habit OFF
EnvTimeCondition Habit OFF
(49)
� The SWRL generation rules of Sequence Association 1:
: 1. ( 1. )
: ( 1. , 2. )
( 2. )
Swrl
Body Habit OFF EnvTimeCondition Habit OFF
Head Followed Habit OFF Habit ON
EnvTimeCondition Habit ON
(50)
2 :
: 1. ( 1)
: ( 1. , 2. )
( 2)
Swrl
Body Habit Adjust EnvTimeCondition Habit
Head Followed Habit Adjust Habit Adjust
EnvTimeCondition Habit
(51)
3 :
: 1. ( 1)
: ( 1. , 2. )
( 2)
Swrl
Body Habit Adjust EnvTimeCondition Habit
Head Followed Habit Adjust Habit Adjust
EnvTimeCondition Habit
(52)
4 :
: 1. ( 1. )
: ( 1. , 2. )
( 2)
Swrl
Body Habit OFF EnvTimeCondition Habit OFF
Head Followed Habit OFF Habit Adjust
EnvTimeCondition Habit
(53)
� The SWRL generation rules of Start Association 1:
: 1. ( 1. )
: ( 1. , 2. )
( 2. )
Swrl
Body Habit ON EnvTimeCondition Habit ON
Head InSameTime Habit ON Habit ON
EnvTimeCondition Habit ON
(54)
2 :
: 1. ( 1. )
: ( 1. , 2.
) ( 2. )
Swrl
Body Habit OFF EnvTimeCondition Habit OFF
Head NoInSameTime Habit OFF Habit
OFF EnvTimeCondition Habit OFF
(55)
� The SWRL generation rules of Finishes Association 1:
: 1. ( 1. )
: ( 1. , 2. )
( 2. )
Swrl
Body Habit OFF EnvTimeCondition Habit OFF
Head InSameTime Habit OFF Habit OFF
EnvTimeCondition Habit OFF
(56)
2 :
: 1. ( 1. )
: ( 1. , 2. )
( . )
Swrl
Body Habit ON EnvTimeCondition Habit ON
Head NoInSameTime Habit ON Habit ON
EnvTimeCondition Habit ON
(57)
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
306
5.2 Example of Rule Reasoning Figure 5 shows a reasoning example of habit. In this example, BOB has two habits, he turns on the light at
8:00, turns off it at 12:00, and when the temperature is higher than 30 ◦C, he adjusts the air-condition to 27 ◦C. These two habits consist a complex habit, the type is Time-related ON=OFF habit+Environment-related Adjust habit. According to the SWRL Generation Rule, BOB’s habit and complex habit are translated into SWRL rules as shown in Figure 5(A). The Jess engine executes the rules that are presented in in Figure 5 (B). Two inferred axioms are shown in Figure 5 (C) as hasOperation(light1;OFF) and hasTime(OFF; t2), they tell the smart home should turn off the light1 at the time of t2. The inferred facts are transferred to OWL model in Figure 5 (D).
Expression
User(BOB)^hasLocation(BOB,office)^Device(light1)^hasLocation(light1,office)^hasOperation(light1,ON)^hasTime(ON,t1)->hasOperation(light1,OFF)^hasTime(OFF,t2)
User(BOB)^hasLocation(BOB,office)^Device(aircon1)^hasLocation(aircon1,office)^hasEnvironment(temSensor_1,value30)->hasOperation(aircon1,ADJUST27)
User(BOB)^hasLocation(BOB,office)^Device(light1)^hasLocation(light1,office)^hasOperation(light1,ON)^hasTime(ON,t1)->Followed(ON,ADJUST27)
User(BOB)^hasLocation(BOB,office)^Device(light1)^hasLocation(aircon1,office)^hasEnvironment(temSensor_1,value30)^hasOperation(aircon1,ADJUST27)->Follow(ADJUST,OFF)
(A)
Successful execution of rule engineNumber of inferred axioms:2The process took 1 millisecond(s)Look at the “inferred Axioms”tab to see the inferred axioms.Press the “Jess->OWL”button to translate the asserted facts to OWL knowledge.
SWRLJessBridge Rules Classes Induviduals Axioms Inferred Axioms
Http://www.owl-ontologies.com/Ontology1435041135.owl#hasOperation(http://www.owl-ontologies.com/Ontoloy1435041135#light1.OFF)Http://www.owl-ontologies.com/Ontology1435041135.owl#hasTime(Http://www.owl-ontologies.com/Ontology1435041135.owl#OFF,t2)
SWRLJessBridge Rules Classes Induviduals Axioms Inferred Axioms
(B)
Successfully transferred inferred facts to OWL model.Number of axioms inferred:2The process took 0 millosecond(s).
SWRLJessBridge Rules Classes Induviduals Axioms Inferred Axioms
(C)
(D)
Figure 5. Example of rule reasoning for habit and complex habit
6.CONCLUSION AND FUTURE WORK
The paper puts forward a habit-based SWRL generation and reasoning approach in smart home, designs the smart home ontology model. We define the habit associations based on the features of time, environment, operation and give the SWRL generation rules for the habit associations. The RHDL reasoning is based on protege and Jess, the reasoning example of habit shows the reasoning process is effective. In future, we will learn more kinds of habits, and optimize the SWRL generation rules.
ACKNOWLEDGEMENTS
This work is partly supported by the National Natural Science Foundation of China under Grant 61370196, 61532012, 61672109.
REFERENCES Agrawal, R. (1993) “Mining association rules between sets of items in large databases”, ACM Sigmod Record,
22(2),pp.207-216. Aroyo, L. (2009)“The Semantic Web: Research and Applications”, Lecture Notes in Computer Science, pp.182-197. Bae, I. H. (2014)“An ontology-based approach to ADL recognition in smart homes”, Future Generation Computer
Systems, 33(2),pp.32-41. Das, S. K. (2002)“The role of prediction algorithms in the MavHome smart home architecture”, IEEE Wireless
Communications, 9(6), pp.77-84. Han, J., Pei, J., Yin Y. (2000) “Mining Frequent Patterns without Candidate Generation”, Sigmod Record, 29(2), pp.1-12.
Rev. Téc. Ing. Univ. Zulia. Vol. 39, Nº 10, 293 - 307, 2016
307
Han, J. (1970) “Mining frequent patterns without candidate generation”, ACM Sigmod Record, 29(2), pp.1-12. Horridge, M. (2004)A Practical Guide to Building OWL Ontologies Using the Protege 4 and CO-ODE Tools. Springer:
Berlin Heidelberg. Horrocks. (2004) SWRL: A Semantic Web Rule Language Combining OWL and RuleML. World Wide Web Consortium. Leelaprute, P. (2008)“Detecting Feature Interactions in Home Appliance Networks”, ACIS International Conference on
Software Engineering, Artificial Intelligence, Networking and Parallel/distributed Computing, pp.895-903. Leong, C. Y. (2009) “A rule-based framework for heterogeneous subsystems management in smart home environment”,
IEEE Transactions on Consumer Electronics, 55(3), pp.1208-1213. Madhavan, J. (2001) “Generic Schema Matching with Cupid”, VLDB Journal, pp.49-58. Maedche. (2002) “Ontology Learning for the Semantic Web”, Kluwer International, 16(2), pp.72-79. Mihailidis, A. (2004) “The use of computer vision in an intelligent environment to support aging-in-place, safety, and
independence in the home”,IEEE Transactions on Information Technology in Biomedicine, 8(8), pp.238-247. Nazerfard, E. (2010)“Discovering Temporal Features and Relations of Activity Patterns”, IEEE International
Conference on Data Mining Workshops, pp.1069-1075. Noy, N. F, D. L. Mcguiness (1995) A Guide to Creating Your First Ontology. Stanford University. Son, J. Y. (2011) “Resource-aware smart home management system by constructing resource relation graph”, IEEE
Transactions on Consumer Electronics, 57(3), pp.1112-1119. Vazquez, F. I, W. Kastner. (2011)“Clustering methods for occupancy prediction in smart home control”, IEEE
International Symposium on Industrial Electronics. Virone, G. (2002) “A system for automatic measurement of circadian activity deviations in telemedicine”, IEEE
transactions on bio-medical engineering, 49(12), pp.1463-1469. Wood, W. (2003) “Habits in everyday life: thought, emotion, and action”, Journal of Personality & Social Psychology,
83(6), pp.1281-1297. Xu, J. (2009)“Ontology-Based Smart Home Solution and Service Composition”, International Conference on Embedded
Software and Systems. Zhang, S. (2008)“Decision Support for Alzheimer's Patients in Smart Homes”, Proceedings of the IEEE Symposium on
Computer-Based Medical Systems. Zhao, W, J. K. Liu (2008) “OWL/SWRL representation methodology for EXPRESS-driven product information model :
Part II: Practice”, Computers in Industry, 59(6), pp.590-600.