# The Knowledge Representation and Semantic Reasoning Realization of Productivity Grade Based on Ontology and SWRL

Li Ma, Helong Yu, Yue Wang, Guifen Chen

► To cite this version:

Li Ma, Helong Yu, Yue Wang, Guifen Chen. The Knowledge Representation and Semantic Reasoning Realization of Productivity Grade Based on Ontology and SWRL. 5th Computer and Computing Technologies in Agriculture (CCTA), Oct 2011, Beijing, China. pp.381-389, 10.1007/978-3-642-27281-3_44. hal-01351836

HAL Id: hal-01351836

https://inria.hal.science/hal-01351836

Submitted on 4 Aug 2016

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
The Knowledge Representation and Semantic
Reasoning Realization of Productivity Grade Based on
Ontology and SWRL

Li Ma, Helong Yu, Yue Wang, Guifen Chen*

College of Information and Technology Science, Jilin Agricultural University, Changchun, Jilin, China

mary19801976@sohu.com

**Abstract:** Semantic not consistency, and knowledge base is difficult to reuse and sharing are the key problems affecting the system development and application. This paper studies how to express the soil fertility level information using of the ontology and generate OWL (Ontology Web Language) document, and how to make use of SWRL (Semantic Web Rule Language) to express inference rules. On this basis, this paper integrates SWRL rules editor and JESS (java expert shell system) rules engine, establishes the reasoning framework based on JESS reasoning engine, and realizes the productivity grade evaluation based on ontology and SWRL.

**Keywords:** productivity grade; ontology; SWRL; reasoning; JESS

# 1 Introduction

Knowledge and the rules are descriptions of traditional method mostly in productivity grade evaluation. Due to lack of unity Semantic description of knowledge resources, the user is difficult to find the related knowledge and hard to realize the related resources of semantic fusion [1]. In addition, how to realize the knowledge reuse and sharing is also met in the knowledge engineering development. These questions also make expert system of intelligent reasoning problems have been not effectively solved. The ontology and semantic reasoning and other technologies research provides a complete concept of the definition and concept organization relationship, It not only support underlying data content queries, but also reflect a declarative
description of the correlation between data through to the semantic information, and
can realize the intelligent reasoning knowledge in semantic level [2].

The paper constructs soil productivity grade ontology, integrates rules editor based on SWRL [3] and JESS rules engine [4], through the JESS rules into manipulate OWL knowledge base, develops the semantic rules system to realize soil productivity grade intelligence assessment based on semantic.

## 2 Construct the Soil Productivity Grade Ontology

This paper used protégé tools, building the soil productivity grade ontology. Protégé is an open source ontology editor tool developing by Stanford Medical Informatics [5]. The basic Modeling primitives of ontology include classes, relations, functions, axioms, and instances, a total of five [6]. The realization in Protégé is shown in table 1.

<table><caption>**Table 1.** Protégé of modeling primitives in implementation</caption><thead><tr><td>Basic Modeling primitives</td><td>The elements of Protégé</td></tr></thead><tbody><tr><td>Classes or Concepts</td><td>Through the type, natural language definition, attribute and other aspects as description</td></tr><tr><td>Relations</td><td>Relationships between classes</td></tr><tr><td>Functions</td><td>Reasoning rules</td></tr><tr><td>Axioms</td><td>A special kind of reasoning</td></tr><tr><td>Instances</td><td>instances of a class</td></tr></tbody></table>

### 2.1 Data sources

The data this paper used is from the cultivated land fertility survey data, the NongAnXian(2006), offers by agricultural technology extension center of NongAnXian. The data includes 25 attributes, such as soil humidity, groundwater depth, light radiation intensity, soil irrigation capacity, annual rainfall, soil drought resistance and soil erosion degree, soil texture, crop rotation suitability, topography, soil parent material, part into layer thickness, salt concentration, humus soil pH value, effective copper, iron, effective slowly available k, effective k, effective fierce, total
nitrogen, phosphorus, organic matter and cationic content, effective zinc and productivity grade. Part of the data is as shown in table 2.

