## 4 Semantic Management Component
### Import Ontology Service  
Another core service allows us to import RDF ontologies to the semantic management component. One of the main purposes of the semantic management component is to provide an extensible environment for ontology development, improvement, and evolution. The basic principles of ontology development can be summarized as follows [49]:  
* reusability, when the concepts introduced in existing reliable ontologies can be reused;
* semantic alignment, referring mainly to ontology interoperability, to integrate concepts from imported ontologies, as well as newly created concepts into an existing structure;
* ontology design pattern usage, to ensure that the concept generation procedure can be applied not only to a single concept but to a group of concepts; and
* community extensibility, assuming a collaborative perspective when one ontology, covering few use-cases, can be extended by other users of a community and, thus, be applied to more use-cases. The process of importing ontologies should correlate with these ontology development principles. Thus, in the present work, the concepts imported within an ontology are reusable, integrated in the existing structure, and extended using other services delivered within the semantic management component. To introduce the process of ontology import, some definitions from the graph theory are adopted. For the ontology or data model, which is already inside the graph DB, the term \"initial\" is used, and for ontology loaded from outside, the term \"imported\" is used. Both initial and imported ontologies are represented as a graph with \(E\) edges and \(V\) vertices, \(G=(V,E)\). If the database is not empty, the process of importing an ontology can be described through the logical disjunction or union. Let us assume that the database is not empty; thus, the initial data model structure that is already inside the database is \(G_{init}=(V_{init},E_{init})\), and the imported ontology is \(G_{imp}=(V_{imp},E_{imp})\). Using this definition, edges are imported is as follows:  
\[E_{init}\cup\ E_{imp}=\left(e_{1}^{init},e_{2}^{init},\ldots,e_{n}^{init} \right)\cup\ \left(e_{1}^{imp},e_{2}^{imp},\ldots,e_{m}^{imp}\right), \tag{12}\]  
where \(n\) is the number of relationships connecting concepts in the initial ontology, and \(m\) is the number of relationships connecting concepts in the imported ontology. The importing of concepts can be represented through:  
\[V_{init}\cup\ V_{imp}=\left(v_{1}^{init},v_{2}^{init},\ldots,v_{i}^{init} \right)\cup\ \left(v_{1}^{imp},v_{2}^{imp},\ldots,v_{j}^{imp}\right), \tag{13}\]  
where \(i\) is the number of concepts in the initial ontology, and \(j\) is the number of concepts in the imported ontology. The resulting graph is represented by \(G_{\textit{res}}\), which is the union of the initial ontology graph (already inside the DB) and the imported ontology, and therefore contains the concepts \(V_{\textit{init}}\) and \(V_{\textit{imp}}\) and relationships \(E_{\textit{init}}\) and \(E_{\textit{imp}}\):  
\[G_{\textit{res}}=G_{\textit{init}}\cup\ G_{\textit{imp}}=\Big{(}\Big{(}E_{ \textit{init}}\cup\ E_{\textit{imp}}\Big{)},\Big{(}\ V_{\textit{init}}\cup\ V_{ \textit{imp}}\Big{)}\Big{)}. \tag{14}\]  
Based on these definitions, the algorithm for importing an ontology to a nonempty graph DB is developed (Algorithm 2). If empty, the imported model is inserted as is. However, the most interesting is the first case, when the DB already contains some data models or ontologies with some common concepts and/or relationships.