Method, device and equipment for searching non-deterministic relation entries and constructing knowledge graph

By converting the target relationship data into vectors and searching with vector indexes, the search efficiency problem caused by uncertain relationships in the traditional knowledge graph is solved, and efficient and accurate non-deterministic relationship entry search is achieved, reducing costs and simplifying maintenance.

CN119621923APending Publication Date: 2025-03-14INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411697244.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

When searching for traditional knowledge graphs, due to uncertain relationships, the expected results cannot be found, and semantic alignment and normalization are required, resulting in low efficiency, high cost, difficult maintenance and poor universality.

Method used

By converting the target relational data into vectors, using vector indexes to quickly locate relevant data, reducing comprehensive searches for the entire knowledge graph library, and optimizing query performance. This method does not need to consider whether the relationship is uniquely specified, and does not require semantic alignment and normalization to be performed during search.

Benefits of technology

It improves the efficiency of retrieving candidate relationship vectors in the knowledge graph library, enhances the accuracy of search results, reduces search costs, simplifies the maintenance process, and improves the scalability and flexibility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621923A_ABST
    Figure CN119621923A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a non-deterministic relation entry search method, device and equipment and a knowledge graph construction method, device and equipment. Performing vector conversion on the target relation data to obtain a target relation vector corresponding to the target relation data; according to the target relation vector, obtaining a candidate relation vector having similarity with the target relation vector and a vector index to which the candidate relation vector belongs from a pre-constructed knowledge graph library; and according to the similarity between each candidate relation vector and the target relation vector, the vector index to which the candidate relation vector belongs and the target object data, obtaining an output result corresponding to the search request from a knowledge graph library. The method does not need to consider whether the relationship between different entries in the knowledge graph database is uniquely specified or not. And operations such as semantic alignment and normalization processing do not need to be executed during searching. The searching efficiency is higher, the cost is lower, and the method can be suitable for multiple types of knowledge maps and searching tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to methods, devices and equipment for searching for non-deterministic relationship terms and constructing knowledge graphs. Background Art

[0002] The knowledge graph is a semantic web that depicts the relationships between entities. It is a new generation of knowledge engineering technology that uses NLP (natural language processing) as the underlying technology. It captures data, information and other content, sorts them out, and combines them into a graph to provide knowledge reserves for AI.

[0003] At present, knowledge graphs are constructed and retrieved based on SPO (h, r, t) triples (where h represents the subject, t represents the object, and r represents the relationship between the subject and the object). The relationship r must be determined in advance and uniquely specified. When the semantics are the same, alignment and normalization are required to ensure the certainty of the relationship. If there are non-deterministic relationships with the same semantics, the search results will not meet expectations. In other words, traditional knowledge graphs are built on deterministic relationships, and operations such as semantic alignment and normalization need to be performed during search. Faced with a large number of SPO (h, r, t) triple instances, semantic alignment and normalization work requires a lot of manual or crowdsourcing to complete, which obviously has problems such as low efficiency, high cost, difficult maintenance, and poor universality. Summary of the invention

[0004] In view of this, the present invention provides a method, device and equipment for searching non-deterministic relationship terms and constructing a knowledge graph to solve the problem that when searching for results in traditional knowledge graphs, the expected results cannot be found if the relationship is uncertain, and the search process needs to perform operations such as semantic alignment and normalization, resulting in low efficiency, high cost, difficult maintenance and poor universality.

[0005] In a first aspect, the present invention provides a method for constructing a knowledge graph, the method comprising:

[0006] Obtaining a search request, wherein the search request includes target relationship data and target object data;

[0007] Performing vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data;

[0008] According to the target relationship vector, a candidate relationship vector having similarity with the target relationship vector and a vector index to which the candidate relationship vector belongs are obtained from a pre-built knowledge graph library, wherein the vector index is an index generated based on the candidate relationship vector and identification information corresponding to the relationship data used to generate the candidate relationship vector, and the relationship data represents the relationship between the subject data and the object data;

[0009] According to the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, an output result corresponding to the search request is obtained from the knowledge graph library, wherein the output result at least includes the subject data corresponding to the search request.

[0010] The present invention provides a non-deterministic relationship item search method, which has the following advantages:

[0011] By converting the target relationship data into a vector, similarity comparison can be quickly performed in a high-dimensional space, thereby improving the efficiency of retrieving candidate relationship vectors from the knowledge graph library, and being able to more accurately match relationships close to the target relationship data, thereby improving the accuracy of the retrieval results. Using the vector index as a search bridge, data related to a specific relationship vector can be quickly located, reducing the comprehensive search of the entire knowledge graph library and optimizing the query performance. In the method of the embodiment of the present application, not only the similarity of the relationship data is considered, but also the target object data is combined, so that the search results are more comprehensive and can cover more dimensions. In this process, there is no need to consider whether the relationship between different entries in the knowledge graph library is uniquely specified. There is no need to perform operations such as semantic alignment and normalization during the search. Therefore, the search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add an index vector to the original knowledge graph library, without other additional operations, simple operation, and easier subsequent maintenance. And the method is easy to expand, can easily adapt to new knowledge graph libraries or search requirements, and enhances the scalability and flexibility of the system. It can be applied to various types of knowledge graphs and search tasks and is widely used in different scenarios.

[0012] In an optional implementation, according to the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, an output result corresponding to the search request is obtained from the knowledge graph library, specifically including:

[0013] According to the similarity between each candidate relationship vector and the target relationship vector, a target candidate relationship vector having a similarity value higher than a preset similarity value is selected from the candidate relationship vectors;

[0014] According to the vector index to which the target candidate relationship vector belongs, the candidate knowledge graph to which the vector index to which the target candidate relationship vector belongs is selected from the knowledge graph library;

[0015] Screen candidate knowledge graphs according to target object data to obtain target knowledge graphs;

[0016] Extract the subject data from the target knowledge graph as the output result and output it.

[0017] Specifically, by screening candidate relationship vectors with preset similarity values, irrelevant or low-similarity relationships can be quickly excluded, reducing the burden of subsequent processing and thus improving search efficiency. Using vector indexes to directly locate knowledge graphs containing similar relationship vectors avoids the need for comprehensive searches and greatly reduces search time and computing resource consumption. Screening candidate knowledge graphs in combination with target object data ensures the relevance of search results and improves the accuracy of output results. Due to the reduction in search steps and calculations, the search response speed is significantly improved, and the user experience is smoother. This method has a low dependence on the knowledge graph library, and even if the data structure in the knowledge graph library changes, it will not affect the search function.

[0018] In an optional implementation, the output result also includes the relationship data included in the target knowledge graph, the similarity between the relationship vector included in the target knowledge graph and the target relationship vector, and the target relationship vector;

