# Ontology-Based Representation and Reasoning in Building Construction Cost Estimation in China
## 4 Implementation of the Building Construction Cost Estimation Ontology
### The Transformation System Framework of Cost Estimation  
SWRL is a descriptive language that is independent of other rule languages and is encoded by XML grammar, which can be embedded in Protege. The Jess rule engine is used in the integrated framework, and SWRLJessTab and JessTab have been successfully implemented as Jess extension transformers in Protege. Transformer plugins can be used to transform the fact (OWL) and rule (SWRL rules) knowledge into the fact base and rule base encoded by Jess, and the transformed cost estimation model is implemented by the Jess inference engine. The transformation between them is summarized in Table 3.  
The transformed detail is described as follows:  
The classes of ontology knowledge base represented by OWL are transformed into Jess templates that are used to describe classes and subclasses. For instance, the cost estimation class and its subclasses are built and transformed into the following Jess templates: \"_owl: Thing_\" is the top class, and others are subclasses that are directly and indirectly derived from it:  
(deftemplate owl:Thing(slot name))(deftemplate Cost_Estimation extends owl:Thing)(deftemplate Concept_Model extends Cost_Estimation)(deftemplate Building_Product extends Concept_Model)(deftemplate Beam extends Building_Product)  
The instances of classes in the cost estimation model can be transformed into the Jess fact through transformers. For instance, as the instances of the class \"_beam_\", \"_Rectangular_Beam_\" fact can be transformed into the Jess fact:  
(assert(owl:thing(name Rectangular_Beam))) (assert(Cost_Estimation(name Rectangular_Beam ))) (assert(Concept_Model (name Rectangular_Beam))) (assert(Building_Product (name Rectangular_Beam))) (assert(Beam(name Rectangular_Beam)))  
\begin{table}
\begin{tabular}{c c} \hline \hline
**OWL/SWRL** & **Jess** \\ \hline Class, property, individual & Facts \\ RDF, OWL, SWRL semantics & Rules \\ \hline \hline \end{tabular}
\end{table}
Table 3: The transformation between OWL and Jess.  
Figure 10: Flowchart of cost estimation reasoning.  
Relationships between individuals or between an individual and a data value represent an object property or data type property and need to be transformed into the fact-based return of the Jess knowledge base. For instance, the instance \"_Rectangular_Beam_\" has the object property \"_hasMaterialFeature_\" with the instance \"_Cast-in-Place_Concrete_\" of the class of \"_MaterialFeature_\", and it needs to be transformed into a Jess fact:  
_(assert(havingMaterialFeature Rectangular_Beam_of_Cast-in-Place_Concrete)_  
For the data type property, the transforming method between OWL and Jess is summarized in Table 4.  
By using the SWRL2 Jess transformer, the rules defined by SWRL are transformed into Jess rules in the rule base. For instance, the above-defined rule is transformed into a rule in the Jess rule base, as shown below.  
_(defrule Rule(Building_Product(name?x))(Material_Feature(name?y))(havingMaterialFeature?x?y)(Building_Material(name?z))(consistsOf?y?z)=> (includesBuildingMaterial?x?z))_