<table><caption>**Table 2.** Some fertility data</caption><thead><tr><th>ground water depth</th><th>soil irrigation capacity</th><th>annual rainfall</th><th>soil drought resistance</th><th>soil texture</th><th>soil parent material</th><th>part into layer thickness</th><th>salt concentration</th><th>pH value</th><th>effective copper</th><th>effective iron</th></tr></thead><tbody><tr><td>3-5m</td><td>no</td><td>400-450mm</td><td>strong</td><td>Light clay</td><td>alluvial</td><td>10-20cm</td><td>&lt;0.1</td><td>6.6</td><td>1.25</td><td>8.72</td></tr><tr><td>&lt;3m</td><td>strong</td><td>400-450mm</td><td>strong</td><td>Light clay</td><td>alluvial</td><td>10-20cm</td><td>&gt;0.1</td><td>6.7</td><td>1.26</td><td>8.47</td></tr><tr><td>3-5m</td><td>strong</td><td>&gt;450mm</td><td>strong</td><td>loam</td><td>alluvial</td><td>10-20cm</td><td>&lt;0.1</td><td>6.7</td><td>1.39</td><td>4.70</td></tr><tr><td>3-5m</td><td>strong</td><td>400-450mm</td><td>strong</td><td>sandy loam</td><td>alluvial</td><td>10-20cm</td><td>&lt;0.1</td><td>6.5</td><td>1.21</td><td>9.45</td></tr><tr><td>&lt;3m</td><td>strong</td><td>400-450mm</td><td>strong</td><td>sandy loam</td><td>alluvial</td><td>10-20cm</td><td>&lt;0.1</td><td>6.7</td><td>1.27</td><td>9.71</td></tr><tr><td>5-8m</td><td>no</td><td>400-450mm</td><td>weak</td><td>sandy loam</td><td>loess</td><td>0-10cm</td><td>&lt;0.1</td><td>6.6</td><td>1.20</td><td>8.30</td></tr><tr><td>3-5m</td><td>no</td><td>400-450mm</td><td>weak</td><td>sandy loam</td><td>diluvial</td><td>20-30cm</td><td>&lt;0.1</td><td>6.6</td><td>1.30</td><td>8.50</td></tr><tr><td>&lt;3m</td><td>strong</td><td>400-450mm</td><td>strong</td><td>sandy loam</td><td>alluvial</td><td>10-20cm</td><td>&gt;0.1</td><td>6.7</td><td>1.28</td><td>8.48</td></tr><tr><td>&lt;3m</td><td>strong</td><td>400-450mm</td><td>strong</td><td>sandy loam</td><td>alluvial</td><td>10-20cm</td><td>&gt;0.1</td><td>6.7</td><td>1.30</td><td>0.10</td></tr><tr><td>3-5m</td><td>no</td><td>400-450mm</td><td>strong</td><td>sandy loam</td><td>alluvial</td><td>10-20cm</td><td>&lt;0.1</td><td>6.6</td><td>1.27</td><td>8.28</td></tr></tbody></table>

The parts of the reasoning rules are:

Rule1: if effective phosphorus <=21.8 and Salt content =2 and topography =21 effective phosphorus >16.8 and cationic content >21.15 and (soil parent material =2 or soil parent material =3 or soil parent material =5) then productivity grade =4;

Rule2: if effective phosphorus <=21.8 and Salt content =2 and topography =21 effective phosphorus >16.8 and cationic content >21.15 and soil parent material =1 and pH >7.4 then productivity grade =4;

Rule3: if effective phosphorus <=21.8 and Salt content =2 and topography =21 effective phosphorus >16.8 and cationic content >21.15 and soil parent material =1 and pH <=7.4 and effective iron <=8.15 then productivity grade =3;

## 2.2 Construct the Ontology

The steps of ontology construction used protégé are:

(1) Collect all kinds of fields term, concept, and determine the relationship between the concepts.

(2) Start protégé, choose engineering format.

(3) Select OWL Classes Tab, add various concepts and child concept.
(4) Select Properties Tab, add various characteristics and child characteristics.

(5) Select Individual Tab, add the Individuals.

(6) Again and again modification, complete ontology editor.

The specific Constructing process:

Define classes and class rating system: establish the profile and physical and chemical properties class named physical, including attributes of pH value, soil moisture, salt concentration, humus layer thickness, soil texture, cationic content and groundwater depth. Establish the class site conditions named site, including attribute of site topography, soil erosion degree and parts into soil organic. establish meteorological conditions class named weather, contain rainfall and light radiation intensity. Establish the nutrient content named nutrient, contain effective iron, slowly available k, effective k, total nitrogen, phosphorus, effective organic matter. Establish the soil management class named management, including attributes soil drought resistance, irrigation and crop rotation suitability. Set up class soil named soil, soil is as the father all kinds. Establish class named class, including productivity grade attribute.