[0019] After obtaining a target knowledge graph corresponding to the target candidate relationship vector from a knowledge graph library according to the target candidate relationship vector, the method further includes:

[0020] Extracting first identification information corresponding to the target candidate relationship vector from the vector index to which the target candidate relationship vector belongs;

[0021] Determine, according to the first identification information, target candidate relationship data corresponding to the first identification information;

[0022] Generate a first data set according to the relationship data included in the target knowledge graph and the similarity between the relationship vector included in the target knowledge graph and the target relationship vector;

[0023] Generate a second data set according to the relational data included in the target knowledge graph;

[0024] Generate a third data set based on the subject data extracted from the target knowledge graph;

[0025] The first data set, the second data set, the third data set, and the target relationship vector are output as output results.

[0026] Specifically, the target relationship vector contained in the output result is used to indicate the representation of the relationship vector of the relationship data corresponding to the search request. The relationship data can provide detailed information about the relationship between entities in the target knowledge graph, which enhances the practicality of the output result. By providing the similarity between the relationship vector and the target relationship vector, the staff can better understand the logic and basis behind the search results, and improve the interpretability of the search results. For application scenarios that require decision-making based on the knowledge graph, detailed output information can help workers make more accurate and reasonable decisions. The first identification information and the target candidate relationship data help to identify and update specific relationships in the knowledge graph, which is convenient for maintaining and updating the knowledge base. When integrating knowledge graphs from different sources, the provided first identification information and target candidate relationship data help to align and integrate data. By using vector indexes and identification information, relevant data can be quickly located in the knowledge graph, thereby improving search efficiency. The output results of this method provide more possibilities for the application of knowledge graphs, such as question-answering systems, recommendation systems, etc. By providing detailed output information, the search error rate caused by incomplete or erroneous information can be reduced. Outputting the output information in the form of a data set is more convenient for data maintenance and staff viewing.

[0027] In a second aspect, the present invention provides a method for constructing a knowledge graph, the method comprising:

[0028] Obtaining entries of the knowledge graph to be constructed, the entries include subject data, object data, and relationship data between the subject and the object;

[0029] Performing vector conversion on the relational data to generate a relational vector corresponding to the relational data;

[0030] respectively generating first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data;

[0031] Creating a relationship vector index according to the third identification information, the relationship data and the relationship vector;

[0032] Based on the subject data, the first identification information, the object data, the second identification information, the relationship data, the third identification information, and the relationship vector index, a knowledge graph is constructed, and the knowledge graph is added to a pre-constructed knowledge graph library.

[0033] A knowledge graph construction method provided by the present invention has the following advantages: by converting the relational data into a vector form through vector conversion, it is convenient to quickly execute the similarity between the vector and other relational vectors when searching for entries based on non-determined relationships in the knowledge graph library, thereby improving the efficiency of knowledge graph query. In this process, it is not necessary to consider whether the relationship between different entries in the knowledge graph library is uniquely specified. Because the relationships have generated corresponding relationship vectors and vector indexes, there is no need to perform operations such as semantic alignment and normalization processing during subsequent searches. The search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add an index vector to the original knowledge graph library, without any other additional operations, the operation is simple, and subsequent maintenance is easier. Unique identification information is generated for subject data, object data, and relational data to ensure data consistency and traceability. Moreover, the knowledge graph is constructed based on structured data and indexes, so that the relationship between data is more intuitive and easy to understand. Adding a new knowledge graph to a pre-built knowledge graph library enhances the scalability and dynamic update capabilities of the knowledge base. Furthermore, in this method, through a unified data processing and indexing mechanism, data from different sources can be more conveniently integrated into the knowledge graph.

[0034] In an optional implementation, performing vector conversion on the relational data to generate a relational vector corresponding to the relational data specifically includes:

[0035] The relational data is input into a pre-built vector conversion model, and vector conversion is performed on the relational data to generate a relational vector corresponding to the relational data.

[0036] In an optional implementation, before inputting the relational data into a pre-built vector conversion model and performing vector conversion on the relational data to generate a relational vector corresponding to the relational data, the method further includes:

[0037] Acquire a sample data set, wherein each sample data in the sample data set includes a plurality of different words with the same semantics;

[0038] Multiple different words with the same semantics are input into the initial vector conversion model for iterative training until the word vector dimension generated by the trained vector conversion model reaches a preset dimension, and then the iterative training is stopped.

[0039] Specifically, by training the vocabulary in the sample data set, the model can learn the semantic relationship between vocabulary, thereby generating more accurate and semantically meaningful word vectors. During the training process, the model can capture expressions with the same semantics but different vocabulary, thereby enhancing the model's ability to understand the semantics in natural language. Through iterative training, the model can reduce the ambiguity that may arise from vocabulary in different contexts and improve the quality of the output word vectors. Stopping iterative training when the preset dimension is reached ensures that the word vectors meet certain quality standards while avoiding overfitting, thereby improving the performance of the model. Through pre-training, the initial vector conversion model can be directly used for the vector conversion of relational data, simplifying the vector conversion process. The pre-training process can be completed on the data set at one time, and then the trained model can be directly used for vector conversion, which improves processing efficiency. By containing sample data with multiple vocabulary that express the same semantics, the model can learn the similarities in different languages ​​and dialects, which is helpful for cross-language applications. Pre-trained word vectors can help explain the relationship between vocabulary, making the behavior of the model more transparent and explainable. High-quality word vectors help to better convert relational data into relational vectors, thereby improving the accuracy and efficiency of knowledge graph construction.

[0040] In a third aspect, the present invention provides a non-deterministic relationship item search device, the device comprising:

[0041] An acquisition module, used for acquiring a search request, wherein the search request includes target relationship data and target object data;

[0042] A conversion module, used to perform vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data;

[0043] A processing module is used to obtain, from a pre-built knowledge graph library, a candidate relationship vector having a similarity to the target relationship vector and a vector index to which the candidate relationship vector belongs, according to the target relationship vector, wherein the vector index is an index generated based on the candidate relationship vector and identification information corresponding to the relationship data used to generate the candidate relationship vector, and the relationship data represents the relationship between the subject data and the object data;

[0044] The screening module is used to obtain the output results corresponding to the search request from the knowledge graph library based on the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, wherein the output results at least include the subject data corresponding to the search request.

[0045] The present invention provides a non-deterministic relationship item search device, which has the following advantages:

