## 4 Semantic Management Component
### Get MappingSuggestion Service
For instance, a person asking for a coffee also takes a cake, this means that these two concepts are, from now, interrelated, and their \"closeness\" grows each time someone orders coffee and  
Figure 4: Example path with concepts, relationships, and weights. cake. As [PERSON]'s algorithm finds the weighted shortest path between two concepts, after each match, the weight of the corresponding relationship decreases according to:  
\[w_{j}=\frac{w_{j-1}}{1+w_{j-1}}, \tag{11}\]  
where \(w_{j}\) is the current value of the weight between two concepts, and \(w_{j-1}\) is the value of weight before this iteration. In this way, the value of the weight will constantly decrease with each iteration; on the contrary, the \"closeness\" grows. This can be applied for two standalone concepts, or, if it is a model with a set of interconnected concepts, the weight of all segmental relationships decreases, and the \"closeness\" of the connected concepts grows correspondingly. Algorithm 1 builds the suggestions for each concept in the origin model and is shown below:  
```
INPUT: origin and target labels A and B, nondirected graph \(G=(V,E,w)\), with relationships weights \(w_{e}\in R\) for all \(w\in E\), source and target concepts \(a_{m},\ b_{n}\in V\) for each \(a\) in A do  define all possible paths from \(a\) to each \(b\) in B if there is a path \(p\) form \(a\) to \(b\) in \(G\) then  apply [PERSON]'s algorithm to all \(a\)-\(b\) pairs  order resulting paths by distance (or semantic distance) if the number of resulting paths \(<4\)then  collect number shortest paths else  collect 4 shortest paths endif else  assign nil endif endfor each OUTPUT: number ordered paths with assigned distance
```  
**Algorithm 1** Suggestion building for each concept in the origin model  
Based on the suggestions built for the concepts in origin model, an output document containing the suggestions is generated, as shown in Figure 3:0  
* \"origin\"--which contains the subfields \"label\" for the name of the concept and \"XPath\" containing the parent nodes;
* \"mapping\"--represents mapping the origin and target data models, containing all suggestions for each specific concept. The subfields are:
* \"suggestion\", with \"label\" naming the target concept, \"score\" reflecting the importance or weight of the path between \"origin\" and \"target\" concepts, \"XPath\" for the parent concepts, and \"rank\", which serves to identify which suggestion is the closest one;
* \"graph\"--representing the full path from the \"origin\" to the \"target\" concept in a segmental way, being composed of triples of the form \"start\" -\(>\) \"weight\" -\(>\) \"end\"; and
* \"CYPHER query\"--a field that contains the generated Cypher query, which can be used for visualizing and checking the suggested path. The output provides a set of suggestions for each of the origin concepts, and the Cypher query is used for visualizing and checking the suggestions. Once receiving the JSON input, the semantic manager identifies the origin and target concepts. If these two models, after insertion into the graph DB, are connected through some intermediary concepts (i.e., crossing points), a set of suggestions or the shortest paths from each origin to a set of target concepts are returned. The number of returned suggestions depends on the size, complexity, and depth of the graph; however, for this particular test case, it cannot exceed four suggestions. Nevertheless, the number of returned suggestions can be changed on demand. The getMappingSuggestion service finds the interrelation between concepts placed in the origin and the target data models. Data models are inserted into the graph DB and, thus, are converted to a graph, enabling the use of the shortest path algorithms. The concept of interrelation is based on the \"closeness\", which is calculated as the shortest weighted path between each concept in the origin and a set of concepts in the target data models.