# Using Graph Embedding Techniques in Process-Oriented Case-Based Reasoning
## 4 Neural-Network-Based Semantic Graph Similarity Measure
### Encoding Semantic Graphs
#### 4.1.2 Encoding Semantic Descriptions  
When encoding semantic descriptions, it is important to describe the underlying structure of these data. As introduced in Section 2.1 and illustrated by the task node coat from Figure 1, semantic descriptions are composed of atomic and composite data with a data type and the respective data content. The possible arrangement of composite typesholding atomic types, other nested composite types holding more nested types, and so on can be visualized as a _hierarchical tree structure_. Figure 4a shows our semantic description used as a running example in tree form. The depiction distinguishes between leaf nodes (ovals) and inner nodes (rectangles), as well as child-of (dashed lines) and parent-of (dotted lines) relations. The relations between these nodes are defined according to the hierarchical structure of the semantic description, e.g., the item Spoon is a child of the list of Auxiliaries. More formally, the tree representation of the semantic description can be redefined as a graph \(\mathcal{G}_{\text{sem}}=(N_{\text{comp}}\subseteq\mathcal{S}_{\text{comp}},N _{\text{atom}}\subseteq\mathcal{S}_{\text{atom}},E_{\text{sem}}\subseteq(N_{ \text{comp}}\cup N_{\text{atom}}))\times(N_{\text{comp}}\cup N_{\text{atom}}))\) with two sets of nodes and edges between these nodes. The encoding procedure covers the encoding data type and content of entries within the semantic description. This enables the neural network to learn to distinguish different semantic information with regard to both aspects. For instance, in the semantic description of coat, the integer 2 is used as a Duration of type integer. The same number could also be used in a different context (e.g., as the required skill of this task on a 0 to 5 scale), which makes encoding the data type in combination with the content crucial. We encode the data type as a one-hot vector with the function \(enc_{\text{semType}}:\mathcal{S}\rightarrow\mathbb{R}^{l_{\text{semType}}}\). Given a total of five atomic types and three composite types, all vectors have a common vector length of \(l_{\text{semType}}=8\) elements. Please note that we are referring to the number of data types of the Process-Oriented Case-Based Reasoning (POCBR) framework ProCAKE [7] with these numbers. In general, the approach is generic and it allows the use of any other framework, as well. This encoding procedure can be extended in certain ways: First, it is possible to encode other atomic or composite data types in the same way. If the atomic types are extended by a data type for timestamps, for instance, it is possible to add a new one-hot encoding for this extension. Second, only encoding the base types, i.e., string, float, list, etc., can be insufficient in certain scenarios where the domain model is very complex (see [4; 5] for examples of such domains). The proposed approach can be extended in these cases to use individual one-hot encodings for specific data types in the domain model. For instance, the string entries in the list of Auxiliaries might be defined in a taxonomy, which motivates the use of an individual one-hot vector instead of the generic type vector that is used for all strings. The second part of encoding semantic descriptions deals with their content. Due to the variety of different types of data, it is difficult to encode these data into a common vector space. This requirement also hinders the use of established existing methods out of the box, e.g., one-hot encoding for string vocabularies [50] or a single scalar value for numerics. We propose to encode the content of one atomic data entry as a single vector with a common vector length \(l_{\text{atom}}\) by the function \(enc_{\text{atom}}:\mathcal{S}_{\text{atom}}\rightarrow\mathbb{R}^{l_{\text{atom}}}\). The elements of this vector are set by a specific encoding method for each data type. Due to space restrictions in this paper,  
Figure 4: Encoding of composite types: (**a**) Tree encoding (**b**) Sequence encoding  
the specific encoding methods cannot be presented in detail.