[0046] By converting the target relationship data into a vector, similarity comparison can be quickly performed in a high-dimensional space, thereby improving the efficiency of retrieving candidate relationship vectors from the knowledge graph library, and being able to more accurately match relationships close to the target relationship data, thereby improving the accuracy of the retrieval results. Using the vector index as a search bridge, data related to a specific relationship vector can be quickly located, reducing the comprehensive search of the entire knowledge graph library and optimizing the query performance. In the method of the embodiment of the present application, not only the similarity of the relationship data is considered, but also the target object data is combined, so that the search results are more comprehensive and can cover more dimensions. In this process, there is no need to consider whether the relationship between different entries in the knowledge graph library is uniquely specified. There is no need to perform operations such as semantic alignment and normalization during the search. Therefore, the search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add an index vector to the original knowledge graph library, without other additional operations, simple operation, and easier subsequent maintenance. And the method is easy to expand, can easily adapt to new knowledge graph libraries or search requirements, and enhances the scalability and flexibility of the system. It can be applied to various types of knowledge graphs and search tasks and is widely used in different scenarios.

[0047] In a fourth aspect, the present invention provides a knowledge graph construction device, the device comprising:

[0048] An acquisition module is used to acquire entries of the knowledge graph to be constructed, and the entries include subject data, object data, and relationship data between the subject and the object;

[0049] A conversion module, used for performing vector conversion on the relational data to generate a relational vector corresponding to the relational data;

[0050] A generating module, used to respectively generate first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data;

[0051] A creation module, used to create a relationship vector index according to the third identification information, the relationship data and the relationship vector;

[0052] A construction module is used to construct a knowledge graph based on subject data, first identification information, object data, second identification information, relationship data, third identification information, and relationship vector index, and add the knowledge graph to a pre-built knowledge graph library.

[0053] The knowledge graph construction device provided by the present invention has the following advantages:

[0054] By converting the relational data into vector form through vector conversion, it is convenient to quickly perform the similarity between the vector and other relational vectors when searching for entries based on non-determined relationships in the knowledge graph library, thereby improving the efficiency of knowledge graph query. In this process, there is no need to consider whether the relationship between different entries in the knowledge graph library is uniquely specified. Because the relationships have generated corresponding relationship vectors and vector indexes, there is no need to perform operations such as semantic alignment and normalization in subsequent searches. The search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add index vectors to the original knowledge graph library, without any other additional operations, which is simple to operate and easier to maintain later. Generate unique identification information for subject data, object data and relational data to ensure data consistency and traceability. Moreover, building a knowledge graph based on structured data and indexes makes the relationship between data more intuitive and easy to understand. Adding a new knowledge graph to a pre-built knowledge graph library enhances the scalability and dynamic update capabilities of the knowledge base. Furthermore, in this method, through a unified data processing and indexing mechanism, data from different sources can be more easily integrated into the knowledge graph.

[0055] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the computer instructions to thereby execute the non-deterministic relationship entry search method of the above-mentioned first aspect or any corresponding embodiment thereof; or execute the knowledge graph construction method of the above-mentioned second aspect or any corresponding embodiment thereof.

[0056] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the non-deterministic relationship entry search method of the above-mentioned first aspect or any corresponding embodiment thereof; or to execute the knowledge graph construction method of the above-mentioned second aspect or any corresponding embodiment thereof.

[0057] In a fifth aspect, the present invention provides a computer program product comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the non-deterministic relationship term search method of the above-mentioned first aspect or any corresponding embodiment thereof; or, to execute the knowledge graph construction method of the above-mentioned second aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 It is an example diagram of a triple in the related art provided by the present invention;

[0060] Figure 2 is another example diagram of a triplet in the related art provided by the present invention;

[0061] Figure 3 It is a flowchart of a knowledge graph construction method provided by an embodiment of the present invention;

[0062] Figure 4 It is a flowchart of another knowledge graph construction method provided by an embodiment of the present invention;

[0063] Figure 5 It is a flowchart of another knowledge graph construction method provided by an embodiment of the present invention;

[0064] Figure 6 It is a flowchart of a non-deterministic relationship item search method provided by an embodiment of the present invention;

[0065] Figure 7 It is a result schematic diagram generated after extracting the subject data from the target knowledge graph as the output result and outputting it provided by the present invention;

[0066] Figure 8 It is a structural block diagram of a knowledge graph construction device provided by an embodiment of the present invention;

[0067] Fig. 9 is a structural block diagram of a non-deterministic relationship item search device provided by an embodiment of the present invention;

[0068] Fig.10 It is a schematic diagram of the hardware structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0070] Knowledge graph is a semantic web that depicts the relationship between entities. It is a new generation of knowledge engineering technology. It uses NLP (natural language processing) as the underlying technology to capture data, information and other content, sort them out, and combine them into a graph to provide knowledge reserves for AI. In addition to professional search engines, the mainstream product forms of knowledge graphs can be divided into general and vertical industry types. General knowledge graphs emphasize the breadth of knowledge and gradually evolve into general Internet knowledge graphs, including search engines, intelligent recommendations, intelligent question and answer, etc. Vertical industry knowledge graphs emphasize the depth of knowledge and are used for question and answer, decision support and business analysis. They are the knowledge base foundation that supports deep thinking of the AI ​​brain.

[0071] Currently, knowledge graphs are constructed and retrieved based on SPO (h, r, t) triples (where h represents the subject, t represents the object, and r represents the relationship between the subject and the object). The relationship r must be determined in advance and uniquely specified. When the semantics are the same, alignment and normalization are required to ensure the certainty of the relationship.

[0072] like Figure 1 As shown in the figure, if two instances of SPO (h: Zhang San, r: work, t: Beijing) and SPO (h: Li Si, r: work, t: Beijing) are stored in the knowledge graph, then according to the two conditions of r = "work" and t = "Beijing", it can be retrieved that "Zhang San" and "Li Si" work in Beijing. The relationship r = "work" here must be determined in advance and must be unique.

[0073] If there is a semantically equivalent nondeterministic relation such as Figure 2 As shown in the figure, according to the conditions r = "work" and t = "Beijing", the only result that meets the conditions is "Zhang San"; according to the conditions r = "part-time job" and t = "Beijing", the only result that meets the conditions is "Li Si". Although "work" and "part-time job" have the same semantics, the expected results should be "Zhang San" and "Li Si", but the actual results do not meet expectations.

[0074] To build and retrieve knowledge graphs based on SPO (h, r, t) triples, the relationship r needs to be determined in advance and uniquely specified, and alignment and normalization are required when the semantics are the same. That is, traditional knowledge graphs are all built on deterministic relationships. Faced with a large number of SPO (h, r, t) triple instances, semantic alignment and normalization work requires a lot of manual work or crowdsourcing, which obviously has problems such as low efficiency, high cost, difficult maintenance, and poor universality. How to find an efficient, flexible, and universal knowledge graph construction and retrieval method is a core key technical issue that needs to be considered and solved at present.

