## 4 Methodology
### Update Node Representations with Heterogeneous Graph Attention Network  
The inputs of this module are \(\left\{x_{i}\right\}_{i=1}^{n}\), \(\left\{r_{j}\right\}_{j=1}^{m}\), and \(\left\{s_{k}\right\}_{k=1}^{q}\), which learn and update representations of the three types of information through the heterogeneous graph attention network and use them for object extraction.  
The module models the sentence's word tokens, relations, and subject tokens as nodes and then updates the nodes' representations. A node of any one type is considered as a neighbor of each node of the other two types, and the embedding of each node of each type is updated by a mechanism similar to a heterogeneous graph attention network [4; 5].  
In order to distinguish the importance of the types of the current node's neighbors to the current node, it is necessary to calculate the current node's attention scores to the other two types. First, the embedding of each type is represented as the average of the features of the nodes of that type, and then the attention score of the current node to the type is calculated based on the embedding of the current node and the embedding of the type.  
\[h_{type}=\frac{1}{count\in\left\{n,m,q\right\}}\sum_{1}^{count}node\in\left\{ x_{i},r_{j},s_{k}\right\} \tag{3}\]  
where \(h_{type}\) is the embedded representation of one type, while \(n\), \(m\), and \(q\) represent the number of nodes of type \(x\), \(r\), and \(s\), respectively.  
The following is an example of calculating the attention score to types \(r\) and \(s\) when the current node is \(x_{i}\):  
\[\begin{array}{c}a_{x_{i}type}=W_{a}\big{[}W_{x}x_{i};W_{type}h_{type}\big{]} \\ \\ \alpha_{x_{i}type}=\frac{\exp\big{(}a_{x_{i}type}\big{)}}{\sum\limits_{type \in type}\exp\Big{(}a_{x_{i}type^{\prime}}\big{)}}\end{array} \tag{4}\]  
where \(W_{a}\), \(W_{x}\), and \(W_{type}\) are trainable parameters, and \(\left[\cdot;\cdot\right]\) denotes the concatenation of vectors.  
After calculating the attention scores of the current node to the other two types, it is also necessary to calculate the attention scores of the current node to each neighbor node of both types. The following is an example of computing the attention score to each neighbor node \(\left\{r_{j}\right\}_{j=1}^{m}\) or \(\left\{s_{k}\right\}_{k=1}^{q}\) when the current node is \(x_{i}\):  
\[\begin{array}{c}a_{x_{i}node}=\alpha_{x_{i}type}\odot W_{w}\big{[}W_{p}x_{i  
After the dual-level attention mechanism, the node \(x_{i}\)/s representation of the current layer is as follows:  
\[x_{i}t=x_{i}+\sum_{j=1}^{m}\alpha_{x_{i}r_{j}}W_{r}r_{j}+\sum_{k=1}^{q}\alpha_{x _{i}s_{k}}W_{s}s_{k} \tag{6}\]  
where \(x_{i}\) is the initial embedded representation of node \(x_{i}\), \(x_{i}t\) is the updated node representation, and \(W_{r}\) and \(W_{s}\) are trainable parameters.  
A gate mechanism is used to control the updates to the nodes of the previous layer.  
\[o_{i}=sigmoid(W_{o}[x_{i};x_{i^{\prime}}]) \tag{7}\]  
where \(sigmoid\) is the activation function and \(W_{o}\) is a trainable parameter.  
Thus, the representation output of the node \(x_{i}\) at the current layer is as follows:  
\[\vec{x}_{i}=o_{i}\odot x_{i}t+(1-o_{i})\odot x_{i} \tag{8}\]  
The same process is used for updating the node representations of types \(r\) and \(s\).