###### Abstract  
A knowledge graph is a structured semantic network designed to describe physical entities and relations in the world. A comprehensive and accurate knowledge graph is essential for tasks such as knowledge inference and recommendation systems, making link prediction a popular problem for knowledge graph completion. However, existing approaches struggle to model complex relations among entities, which severely hampers their ability to complete knowledge graphs effectively. To address this challenge, we propose a novel hierarchical multi-head attention network embedding framework, called RiQ-KGC, which integrates different-grained contextual information of knowledge graph triples and models quaternion rotation relations between entities. Furthermore, we propose a relation instantiation method for alleviating the difficulty of expressing complex relations between entities. To enhance the expressiveness of relation representation, the relation is integrated by Transformer to obtain multi-hop neighbor information, so that one relation can be embedded into different embeddings according to different entities. Experimental results on four datasets demonstrate that RiQ-KGC exhibits strong competitiveness compared to state-of-the-art models in link prediction, while the ablation experiments reveal that the proposed relation instantiation method achieves great performance. knowledge graph embedding; link prediction; quaternion; complex relation; multi-hop neighbor +
Footnote †: journal:  
as transformation patterns between entities such as translation and rotation. These KG representation models can be classified as machine-learning-based, including models such as TransE [19] and RotatE [20]. By embedding entities in more intricate spaces and conveying relational patterns in a more logical manner, these models can achieve a more precise fit to the physical world. The emergence of deep learning techniques has paved the way for the adoption of large-scale neural networks in extracting entity and relation features. KG representation models that utilize these techniques can be classified as deep-learning-based models such as MTL-KGC [21] and HittER [22]. These models are capable of learning KG features in an automated way, without pre-defining entity and relation representations, resulting in a more flexible modeling approach. However, deep-learning-based models come with certain requirements, such as larger datasets and an increased number of training iterations, that allow the models to fully learn the characteristics of the KG representations. In this paper, we firstly propose a novel RiQ-KGC framework, which is a KG-embedding model that embeds KGs into hierarchical multi-head attention networks in quaternion space. RiQ-KGC models and extracts geometric information between entities and relations and leverages the attention parameters of the model to generalize the geometric transformation capabilities of entities. The quaternion representation is an ideal choice for smooth rotations and spatial transformations in parametric vector spaces [23], and can accurately represent the symmetric, anti-symmetric, and inverse relations present in the KGs. As a result, RiQ-KGC incorporates the advantages of machine-learning-based models and allows entities to be related to each other using a lower embedding dimension. At the same time, RiQ-KGC offers better learning capability than current deep-learning-based models by leveraging both entity geometry transformation and multi-hop neighborhood information to support model learning. In the physical world, the number of entities tends to be much greater than the number of relations. However, relations that are expressed as transformation patterns can be too coarse, which restricts the flexibility of transformations and inhibits the geometric representation quality on one-to-one, one-to-n, m-to-n, and m-to-one relations, which we call complex relations. To address this issue, we propose a method of relation instantiation.