[0075] To solve the above problems, embodiments of the present invention provide a knowledge graph construction embodiment and a non-deterministic relationship item search embodiment. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including, for example, a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.

[0076] Among them, the knowledge graph construction embodiment is used to construct the knowledge graph, and the non-deterministic relationship item search is used to search in the constructed knowledge graph according to the search method provided in the embodiment of this application according to the search request, obtain the corresponding results and feedback. Among them, since the knowledge graph construction is only performed once, in the subsequent process, when there are new text entries, they are continuously updated to the knowledge graph library. Subsequently, it is the process of searching for non-deterministic relationship items.

[0077] In order to better help readers understand the specific implementation process in these two stages, the following will introduce the corresponding method embodiments according to the order in which these two stages are generated, but the order in which the embodiments are introduced does not determine the execution order of the subsequent two stage solutions.

[0078] In this embodiment, a knowledge graph construction method is provided, which can be used in the above-mentioned terminal devices, such as mobile phones, tablet computers, etc. Figure 3 is a flow chart of a knowledge graph construction method provided by an embodiment of the present invention, such as Figure 3 As shown, the process includes the following steps:

[0079] Step S301, obtain the entries of the knowledge graph to be constructed.

[0080] Specifically, an entry includes subject data, object data, and relationship data between the subject and the object.

[0081] For example, the subject data is Zhang San, the object data is Beijing, and the relationship data is work. And the subject data is Li Si, the object data is Beijing, and the relationship data is part-time job.

[0082] Step S302: perform vector conversion on the relational data to generate a relational vector corresponding to the relational data.

[0083] Specifically, when performing vector conversion on relational data, the relational data may be converted into relational vectors through a pre-built vector conversion model.

[0084] Step S303, respectively generating first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data.

[0085] Specifically, the identification information can be, for example, an id. For example, the id corresponding to Li Si is 0, the id corresponding to Beijing is 1, and the id corresponding to working is 2. The id corresponding to Zhang San is 4, and the id corresponding to working is 5.

[0086] Step S304: Create a relationship vector index according to the third identification information, relationship data, and relationship vector.

[0087] Step S305: Construct a knowledge graph based on the subject data, first identification information, object data, second identification information, relationship data, third identification information, and relationship vector index, and add the knowledge graph to the pre-constructed knowledge graph library.

[0088] Specifically, each text entry in the pre-constructed knowledge graph library corresponds to a data structure. For example, "Zhang San works in Beijing" and "Li Si works in Beijing" will respectively correspond to two different data structures, that is, two different knowledge graphs. When writing the knowledge graph, Neo4j graph database can be used.

[0089] The knowledge graphs corresponding to the above two examples are as follows:

[0090] / / Zhang San works in Beijing

[0091] CREATE(p:Person{id:4,name:"Zhang San"});

[0092] CREATE(c:City{id:1,name:"Beijing"});

[0093] MATCH(p:Person),(c:City)where p.id=4and c.id=1;

[0094] CREATE(p)-[w:Work{id:5,name:"work"}]->(c)

[0095] RETURN p,w,c;

[0096] / / Create a vector index for "work", id=5, v=[1,1,1,0...0,1,1]

[0097] CALL apoc.index.vector.add('Work',[1,1,1,0...0,1,1],2)YIELD;

[0098] / / Li Si works in Beijing

[0099] CREATE(p:Person{id:0,name:"Li Si"});

[0100] CREATE(c:City{id:1,name: "Beijing"});

[0101] MATCH(p:Person),(c:City)where p.id=0and c.id=1;

[0102] CREATE(p)-[w:Work{id:2,name: "Working"}]->(c);

[0103] RETURN p,w,c;

[0104] / / Create a vector index for "Working", id = 2, v = [1,1,0,0...1,1,1]

[0105] CALL apoc.index.vector.add('Work',[1,1,0,0...1,1,1],5)YIELD;

[0106] It should be noted that the specific content of the relationship vector v in the above example is based on the model output result. Here, it is only an exemplary illustration of the existence of the relationship vector. Moreover, the vector index is composed of the relationship data id and the relationship vector.

[0107] The knowledge graph construction method provided in this embodiment converts relationship data into vector form through vector conversion, which is convenient for quickly calculating the similarity between this vector and other relationship vectors when searching for entries based on non-deterministic relationships in the knowledge graph library, improving the efficiency of knowledge graph queries. In this process, there is no need to consider whether the relationships between different entries in the knowledge graph library are uniquely specified. Because corresponding relationship vectors are generated for the relationships and vector indexes are generated, subsequent searches do not require operations such as semantic alignment and normalization. The search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, only the index vector needs to be added to the original knowledge graph library, without other additional operations. The operation is simple and subsequent maintenance is easier. Generate unique identification information for the subject data, object data, and relationship data to ensure data consistency and traceability. Moreover, constructing a knowledge graph based on structured data and indexes makes the relationships between data more intuitive and easy to understand. Adding the new knowledge graph to the pre-constructed knowledge graph library enhances the expandability and dynamic update ability of the knowledge base. Furthermore, in this method, through a unified data processing and indexing mechanism, it is more convenient to integrate data from different sources into the knowledge graph.

[0108] In this embodiment, a knowledge graph construction method is provided, which can be used in the above-mentioned mobile terminals, such as mobile phones, tablets, etc., Figure 4is a flow chart of another knowledge graph construction method provided by an embodiment of the present invention. Figure 4 As shown, before inputting the relational data into the pre-built vector conversion model, performing vector conversion on the relational data, and generating the relational vector corresponding to the relational data, it is necessary to first build the vector conversion model. For details, see below. The process of building the vector conversion model will be described in detail in the method flow, including the following steps:

[0109] Step S401, obtaining a sample data set.

[0110] Each piece of sample data in the sample data set includes a plurality of different words with the same semantics.

[0111] Specifically, a synonym dictionary is constructed based on the "Modern Chinese Synonym Dictionary" and saved as a sample training set as data.csv. Synonyms occupy a single line and are separated by English commas. The first word in each line is the original word, and the others are synonyms. The specific example is as follows:

[0112] 00001 line: work, part-time job, employment, going to work, office, labor, labor, livelihood, doing things

[0113] 00002 row: birthplace, hometown, old home, native place, native place, ancestral place, place of household registration

[0114] 00003 line: father, my father, biological father, dad, dad, old dad, dad, daddy, daddy, daddy

[0115] 00004 line: mother, family mother, biological mother, mom, mom, old mom, mommy, mother, old mother, mother

