A Study of the Production Rules for Context Inference of Wetland Water Quality on Ubiquitous Sensor Network Middleware Framework

: Problem statement: With gradually increasing movement to live together with nature, artificial wetlands are increasing as well. And the wind of change blows at the rivers and streams, thereby increasing the need for management systems. Conclusion/Recommendations: Accordingly, this study aims to design production rules for wetland environment context inference and establish application system by using JESS and the rule-based system based on facts collected from sensor networks in the wetland environment USN middleware.


INTRODUCTION
Wetland is a wet ground surrounded by rivers, ponds and swamps and also a reserve of natural resources where water always remains under natural environment and lasts long Kwater Environmental Kit Natlonal Institute of Environmental Research Environmental Kit 1990.
Thus, ongoing maintenance is required to better manage important wetlands. The wetland needs to be constantly checked in its nature. But for this, there is no choice but to go out in the field in person and measure and record factors with use of measurement tools. However, with the use of these methods only, it is difficult to know exactly the situation that wetlands change every time and, the time to prepare may be insufficient. And there is a problem since the accuracy of the data may be unreliable as a few measurement conducts in a year not in a day.
Accordingly this study aims to prepare for this through application of context inference techniques of Ubiquitous Sensor Network (USN) Middleware based on USN techniques and production rules for wetland control system design. The produced rules in this study can predict current status of wetland and identify dangerous situations through methods to recognize situations and infer based on specific facts measured by sensors.
This study is organized to explain JESS, underlying knowledge of context inference and rulebased language then produces rules for context inference engine design available to predict wetland water quality based on this, in the end comes a conclusion with future research directions presented.

Related works:
Context-Inference: Context-inference is an inference of new facts from already-known facts and knowledge. Context inference method is largely divided into two things: Rule-based reasoning and Case-based reasoning. Rule-based reasoning is a method that operates equipment as long as condition of a sensor is met regardless of place and user. Contrary to this, Casebased reasoning is a method to infer based on the previous cases. Compared to rule-based reasoning, it is easy to learn and convenient to adapt to exceptional rules. Generally rule-based inference is applied in an expert system.
Rules make it possible to infer another fact based on facts, the collected data from a sensor. Figure 1 indicates a representation method of rules. One condition or more come into Left Hand Side (LHS) and Action is followed on Reft Hand Side (RHS), when the conditions are met.
Such rules should be set to take a specific action when datum that a sensor collects meets a certain condition or rule that a user has made. Or it can be predicted that a certain situation can happen. This is called as rule-based context-inference (Doorenbos, 1995). For example, it is to perform the specified information when a factor based on water quality data collected from a sensor has a specific data value. USN-based environment: USN means an advanced intelligent community infrastructure which stores, processes and integrates things and environment information from tags and sensor nodes attached anywhere and can freely use personalized service anytime, anywhere and anyone through context awareness information and knowledge contents production E-Learning Systems 1995. Figure 2 represents USN structure ETRI 2004. Sensor Network includes various sensors which can gather information for a specific environment, derive meaningful information based on such collected information and act like an middleware to lead a role in running appropriate services for users and finally, obtain information from middleware and interact directly with users (service application). Middleware performs comprehensively: (a) efficiently integrate and control heterogeneous computing resources distributed in Ubiquitous environment; (b) supports integrity; (c) infers the meaning of the various information collected from fundamental roles such as information protection and security functions (Youn and Cho, 2010).  Jess system: Jess is an abbreviation of Java Expert System Shell and it is a rule-based expert system with features of Java language (Fig. 3). Jess is a language which has rule-based system concept similar to LISP but, it is easy to define rules and codes and it has a powerful Java API support environment such as networking through integration with Java, graphics, database connection Jess, the Rule Engine for the Java Platform (Friedman-Hill, 1998;Lim, 2008).

