| Knowledge graph provides an intuitive ability to organize,manage and utilize massive knowledge,which has been widely used in e-commerce,military,medical and other fields.Public security work pays more attention to key elements such as people,events,places,objects and organizations,as well as the relationships between them.Under the background of Strengthening Police Force with Science and Technology,knowledge graphs have great development potential and utilization value.However,being limited to the current knowledge graph construction technology,the implicit relationships between a large number of entities are not fully explored,so it is necessary to do the knowledge graph completion.In this paper,we introduce three knowledge graph completion algorithms to complete knowledge graph by utilizing external text data and relationship paths between knowledge graph entities.Specific work and innovation are as follows:Firstly,to improve the utilization of knowledge in the new external text data in knowledge graphs,this paper proposes an unsupervised model,which uses Prompt technique and pretrained language models to extract structured knowledge triples from the text data,and accomplishes the completion of the knowledge graphs.By designing prompt templates,this model realizes the effective use of pre-training language model with low training cost.The relationship extraction experiments were carried out on NYT10 dataset.The results showed that the value of B-cubed increased by 4.2% compared with HiURE,the optimal cluster-based unsupervised relation extraction model,and increased by 9.5% compared with UREVA,the optimal unsupervised relationship extraction model based on VAE framework.In addition,the transfer learning experiment was also carried out.After having been trained on NYT10 dataset,the model was transferred to Wiki-80 dataset,and a good relationship extraction effect was obtained by training with few training samples.Secondly,to solve the problem that the existing path-based reasoning algorithms cannot take both the local and global features of the knowledge graph into account,this paper proposes a hierarchical division of relational paths between entities,and uses multi-level attention mechanism and bidirectional long short-term memory neural network for feature extraction.Link prediction experiments were carried out on NELL-995 and FB15k-237 data sets.The results show that the MAP value and Hits@1 index of the proposed algorithm are increased by1.8% and 1.4% respectively,compared with the existing knowledge graph completion algorithms based on relational paths,such as CNN-BiLSTM.On the kinship dataset,its Hits@3value reaches 0.988.In addition,the knowledge graph completion methods based on relation paths are often limited to feature extraction and relational prediction of the relation paths existing between target entities ignoring the adjacency entities and relations of the relation paths.To solve this problem,this paper proposes an algorithm that integrates the adjacency entities and relations of the relation paths into the process of generating and coding the relational paths,and then completes the knowledge graph based on these relation paths information.Good experiment results were obtained on multiple datasets,which proved that this model can complete the knowledge graph by utilizing the relation paths’ adjacent entities’ and relations’ information.Finally,a knowledge graph completion prototype system based on relation extraction and relation path reasoning is designed and constructed,and the algorithms proposed in this paper are validated and demonstrated. |