[0116] 00005 line: teacher, mentor, mentor, teacher, master

[0117] 00006 line: classmate, schoolmate, schoolmate, alumni, deskmate, study partner

[0118] …

[0119] Step S402, input a plurality of different words with the same semantics into the initial vector conversion model for iterative training, and stop the iterative training until the word vector dimension generated by the trained vector conversion model reaches a preset dimension.

[0120] Specifically, the initial vector conversion model is, for example, a Word2Vec model.

[0121] Assuming that different words with the same pronunciation are taken as a piece of sample data, multiple pieces of sample data are input into the initial vector conversion model for iterative training to generate corresponding word vectors, wherein the preset dimension of the word vector is, for example, 128 dimensions.

[0122] When building a Word2Vec model, you can define it as a basic neural network, which includes an input layer, an intermediate layer, and an output layer. The window configuration is 3 to improve training efficiency and effect.

[0123] When the dimension of the final output of the vector conversion model reaches 128 dimensions, the iterative training stops.

[0124] In an optional example, it is also possible to verify by visualization whether the feature vectors extracted from synonyms are closer, so as to confirm the availability of the model. When the model availability is sufficient, it can be applied to a specific vector conversion application instance.

[0125] A knowledge graph construction method provided by an embodiment of the present invention can learn the semantic relationship between words by training the words in the sample data set, thereby generating a more accurate and semantically meaningful word vector. During the training process, the model can capture expressions with the same semantics but different words, thereby enhancing the model's ability to understand the semantics in natural language. Through iterative training, the model can reduce the ambiguity that may be generated by words in different contexts and improve the quality of the output word vector. Iterative training is stopped when the preset dimension is reached, ensuring that the word vector meets a certain quality standard while avoiding overfitting, thereby improving the performance of the model. Through pre-training, the initial vector conversion model can be directly used for the vector conversion of relational data, simplifying the vector conversion process. The pre-training process can be completed on the data set at one time, and then the trained model can be directly used for vector conversion, which improves processing efficiency. By containing sample data of multiple words expressing the same semantics, the model can learn the similarities in different languages ​​and dialects, which is helpful for cross-language applications. Pre-trained word vectors can help explain the relationship between words, making the behavior of the model more transparent and explainable. High-quality word vectors help to better convert relational data into relational vectors, thereby improving the accuracy and efficiency of knowledge graph construction.

[0126] In this embodiment, a non-deterministic relationship item search method is also provided, which can be used in the above-mentioned mobile terminal, such as a mobile phone, a tablet computer, etc. Figure 5 is a flow chart of another knowledge graph construction method provided by an embodiment of the present invention, such as Figure 5 As shown, the process includes the following steps:

[0127] Step S501, obtaining a search request.

[0128] The search request includes target relationship data and target object data.

[0129] Specifically, when obtaining a search request, for example, the search is for "who works in Beijing".

[0130] The relationship data included in the search request is "Beijing", and the target object data is "work".

[0131] Step S502: perform vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data.

[0132] Specifically, when performing vector conversion on the target relationship data, the vector conversion model introduced in the above embodiment may be used to perform the conversion, that is, the vector conversion of the target relationship data is completed through the pre-built vector conversion model to obtain the target relationship vector.

[0133] Step S503, according to the target relationship vector, obtain the candidate relationship vector having similarity with the target relationship vector and the vector index to which the candidate relationship vector belongs from the pre-built knowledge graph library.

[0134] Specifically, as described above, the pre-built knowledge graph library may include multiple knowledge graphs. Each knowledge graph includes subject data, object data, relationship data, the identification information corresponding to the three, and a vector index. The vector index is composed of the relationship vector and the identification information corresponding to the relationship data, and the relationship vector is generated after vector conversion based on the relationship data. Therefore, when searching based on the target relationship limit, candidate relationship vectors with similarity to the target relationship vector can be extracted from the pre-built knowledge graph, and the vector index to which it belongs can also be determined based on the candidate relationship vector.

[0135] Step S504, obtaining the output result corresponding to the search request from the knowledge graph library according to the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data.

[0136] Specifically, as described above, based on the similarity between the candidate relationship vector and the target relationship vector, a candidate relationship vector with a higher similarity can be selected, and then based on the target object data, further screening is performed from the knowledge graph where the candidate relationship vector is located to match the knowledge graph of the target object data. Then, the output result corresponding to the search request is obtained from the finalized knowledge graph. Among them, the output result at least includes the subject data corresponding to the search request.

[0137] A non-deterministic relationship item search method provided by an embodiment of the present invention can quickly perform similarity comparison in a high-dimensional space by converting target relationship data into vectors, thereby improving the efficiency of retrieving candidate relationship vectors from a knowledge graph library, and being able to more accurately match relationships close to the target relationship data, thereby improving the accuracy of the retrieval results. Using a vector index as a search bridge, data related to a specific relationship vector can be quickly located, reducing the comprehensive search of the entire knowledge graph library and optimizing the query performance. In the method of the embodiment of the present application, not only the similarity of the relationship data is considered, but also the target object data is combined, so that the search results are more comprehensive and can cover more dimensions. In this process, there is no need to consider whether the relationship between different items in the knowledge graph library is uniquely specified. There is no need to perform operations such as semantic alignment and normalization during the search. Therefore, the search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add an index vector to the original knowledge graph library, without any other additional operations, the operation is simple, and subsequent maintenance is easier. And the method is easy to expand, and can easily adapt to new knowledge graph libraries or search requirements, enhancing the scalability and flexibility of the system. It can be applied to various types of knowledge graphs and search tasks and is widely used in different scenarios.

[0138] In this embodiment, a non-deterministic relationship item search method is provided, which can be used in the above-mentioned mobile terminal, such as a mobile phone, a tablet computer, etc. Figure 6 is a flowchart of a non-deterministic relationship item search method provided by an embodiment of the present invention. Figure 6 As shown, according to the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, the output result corresponding to the search request is obtained from the knowledge graph library, including the following steps:

[0139] Step S601 : According to the similarity between each candidate relationship vector and the target relationship vector, a target candidate relationship vector having a similarity value higher than a preset similarity value is selected from the candidate relationship vectors.

[0140] Specifically, when screening the target candidate relationship vector, considering that the higher the similarity, the more accurate the search results corresponding to the search request will be. Therefore, a preset similarity value, such as 90%, can be set. When the similarity between the candidate relationship vector and the target relationship vector is higher than 90%, the candidate relationship vector is determined to be the target candidate relationship vector.

[0141] Step S602, according to the vector index to which the target candidate relationship vector belongs, filter the candidate knowledge graph where the vector index to which the target candidate relationship vector belongs is located from the knowledge graph library.