Configuration of context inference system:
The main purpose is rule design for context inference engine which allows us to figure out current status of water quality by using JESS language based on rule-based inference method based on collected data from a sensor.
Water sensor features: Table 1 represents types and functions of sensors necessary to determine the status of river water quality DreamTest, Kinds of sensors. There are five indicators to determine water quality level. PH is not considered for rule design as it shows constant values within 6.5~8.5 in any water quality. And the other required indicators are BOD, SS, DO, MPN. However, MPN is a measure of E. coli bacteria in water and it is difficult to measure it with a sensor and here context inference rules have been designed by considering three facts (BOD, DO, SS). Interface manager: As a component which provides a standardized interface for USN sensor networks, each sensor network is a module which complies with common message specifications for sensor data acquisition, monitoring and control function in the internetworking to sensor network common interface.
Step2 Incomplete Data Processing Mechanism (IDPM) module: It is a module which analyzes patterns that appear when an amount of power is insufficient and the patterns of incomplete data resulting from increasing distance of communication distance, determines the relationship between attributes of sensors and discovers and treats imperfections.
Metadata manager: It combines packets transmitted from a sensor network with use of metadata and changes it into completed information and reduces frequent access to database with an application of a specific technique, Metadata Set.
Rule manager: It receives environmental information of a sensor network done by Stream Data Processor and matches database to the stored inference rule. Resultingly, if necessary, it is re-loaded on WM to go through matching tasks and it comes to perform a particular action depending on reasoning results.

Application interface:
This application interface controls sensor network and provides an appropriate interface with application interface so that it can be monitored.
Context inference module and operating procedure: Figure 5 depicts operating procedure of inference module. At first a certain event occurs at a network and data values from a sensor come in (Input Data). Such raw data values are stored in Working Memory (WM) set. Users' predefined set of rules are stored in the Data Base. Through comparison process between the sensed values stored in WM and such rules, facts-level value is determined. And then such facts-level values are loaded into WM and are going through matching process with the rules that finally determine water quality.
Such process performance is a Pattern Matcher of Inference Engine. Pattern Matcher goes through the process of comparison between facts values stored in WM and rules stored in Database and stores the matched values into Conflict Set. The Conflict Set calculates reliability depending on the oder of priority of such matching values and sends matching results that are considered to be the most accurate to execution engine and performs a certain action correspondingly at Service Module.
Production rule designs: Rules are designed by using rule-based language, JESS. Figure 6 shows collectible facts from the wetlands environmental sensor networks. Indicators are four kinds of quality management standards. Facts represented as [facts]-level are necessary to design rules to determine the final water quality. Based on water quality management standard, BOD has five standard points and it is divided into five stages; SS into two stages; DO into three stages. The facts defined by a function of deftemplate are independent of order if a name is changed by using slot. As the facts that we use here are regardless of order, they are defined in this way. Figure 7 designs a rule based on the water quality criteria depending on BOD. When a rule should be defined in Jess, a function of Defrules is used for its definition.
BOD has five standard points in the evaluation criteria, rules are made to define 5 steps of level. The rules consist of two parts: 'if' part on the left (LHS) and 'then' part on the right (RHS) with "=>" symbol in the center. To explain as an example of BOD1, when the numeric values coming from a sensor is 1 (mg L −1 ) or less, it is a method to add fact of BOD-level 1 to WM. Similarly, the SS and the DO has been designed by applying the same approach (Fig. 8). Figure 9 is a final rule created by combining BOD, SS, DO level facts. Five rules exist as a rule to determine rules and wetland water quality can be expected. The water quality can be determined from grade 1 to grade 5. Figure 9 shows that water quality is set as grade 1 when BOD-level is 1, ss-level is less than 2 and DO-level is less than 2.

CONCLUSION
In order to determine the exact water quality of wetlands, streams and rivers a in the past, there was no option but to regularly go out to the field and take a measurement, compare and determine in person.
So this study applies ubiquitous concepts into wetland environment, collects data on the wetland environment from water sensor networks and based on these, context inference rules was designed to predict the water quality of rivers. This makes it possible to predict the water quality of wetlands without someone's hands. Based on design approaches of inference rules of wetland water quality conditions engineered in this study and further, other rules designed for diverse and complex situations that might occur in the wetlands are possible. In addition, these rules are applied in context inference engine design and makes context inference engine design for wetlands environment as a final destination. On implementation of context inference engine, it makes users obtain accurate inference results.