## 1 Introduction  
The goal of knowledge graph completion (KGC) is to find missing entities or relation links in an existing knowledge graph, thereby enhancing and expanding the knowledge graph by predicting missing information from known triplets. Currently, there are two main approaches in this field. The first approach is structure-based KGC, where entities and relations are represented as embedding vectors, and the matching scores for each triplet are computed by modeling their interactions. Typical models include TransE [1] and RotatE [2]. Although structure-based methods have made some progress, they perform poorly in predicting long-tail entities and struggle to obtain effective embedding representations for entities that appear infrequently during training. Additionally, these methods only use entity and relation embeddings for link prediction, without fully leveraging the semantic information of entities and relations to enrich their embedding representations. The second approach is text-based KGC, with notable models such as KG-BERT [3], StAR [4], and C-LMKE [5]. This approach combines textual descriptions of entities and relations with pre-trained language models to enrich the representation of entities and relations in the knowledge graph, thereby alleviating the performance issues of structure-based methods in handling long-tail entities and relations. However, this approach has two main problems. (1) The issue of entity embedding quality: Existing methods rely solely on combining textual descriptions with pre-trained language models to generate entity embeddings, which may not fully capture the semantic information of entities. (2) Insufficientunderstanding of context information between entities and relations: Current text-based methods typically transform the textual descriptions of entities and relations into their contextual embeddings using language models. However, these methods employ different strategies to enhance the embedding representations of entities and relations, overlooking the complex interactions between entities and relations, thereby struggling to capture the complex semantic correlations between entities and relations.  
To address these issues, this paper proposes a knowledge graph completion method that combines entity category information with an attention mechanism. The main contributions can be summarized as follows:  
1. Proposing a novel text-based contrastive learning model called CAKGC, which incorporates both entity category semantic information and textual descriptions to more accurately model entity embedding representations.
2. Design a new attention network called Multi-layer Residual Attention Network (MRAN), which combines MRAN with pre-trained language models. The multi-layer self-attention mechanism allows the model to iterate and propagate information between entities, better capturing the complex relationships between entities. By simultaneously learning multiple attention heads, the model can model different types of relationships in parallel, enhancing the representation capability for diverse relationships. Each attention head can focus on different relationship patterns, capturing finer-grained features of relationships.