[0142] Specifically, after the target candidate relationship vector is determined, it is equivalent to determining the vector index to which the target candidate relationship vector belongs.

[0143] Therefore, the corresponding knowledge graph can be located in the knowledge graph library based on the vector index.

[0144] Step S603, screen the candidate knowledge graphs according to the target object data to obtain the target knowledge graph.

[0145] Specifically, after obtaining the knowledge graph, further screening is required due to the differences in target object data, that is, the candidate knowledge graphs are screened according to the target object data to obtain the target knowledge graph.

[0146] Step S604, extracting the main data from the target knowledge graph as the output result and outputting it.

[0147] See Figure 7 As shown, Figure 7 It indicates that when obtaining the search results, Zhang San and Li Si can be output together as the output results.

[0148] In an optional example, in addition to the subject data, the output result may also include the relationship data in the target knowledge graph and the similarity between the relationship vector and the target relationship vector. Therefore, after obtaining the target knowledge graph corresponding to the target candidate relationship vector from the knowledge graph library according to the target candidate relationship vector, the method further includes the following method steps:

[0149] Step a1: extract first identification information corresponding to the target candidate relationship vector from the vector index to which the target candidate relationship vector belongs.

[0150] Specifically, as described above, the vector index is composed of the identification information corresponding to the relationship data and the relationship vector, therefore, the first identification information corresponding to the target candidate relationship vector is extracted from the vector index to which the target candidate relationship vector belongs. In an optional example, the identification information corresponding to the target candidate relationship vector introduced here is, for example, id information.

[0151] Step a2: determining target candidate relationship data corresponding to the first identification information according to the first identification information.

[0152] Step a3, generating a first data set according to the relationship data included in the target knowledge graph and the similarity between the relationship vector included in the target knowledge graph and the target relationship vector.

[0153] Step a4, generating a second data set based on the relational data included in the target knowledge graph.

[0154] Step a5: Generate a third data set based on the main data extracted from the target knowledge graph.

[0155] Step a6, outputting the first data set, the second data set, the third data set, and the target relationship vector as output results.

[0156] Specifically, when the target knowledge graph includes multiple entities, the output result is output in the above manner, which will be more standardized and clearer. Among them, the target relationship vector contained in the output result is used to indicate the representation method of the relationship vector of the relationship data corresponding to the search request. The relationship data can provide detailed information about the relationship between entities in the target knowledge graph, which enhances the practicality of the output result. By providing the similarity between the relationship vector and the target relationship vector, the staff can better understand the logic and basis behind the search results, and improve the interpretability of the search results. For application scenarios that require decision-making based on the knowledge graph, detailed output information can help workers make more accurate and reasonable decisions. The first identification information and the target candidate relationship data help to identify and update specific relationships in the knowledge graph, which is convenient for maintaining and updating the knowledge base. When integrating knowledge graphs from different sources, the first identification information and the target candidate relationship data provided help to align and integrate the data. By using vector indexes and identification information, relevant data can be quickly located in the knowledge graph, thereby improving search efficiency. The output results of this method provide more possibilities for the application of knowledge graphs, such as question-answering systems, recommendation systems, etc. By providing detailed output information, the search error rate caused by incomplete or erroneous information can be reduced. Outputting the output information in the form of a data set is more convenient for data maintenance and staff viewing.

[0157] In an optional embodiment, when obtaining candidate relationship vectors having similarity with the target relationship vector and the vector index to which the candidate relationship vector belongs from the pre-built knowledge graph library according to the target relationship vector, when calculating the similarity, the target relationship vector and each relationship vector in the knowledge graph library may be firstly reduced in dimension respectively;

[0158] The similarity calculation is performed after dimensionality reduction, which reduces the amount of calculation and improves the calculation efficiency of the similarity.

[0159] Alternatively, a simple bit comparison can be performed. For example, the data of the same dimension can be compared to see if they are the same or different, and the similarity between the two can be determined by comparing the number of the same or different data with the total number of 128 dimensions.

[0160] The above methods can reduce the amount of data for similarity calculation and improve processing efficiency.

[0161] Furthermore, in an optional example, after obtaining candidate relationship vectors having similarity with the target relationship vector and the vector index to which the candidate relationship vector belongs from a pre-built knowledge graph library according to the target relationship vector in the foregoing text, the method also includes: presenting the above data in the form of a list.

[0162] For example, the list includes the candidate relationship vector, the vector index to which the candidate relationship vector belongs, and further optionally, may include the relationship data corresponding to the candidate relationship vector, the identification information corresponding to the relationship data, and the similarity between the candidate relationship vector and the target relationship vector.

[0163] According to the similarity between each candidate relationship vector and the target relationship vector, after selecting the target candidate relationship vector whose similarity value is higher than the preset similarity value from the candidate relationship vector, a new list is generated to record a series of data corresponding to the target candidate relationship vector, such as the relationship data corresponding to the target candidate relationship vector, the identification information corresponding to the relationship data, and the similarity between the target candidate relationship vector and the target relationship vector.

[0164] Compared with collections, lists have clearer levels and are easier for users to view.

[0165] Hereinafter, the above content will be explained with a specific example.

[0166] In a specific example, first build the search function:

[0167] def function_query(r,t,score):

[0168] / / Function body

[0169] …

[0170] return h

[0171] Among them, r represents the relationship, t represents the object, score represents the similarity coefficient, and h represents the search result.

[0172] 2. Implement the function body content

[0173] def function_query(r,t,score):

[0174] / / P1: vectorize r

[0175] v = em.encodevec(r);

[0176] / / P2: Retrieve the vector closest to the given vector through the vector index

[0177] l=apoc.index.vector.query('Work',v); / /

[0178] / / P3: Traverse l to obtain the relationship value that meets the similarity coefficient conditions

[0179] ls = {}; / / Define the relationship value list:

[0180] for list in l

[0181] if list[1]>=score

[0182] ls.add(list[0])

[0183] / / P4: Traverse ls to obtain all results that meet the relationship conditions

[0184] lh = {}; / / define result value list

[0185] for lr in ls

[0186] lh.add(apoc.data.resets.query('Work',lr,'City',t))

[0187] / / P5: Return search results

[0188] return lh

[0189] Taking the search "Who is employed in Beijing" as an example, the condition input and search output are shown:

[0190] Input: r = "employment"

[0191] t = "Beijing"

[0192] score = 0.90

[0193] Output: v = [1,1,1,1...1,1,1]

[0194] l={["work",0.95],["part-time job",0.96]}

[0195] ls=["work","part-time job"]