Define a relationship class_is, used to determine a specific example belonging to which productivity grade, its domain of definition is soil, its range is the class.

The exact make up of soil ontology is:

Class soilclass {

Class physical (ph, moisture, salinity, humus, textrue, cation, groundwater)

Class site (position, erosion, material)

Class weather (rainfall, light)

Class nutrient (fe, slow k, k, n, p, om)

Class management (irrigation, drought, crop)

}

Class class (attribute is soil_class)

Class relations attribute: class_is

The domain of definition of these attributes is soil, these attributes including pH, fe, slow k, k, n, p, om, cation, and the range is int. The domain of definition of these attributes those including moisture, groundwater, light, irrigation, rainfall, drought, erosion, textrue, crop, position, material, humus, salinity, is soil, and the range is float. The domain of definition of soil_class is class, and the range is int.
Ontology construction results are as shown in figure 1.

<figure><img src="image_2.png" /><figcaption>Fig.1. Ontology building results</figcaption></figure>

The part of the OWL document of this ontology is as follows:

```xml
xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
xmlns:swrla="http://swrl.stanford.edu/ontologies/3.3/swrla.owl#"
xmlns="http://www.owl-ontologies.com/Ontology1270600106.owl#"
xmlns:swrl="http://www.w3.org/2003/11/swrl#"
xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:sqwrl="http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#"
```

# 3 Produce SWRL Reasoning Rules

## 3.1 SWRL Reasoning Rules

