## 4 Construction of the BIontology
### Automatic Mapping Process of the Blontology Construction  
In general, a bridge inspection module is a basic part of a BMS, and bridge inspection information is usually stored in a relational database (RDB). Mapping technology provides an effective and feasible method to extract ontology from RDB [37; 38; 39]. For example, Figure 3 shows two typical RDB tables used for storing some information related to bridge components and elements. Some major components of the RDB tables in Figure 3 are highlighted with some different colored dotted boxes. The foreign key constraint \"FK_BridgeElement_BridgeComponent\" is used to establish the relationship between the two tables. During an automatic mapping process, OWL is chosen as the ontology language. Mapping RDB to ontology means that the RDB components need to be transformed into corresponding OWL ontology components, which cannot be implemented without mapping rules. The typical mapping rules are listed in Table 3. These rules are independent of data stored in relational tables. In addition, any data (e.g., more spatial relationships or elements) stored in relational tables can be mapped to the Blontology based on these rules. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Problem Type** & **Question** & **Answer** \\ \hline Basic question & What is the purpose of using the Blontology? & The aim is to improve the capacity of inspection-relevant information retrieval in a BMS. \\ What is the domain that the Blontology will cover? & The domain is bridge maintenance, especially bridge inspection. \\ Who will use the Blontology? & The main users are bridge inspectors. \\ Competency question & Which element is on the east of the first wet joint? & The first slab. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Typical examples of basic questions and competency questions. In practice, the subsequent steps, the mapping process, were implemented by a Python program. Figure 4 presents the mapping process from RDB to OWL ontology. PyMySQL was used to retrieve data from the bridge inspection database (e.g., MySQL). Then, RDFLib was used to transform the bridge inspection data into OWL ontology based on the mapping rules in the Python program. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Rule** & **RDB Component** & **Ontology Component** & **Example** \\ \hline Rule 1 & Table name & Class name & Table name “BridgeElement” will be mapped into the class “BridgeElement”. \\ \hline Rule 2 & Relationship & Object property of the class & Relationship “FK\_BridgeElement\_BridgeComponent” will be transformed into object property “isElementOf”, whose domain and range are the class “BridgeElement” and “BridgeComponent”, respectively. \\ \hline Rule 3 & Field name & Datatype property of the class & Field name “ChineseName” and “Weight” will be converted into datatype property “ChineseName” and “Weight” of the class “BridgeComponent”. \\ \hline Rule 4 & Datatype & Facet of the slot & Datatype “varchar” and “double” will be expressed in “ssd:string” and “ssd:double”. \\ \hline Rule 5 & Record & Instance & Bridge element name “1\&slab” (i.e., the first slab) will be translated to an instance of the class “BridgeElement”. \\ \hline \end{tabular}
\end{table} 
Table 3: Typical mapping rules for mapping RDB to ontology. Figure 3: The relational database tables related to bridge inspection (partial view). 1 “Weight” denotes the weightiness of a bridge component in the process of evaluation of bridge condition, according to the standards for Technical Condition Evaluation of Highway Bridges in China. After implementing the mapping process, some ontology components relevant to bridge element had been added to the Blontology. Due to the lack of the spatial relationships among bridge elements in the relational database, the spatial relationships were also manually added to the Blontology in Protege after finishing the automatic mapping process. As a result, the Blontology includes 4 concepts, 9 relations and 18 restrictions.