[0196] lh=["Zhang San","Li Si"]

[0197] A non-deterministic relationship entry search method provided by an embodiment of the present invention can quickly exclude irrelevant or low-similarity relationships by screening candidate relationship vectors through preset similarity values, reduce the burden of subsequent processing, and thus improve search efficiency. The knowledge graph containing similar relationship vectors is directly located using vector indexes, avoiding the need for comprehensive searches and greatly reducing search time and computing resource consumption. The candidate knowledge graphs are screened in combination with the target object data to ensure the relevance of the search results and improve the accuracy of the output results. Since the search steps and calculation amount are reduced, the search response speed is significantly improved, and the user experience is smoother. This method has a low dependence on the knowledge graph library, and even if the data structure in the knowledge graph library changes, it will not affect the search function.

[0198] When the relational data contained in the output results can provide detailed information about the relationships between entities in the target knowledge graph, the practicality of the output results is enhanced. For application scenarios that require decision-making based on knowledge graphs, detailed output information can help workers make more accurate and reasonable decisions. The output results provide more possibilities for the application of knowledge graphs, such as question-answering systems and recommendation systems. By providing detailed output information, the search error rate caused by incomplete or incorrect information can be reduced.

[0199] In this embodiment, a knowledge graph construction device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0200] This embodiment provides a knowledge graph construction device, such as Figure 8 As shown, it includes: an acquisition module 801, a conversion module 802, a generation module 803, a creation module 804, and a construction module 805.

[0201] The acquisition module 801 is used to acquire entries of the knowledge graph to be constructed, where the entries include subject data, object data, and relationship data between the subject and the object;

[0202] The conversion module 802 is used to perform vector conversion on the relational data to generate a relational vector corresponding to the relational data;

[0203] A generating module 803, used to respectively generate first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data;

[0204] A creation module 804, configured to create a relationship vector index according to the third identification information, the relationship data and the relationship vector;

[0205] Construction module 805 is used to construct a knowledge graph based on subject data, first identification information, object data, second identification information, relationship data, third identification information, and relationship vector index, and add the knowledge graph to a pre-built knowledge graph library.

[0206] In an optional example, the conversion module 802 is specifically configured to input the relational data into a pre-built vector conversion model, perform vector conversion on the relational data, and generate a relational vector corresponding to the relational data.

[0207] In an optional example, the apparatus further includes: a training module 806;

[0208] An acquisition module 801 is used to acquire a sample data set, wherein each sample data in the sample data set includes a plurality of different words with the same semantics;

[0209] The training module 806 is used to input a plurality of different words with the same semantics into the initial vector conversion model for iterative training until the word vector dimension generated by the trained vector conversion model reaches a preset dimension, and then stop the iterative training.

[0210] The knowledge graph construction device in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0211] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0212] A knowledge graph construction device provided by an embodiment of the present invention converts relational data into vector form through vector conversion, so that when searching for entries based on non-determined relationships in the knowledge graph library, the similarity between the vector and other relationship vectors can be quickly executed, thereby improving the efficiency of knowledge graph query. In this process, it is not necessary to consider whether the relationship between different entries in the knowledge graph library is uniquely specified. Because the relationships have generated corresponding relationship vectors and vector indexes, there is no need to perform operations such as semantic alignment and normalization processing during subsequent searches. The search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add index vectors to the original knowledge graph library, without any other additional operations, the operation is simple, and subsequent maintenance is easier. Unique identification information is generated for subject data, object data, and relationship data to ensure data consistency and traceability. Moreover, the knowledge graph is constructed based on structured data and indexes, so that the relationship between data is more intuitive and easy to understand. Adding a new knowledge graph to a pre-built knowledge graph library enhances the scalability and dynamic update capabilities of the knowledge base. Furthermore, in this method, through a unified data processing and indexing mechanism, data from different sources can be more conveniently integrated into the knowledge graph.

[0213] This embodiment provides a non-deterministic relationship item search device, such as Fig. 9 As shown, it includes: an acquisition module 901, a conversion module 902, a processing module 903, and a screening module 904.

[0214] An acquisition module 901 is used to acquire a search request, wherein the search request includes target relationship data and target object data;

[0215] The conversion module 902 is used to perform vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data;

[0216] Processing module 903 is used to obtain, from a pre-built knowledge graph library, a candidate relationship vector having similarity to the target relationship vector and a vector index to which the candidate relationship vector belongs, according to the target relationship vector, wherein the vector index is an index generated based on the candidate relationship vector and identification information corresponding to the relationship data used to generate the candidate relationship vector, and the relationship data represents the relationship between the subject data and the object data;

[0217] The screening module 904 is used to obtain the output results corresponding to the search request from the knowledge graph library based on the similarity between each candidate relationship vector and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, wherein the output results at least include the subject data corresponding to the search request.

[0218] In an optional example, the processing module 903 is specifically configured to select a target candidate relationship vector having a similarity value higher than a preset similarity value from the candidate relationship vectors according to the similarity between each candidate relationship vector and the target relationship vector;

[0219] According to the vector index to which the target candidate relationship vector belongs, the candidate knowledge graph to which the vector index to which the target candidate relationship vector belongs is selected from the knowledge graph library;

[0220] Screen candidate knowledge graphs according to target object data to obtain target knowledge graphs;

[0221] Extract the subject data from the target knowledge graph as the output result and output it.

[0222] In an optional example, the output result also includes the relationship data included in the target knowledge graph, the similarity between the relationship vector included in the target knowledge graph and the target relationship vector, and the target relationship vector;

[0223] The processing module 903 is further configured to extract first identification information corresponding to the target candidate relationship vector from the vector index to which the target candidate relationship vector belongs;

[0224] Determine, according to the first identification information, target candidate relationship data corresponding to the first identification information;

[0225] Generate a first data set according to the relationship data included in the target knowledge graph and the similarity between the relationship vector included in the target knowledge graph and the target relationship vector;

[0226] Generate a second data set according to the relational data included in the target knowledge graph;

[0227] Generate a third data set based on the subject data extracted from the target knowledge graph;

[0228] The first data set, the second data set, the third data set, and the target relationship vector are output as output results.