Although ontology support inference, but it does not provide the reasoning rules, its ability is very limited, it will not be able to express these rules such as "If... Then...". It needs to add user defined rules of OWL ontology. SWRL (Semantic Web sex) is established to solve this problem [7].
SWRL is a language that shows rules in the semantic way. It is a rules description language based on OWL DL Language, OWL Lite and Unary/Binary Datalog RuleML, its purpose is to make the first-order predicate logic horn-like rules(don't allow function to appear in Horn clauses) combining with OWL knowledge base.

A rule of SWRL is implies, and is made of the premise and conclusion. When the premise is tenable, the conclusion is tenable. The form is:

rule ::= Implies(antecedent, consequent).

SWRL in a class instance situation, storage rules, is comprised of the Imp, Atom, Variable and built-in total four parts. Every rule is divided into conclusion part (head part) and condition part (body part) total two compositions.

In the framework of SWRL, constraints of conditional judgment is built on Atom, rules are established in imp. The head and body are contained in Imp, and the source of the constraints of the both is provided by the Atom, these constraints can be used again by different rules.

## 3.2 Produce SWRL Rules

This article will use the two constraints in productivity grade evaluation rules:

C (x): C is OWL description

P (x, y): P is the OWL attribute, in which x, y can is variable, OWL individuals or OWL data value [8].

Table 3 is the atom list of SWRL rules:

<table><caption>Table 3. SWRL rules atom table</caption><thead><tr><td>Atom</td><td>description</td></tr></thead><tbody><tr><td>soilclass(?x)</td><td>Y is a soil examples</td></tr><tr><td>greaterThan(x, y)</td><td>x is more than y</td></tr><tr><td>class_is(?x, y)</td><td>The grade of Examples x is y</td></tr><tr><td>lessThanOrEqual(x, y)</td><td>X is not more than y</td></tr></tbody></table>

According to the decision rules, building Imp using the Atom defined, parts of the SWRL rules setting up as follows:

soilclassrule1:

soilclass(?x) \ swrlb:greaterThan(p,21.8) \ swrlb:greaterThan(salinity,1) \ swrlb:g
greaterThan(rainfall,5) \ swrlb:greaterThan(position,21) → class_is(?x class2)
soilclassrule2:

soilclass(?x) ∧ swrlb:greaterThan(p,21.8) ∧ swrlb:greaterThan(salinity,1) ∧ swrlb:greaterThan(rainfall,5) ∧ swrlb:lessThanOrEqual(position,21) → class_is(?x class3)

With SWRL describe rules, the realization in ontology are shown in figure 2:

<figure><img src="image_3.png" /><figcaption>Fig.2. SWRL described in protege</figcaption></figure>

4 The Reasoning Based on JESS Inference Engine

When in ontology reasoning, can maps to JESS (Java expert shells system) reasoning
inference engine. JESS is CLISP inference engine based on the Java language, its
advantages are: inference engine is open, can undertake in different areas of reasoning
work when users provide different rules system, it can also expand the reasoning
ability of the inference engine.

Its working process is as shown in figure 3.

<figure><img src="image_4.png" /><figcaption>Fig.3. Ontology-based knowledge JESS reasoning</figcaption></figure>
Converting SWRL rules into JESS rules, parts of the conversion of the rules are shown as follows:

Rule soilclassrule :

IF"x" IS A soilclass

AND IF "position" IS LESS THAN OR EQUAL TO 31

AND IF "rainfall" IS LESS THAN OR EQUAL TO 5

AND IF "p" IS GREATER THAN 21.8

AND IF "salinity" IS GREATER THAN 1

AND IF "light" IS LESS THAN OR EQUAL TO 4

THEN "x" class is "class3"

Converting results is shown in figure 4:

<figure><img src="image_5.png" /><figcaption>Fig.4. Converting results</figcaption></figure>

By JESS ontology to the rules of the conversion, JESS rules convert into ontology, and stored in the ontology. When inquiry by ontology reasoning, it can get productivity grade. The rules storage in ontology is shown as below:

<swrl:Imp rdf:about="soilcalssrule5">

<swrl:body>

<swrl:AtomList>

<rdf:first>

<swrl:ClassAtom>

<swrl:argument1 rdf:resource="#x"/>

<swrl:classPredicate rdf:resource="#soilclass"/>

</swrl:ClassAtom>

</rdf:first>

<rdf:rest>

<swrl:AtomList>
<rdf:first>
<swrl:BuiltinAtom>
<swrl:arguments>
<rdf:List>
<rdf:first rdf:resource="#p"/>
<rdf:rest>
<rdf:List>
<rdf:rest
</rdf:List>

5 Realize the Productivity Grade Evaluation System

System is designed by Java language. Protégé is use to edit ontology, SWRL is used
to edit ontology rules, and deposit to ontology, the treat decision data uses JESS
reasoning to get productivity grade. The system includes data layer, model layer and
reasoning layer, total three layers, and the overall framework as shown in figure 5:

<figure><img src="image_6.png" /><figcaption>**Fig.5.** Overall system framework</figcaption></figure>
User input awaiting decision making data through the user interface of the system, the system calls inference engine to do the decision, and then get the productivity grade.

## 6 Conclusion

This paper uses protégé 3.4 the ontology development environment to create the ontology classes, properties, and individuals, in SWRL Tab environment edit SWRL reasoning rules, based on this, establishes the reasoning frame system on the basis of JESS inference engine. This paper realizes knowledge base reasoning component by the OWL and SWRL, and provides rule-based reasoning mechanism for semantic Web. The reasoning method based on ontology and SWRL is a supplement for reasoning, and provides a new way for intelligent reasoning.

**Acknowledgments.** Funding for this research was provided by youth fund of Jilin agricultural university (NO.201133) and the development of science and technology plan projects of Jilin province (NO. 201101114), the national science and technology support projects(NO. 2009BADA5B03), the spark plan project (NO. 2008GA66100 3)

## References

1. Zhu Lijun, Tao Lan, Huang Chi. Semantic Web: Concept, Approach and Application[J]. Computer Engineering and Applications, 2004, (03)

2. Liu Chunchen. The Research of Corn Disease and Pest Prevention and Cure Semantic Searching System Based on Ontology[D].JiLin University,2007.

3. CIM Engineering, Inc. ProtegeWiki: SWRLTab[EB/OL]. (2009-03-05) [2009-06-21]. http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTab.

4. Sandia National Laboratories. JESS, the Rule Engine for the Java Platform[EB/OL]. (2008-11-11) [2009-07-12]. http://Herzberg.ca.sandia.govJESS.

5. Guo Jiaqi. Domain ontology construction and its application in information retrieval[D]. Beijing University of post and telecommunications, 2007.
6 LI Jing, SU Xiao-lu, QIAN Ping. The methodology of developing domain ontology[J]. Computer and Agriculture, 2003, 7: 7-10

7 Dai Weimin. The semantic web information organization technology and method [M]. Shanghai: Harvard University press, 2008:238-254.

8 JI Zhao-hui, LI Cun-hua. Constructing and Strategy Analyzing of Rule System for the Semantic Web Based on SWRL and Jess [J]. Journal of Huaihai Institute of Technology (Natural Sciences Edition), 2009, (04):26-29