[0229] The knowledge graph construction device in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0230] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0231] A non-deterministic relationship item search device provided by an embodiment of the present invention can quickly perform similarity comparison in a high-dimensional space by converting target relationship data into vectors, thereby improving the efficiency of retrieving candidate relationship vectors from a knowledge graph library, and being able to more accurately match relationships close to the target relationship data, thereby improving the accuracy of the retrieval results. Using a vector index as a search bridge, data related to a specific relationship vector can be quickly located, reducing the comprehensive search of the entire knowledge graph library and optimizing the query performance. In the method of the embodiment of the present application, not only the similarity of the relationship data is considered, but also the target object data is combined, so that the search results are more comprehensive and can cover more dimensions. In this process, there is no need to consider whether the relationship between different items in the knowledge graph library is uniquely specified. There is no need to perform operations such as semantic alignment and normalization during the search. Therefore, the search efficiency is higher and the cost is lower. For the maintenance of the knowledge graph library, it is only necessary to add an index vector to the original knowledge graph library, without any other additional operations, the operation is simple, and subsequent maintenance is easier. And the method is easy to expand, and can easily adapt to new knowledge graph libraries or search requirements, enhancing the scalability and flexibility of the system. It can be applied to various types of knowledge graphs and search tasks and is widely used in different scenarios.

[0232] The embodiment of the present invention also provides a computer device having the above Figure 8 The knowledge graph construction device shown and Fig. 9 A non-deterministic relationship entry search device is shown.

[0233] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.

[0234] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include an integrated circuit. The integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0235] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0236] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0237] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0238] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.

[0239] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0240] The embodiment of the present invention also provides a computer-readable storage medium. The method provided in the above embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or is implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0241] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0242] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for searching non-deterministic relational items, characterized in that: The method comprises: Obtaining a search request, wherein the search request includes target relationship data and target object data; Performing vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data; According to the target relationship vector, a candidate relationship vector having similarity with the target relationship vector and a vector index to which the candidate relationship vector belongs are obtained from a pre-built knowledge graph library, wherein the vector index is an index generated based on the candidate relationship vector and identification information corresponding to relationship data used to generate the candidate relationship vector, and the relationship data represents the relationship between subject data and object data; According to the similarity between each of the candidate relationship vectors and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, an output result corresponding to the search request is obtained from the knowledge graph library, wherein the output result at least includes the subject data corresponding to the search request.

2. The method according to claim 1, characterized in that The step of obtaining an output result corresponding to the search request from the knowledge graph library according to the similarity between each of the candidate relationship vectors and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data specifically includes: According to the similarity between each of the candidate relationship vectors and the target relationship vector, selecting a target candidate relationship vector having a similarity value higher than a preset similarity value from the candidate relationship vectors; According to the vector index to which the target candidate relationship vector belongs, screening the candidate knowledge graph to which the vector index to which the target candidate relationship vector belongs is located from the knowledge graph library; Screening the candidate knowledge graphs according to the target object data to obtain a target knowledge graph; The main data is extracted from the target knowledge graph as the output result and output.

3. The method according to claim 2, characterized in that The output result also includes the relationship data included in the target knowledge graph, the similarity between the relationship vector included in the target knowledge graph and the target relationship vector, and the target relationship vector; After acquiring the target knowledge graph corresponding to the target candidate relationship vector from the knowledge graph library according to the target candidate relationship vector, the method further includes: Extracting first identification information corresponding to the target candidate relationship vector from the vector index to which the target candidate relationship vector belongs; Determining target candidate relationship data corresponding to the first identification information according to the first identification information; Generate a first data set according to the relationship data included in the target knowledge graph and the similarity between the relationship vector included in the target knowledge graph and the target relationship vector; Generate a second data set according to the relationship data included in the target knowledge graph; Generate a third data set based on the subject data extracted from the target knowledge graph; The first data set, the second data set, the third data set, and the target relationship vector are output as the output result.

4. A knowledge graph construction method, characterized in that: The method comprises: Obtaining entries of a knowledge graph to be constructed, wherein the entries include subject data, object data, and relationship data between the subject and the object; Performing vector conversion on the relational data to generate a relational vector corresponding to the relational data; respectively generating first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data; Creating a relationship vector index according to the third identification information, the relationship data and the relationship vector; Based on the subject data, the first identification information, the object data, the second identification information, the relationship data, the third identification information, and the relationship vector index, a knowledge graph is constructed, and the knowledge graph is added to a pre-constructed knowledge graph library.

5. The method according to claim 4, characterized in that The performing vector conversion on the relational data to generate a relational vector corresponding to the relational data specifically includes: The relational data is input into a pre-built vector conversion model, vector conversion is performed on the relational data, and a relational vector corresponding to the relational data is generated.

6. The method according to claim 5, characterized in that Before inputting the relational data into a pre-built vector conversion model, performing vector conversion on the relational data, and generating a relational vector corresponding to the relational data, the method further includes: Acquire a sample data set, wherein each sample data in the sample data set includes a plurality of different words with the same semantics; Multiple different words with the same semantics are input into the initial vector conversion model for iterative training until the word vector dimension generated by the trained vector conversion model reaches a preset dimension, and then the iterative training is stopped.

7. A non-deterministic relationship item search device, characterized in that: The device comprises: An acquisition module, used for acquiring a search request, wherein the search request includes target relationship data and target object data; A conversion module, used to perform vector conversion on the target relationship data to obtain a target relationship vector corresponding to the target relationship data; A processing module, configured to obtain, from a pre-built knowledge graph library, a candidate relationship vector having a similarity to the target relationship vector and a vector index to which the candidate relationship vector belongs, according to the target relationship vector, wherein the vector index is an index generated based on the candidate relationship vector and identification information corresponding to relationship data used to generate the candidate relationship vector, wherein the relationship data represents a relationship between subject data and object data; A screening module is used to obtain an output result corresponding to the search request from the knowledge graph library based on the similarity between each of the candidate relationship vectors and the target relationship vector, the vector index to which the candidate relationship vector belongs, and the target object data, wherein the output result at least includes the subject data corresponding to the search request.

8. A knowledge graph construction device, characterized in that: The device comprises: An acquisition module, used to acquire entries of a knowledge graph to be constructed, wherein the entries include subject data, object data, and relationship data between the subject and the object; A conversion module, used to perform vector conversion on the relational data to generate a relational vector corresponding to the relational data; A generating module, used to respectively generate first identification information corresponding to the subject data, second identification information corresponding to the object data, and third identification information corresponding to the relationship data; A creation module, configured to create a relationship vector index according to the third identification information, the relationship data and the relationship vector; A construction module is used to construct a knowledge graph based on the subject data, the first identification information, the object data, the second identification information, the relationship data, the third identification information, and the relationship vector index, and add the knowledge graph to a pre-constructed knowledge graph library.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the non-deterministic relationship item search method described in any one of claims 1 to 3, or executes the knowledge graph construction method described in any one of claims 4 to 6 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which are used to enable a computer to execute the non-deterministic relationship item search method described in any one of claims 1 to 3, or to execute the knowledge graph construction method described in any one of claims 4 to 6.