A graph database retrieval method and system fusing entity recognition technology

By using named entity recognition and graph database line graph construction methods, combined with word vectors and BiLSTM models, AQL query statements are generated, solving the problem of low query accuracy in existing technologies and achieving more efficient graph database interaction.

CN117194483BActive Publication Date: 2025-10-24XIAMEN MEIYABAIKE INFORMATION SECURITY RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311164601.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-11
Publication Date
2025-10-24
Estimated Expiration
2043-09-11

AI Technical Summary

Technical Problem

Existing Text2SQL technology has difficulty accurately linking question sentences with database table contents in complex situations where multiple clauses are output, resulting in low query accuracy.

Method used

Named entity recognition technology is used to extract entity information from natural language questions. A line graph is constructed using a graph database, and word vector models and BiLSTM models are used for feature representation. Finally, an encoder and decoder are used to generate AQL query statements.

Benefits of technology

It improves the execution accuracy of AQL query statements in graph databases and lowers the threshold for users to interact with graph databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194483B_ABST
    Figure CN117194483B_ABST
Patent Text Reader

Abstract

The application provides a graph database retrieval method and system fusing entity recognition technology, extracts entity information in a natural language question through a named entity recognition technology, clearly determines words in the natural language question that need to be associated with a database, further combines graph database content to construct a line graph, strengthens the association relationship between entities and graph data nodes, helps to refine the dependency relationship of the neighborhood nodes, and performs feature representation on the natural language question word sequence and the graph through a word vector model and a BiLSTM model, generates a feature tensor containing context information, and is beneficial to semantic analysis of the question and the database, finally, an encoder is used to enhance the representation of the dependency relationship in the graph node, and an AQL sequence is output through a decoder, which effectively improves the execution accuracy of the AQL query statement in the graph database and reduces the interaction threshold of the user and the graph database.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of graph databases, in particular to a graph database retrieval method and system fusing entity recognition technology. BACKGROUND

[0002] Text2SQL technology realizes the interaction between natural language and graph databases, and can help users easily query and analyze a large amount of data, reduce the technical cost of learning and using databases, and improve data query efficiency. Text2SQL requires the model to understand the user's input question and automatically convert it into a database query language. The initial implementation of Text2SQL is to design regular expressions to identify SQL types and extract components, which has high labor cost and high error rate, and the effect is not good. With the development of deep learning technology, researchers propose to use Seq2seq model to encode natural language through deep learning network, and then identify SQL types in a classification manner, and generate SQL statements through slot filling. In addition, using Attention mechanism or graph neural network can enhance the semantic analysis ability of the model, or through pointer network, syntax tree and other ways to improve the decoding effect, improve the syntax compliance and execution accuracy of SQL statements.

[0003] Currently, Text2SQL technology mainly uses the semantic vectors of tables or columns in the database table to extract possible values in SQL. It is difficult to accurately extract corresponding values in the output of complex multiple clauses. How to accurately link the question sentence with the database table content is still a problem to be solved. SUMMARY

[0004] To solve the above technical problems, the present application provides a graph database retrieval method fusing entity recognition technology, comprising:

[0005] S1, receiving a natural language question sentence proposed by a user, performing word segmentation on the natural language question sentence to obtain a word sequence, and extracting named entity information in the word sequence based on a named entity recognition model, the named entity information including names, place names, organizations, dates and times, and domain-related proper nouns;

[0006] S2, generating an initial graph through a graph database, adding the named entity information to the initial graph to construct an entity relationship graph, and constructing a line graph with all edges in the entity relationship graph as nodes;

[0007] S3, converting the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, converting the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splicing the plurality of feature tensors to obtain joint features;

[0008] S4, input the joint features into an encoder to obtain feature encodings;

[0009] S5, decode the feature encodings by a decoder to obtain an AQL sequence, select the graph node information with the maximum probability by a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement;

[0010] S6, execute the AQL query statement based on the graph database to obtain a query result.

[0011] In some specific embodiments, the named entity recognition model in step S1 comprises an LSTM+CRF model. The named entity model is used to analyze the natural language question and determine the words in the natural language question that need to be associated with the database.

[0012] In some specific embodiments, step S2 specifically comprises the following steps:

[0013] S21, generate an initial graph by a graph database, wherein the nodes in the initial graph are composed of table names and column names of the graph database, each table node and the corresponding column node are connected by an edge, and the total number of graph nodes is the sum of the number of tables and columns in the graph database;

[0014] S22, add the named entity information to the initial graph as a node, connect the named entity node and the matched content association node as an edge in response to the named entity information matching the content in the graph database, and obtain an entity relationship graph, wherein the total number of nodes in the entity relationship graph is the sum of the total number of nodes in the initial graph and the number of named entity information;

[0015] S23, construct a line graph by taking all edges in the entity relationship graph as nodes, and adjacent nodes in the line graph are a plurality of nodes connected by edges in the entity relationship graph. The line graph is used to depict the association relationship, thereby strengthening the association relationship between entities and graph data nodes and helping to refine the dependency relationship between adjacent nodes.

[0016] In some specific embodiments, step S3 specifically comprises the following steps:

[0017] S31, convert the nodes in the word sequence, the entity relationship graph and the line graph into word vectors by a pre-trained language model, and the word vectors are respectively represented as:

[0018]

[0019]

[0020]

[0021] wherein |Q| represents the maximum length of the word sequence, |G E | represents the total number of nodes in the entity relation graph, |L(G E )| represents the total number of nodes in the line graph, d represents the dimension of the word vector, represents the word vector feature of the i-th word in the word sequence, represents the word vector feature of the i-th node in the entity relation graph, represents the word vector feature of the i-th node in the line graph, which is obtained by calculating the average of the word vectors of the adjacent nodes constituting the node in the entity relation graph;

[0022] S32, the converted word vectors in the word sequence, the entity relation graph and the nodes in the line graph are converted by corresponding BiLSTM models to obtain feature tensors containing context information, and the feature tensors are respectively represented as:

[0023]

[0024]

[0025]

[0026] wherein d l represents the hidden layer dimension of the BiLSTM model, BiLSTM 1 , BiLSTM 2 and BiLSTM 3 represent three BiLSTM models with different parameters;

[0027] S33, all feature tensors are spliced to obtain joint features. By generating feature tensors containing context information, it is beneficial to the semantic analysis of the question and the database.

[0028] In some specific embodiments, the model of the encoder in step S4 includes an RGAT model. Using RGAT as the encoder enhances the representation of the dependency relationship in the graph node and outputs feature encoding.

[0029] In some specific embodiments, the model of the decoder in step S5 includes an LSTM model.

[0030] In some specific embodiments, the graph database includes an ArangoDB graph database.

[0031] According to the second aspect of the present application, a graph database retrieval system integrating entity recognition technology is provided, which comprises:

[0032] The named entity extraction module is configured to receive a natural language question sentence proposed by a user, perform word segmentation on the natural language question sentence to obtain a word sequence, and extract named entity information in the word sequence based on a named entity recognition model, the named entity information including a person name, a place name, an organization, a date and time, and a domain-related specific term.

[0033] The graph construction module is configured to generate an initial graph through a graph database, add the named entity information to the initial graph to construct an entity relationship graph, and construct a line graph with all edges in the entity relationship graph as nodes.

[0034] The feature tensor acquisition module is configured to convert the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, convert the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splice the plurality of feature tensors to obtain joint features.

[0035] The encoding module is configured to input the joint features into an encoder to obtain feature encoding.

[0036] The decoding module is configured to decode the feature encoding through a decoder to obtain an AQL sequence, select the graph node information with the maximum probability through a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement.

[0037] The execution module is configured to execute the AQL query statement based on the graph database to obtain a query result.

[0038] According to a third aspect of the present application, an electronic device is provided, comprising: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the implementation manners of the first aspect.

[0039] According to a fourth aspect of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, when the computer program is executed by a processor, the method described in any of the implementation manners of the first aspect is implemented.

[0040] The present application provides a graph database retrieval method and system fusing entity recognition technology, and the technical effect is that:

[0041] By extracting entity information in natural language questions through named entity recognition technology, the words in natural language questions that need to be associated with the database are determined, and a line graph is constructed by combining the content of the graph database to strengthen the association between entities and graph data nodes, which helps to refine the dependency relationship of the neighborhood nodes. And through the word vector model and BiLSTM model, the feature representation of the natural language question word sequence and the graph is generated, which helps the semantic analysis of the question and the database. Finally, the encoder enhances the representation of the dependency relationship in the graph node to output feature encoding, and the decoder outputs the AQL sequence, which effectively improves the execution accuracy of the AQL query statement in the graph database and reduces the interaction threshold between the user and the graph database. BRIEF DESCRIPTION OF DRAWINGS

[0042] The accompanying drawings are included to provide a further understanding of embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and, together with the description, serve to explain principles of the present application. Other embodiments and many of the intended advantages of the present application will be readily appreciated as the same becomes better understood by reference to the following detailed description when considered in connection with the accompanying drawings. The elements of the drawings are not necessarily to scale relative to each other. Like reference numerals designate corresponding similar parts.

[0043] Figure 1 is a flow chart of a graph database retrieval method fusing named entity recognition technology according to an embodiment of the present application;

[0044] Figure 2 is a process schematic diagram of constructing a line graph by fusing entity information according to a specific embodiment of the present application;

[0045] Figure 3 is a framework diagram of a graph database retrieval method fusing named entity recognition technology according to a specific embodiment of the present application;

[0046] Figure 4 is a framework diagram of a graph database retrieval system fusing named entity recognition technology according to an embodiment of the present application;

[0047] Figure 5 is a structural schematic diagram of a computer device of an electronic device suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0048] The present application will be further described below in conjunction with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related application, and not to limit the application. In addition, it should be noted that only the parts related to the application are shown in the drawings for ease of description.

[0049] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.

[0050] Figure 1 is a flowchart of a graph database retrieval method of a fusion entity recognition technology according to an embodiment of the present application. Referring to Figure 1 , the method comprises:

[0051] S1, receiving a natural language question sentence proposed by a user, performing word segmentation on the natural language question sentence to obtain a word sequence, and extracting named entity information in the word sequence based on a named entity recognition model, the named entity information including names, place names, organizations, dates and times, and domain-related proper nouns.

[0052] In the step S1, the named entity recognition model comprises an LSTM+CRF model. The named entity model is used to analyze the natural language question sentence and determine the words in the natural language question sentence that need to be associated with the database.

[0053] S2, generating an initial graph through a graph database, adding the named entity information to the initial graph to construct an entity relationship graph, and constructing a line graph with all edges in the entity relationship graph as nodes.

[0054] In the step S2, the initial graph is generated through a graph database, and the nodes in the initial graph are composed of table names and column names of the graph database. Figure 2 is a process schematic diagram of constructing a line graph by fusing entity information according to a specific embodiment of the present application. Referring to Figure 2 , the step S2 specifically comprises the following steps:

[0055] S21, generating an initial graph through a graph database, the nodes in the initial graph being composed of table names and column names of the graph database, each table node in the initial graph being connected with a corresponding column node through an edge, and the total number of graph nodes being the sum of the number of tables and columns in the graph database;

[0056] S22, adding the named entity information to the initial graph as nodes, connecting a named entity node with a matched content association node as an edge in response to the named entity information matching the content in the graph database, and obtaining an entity relationship graph, wherein the total number of nodes in the entity relationship graph is the sum of the total number of nodes of the initial graph and the number of named entity information;

[0057] S23, constructing a line graph with all edges in the entity relationship graph as nodes, and adjacent nodes in the line graph being a plurality of nodes connected by edges in the entity relationship graph. The line graph is used to depict the association relationship, to strengthen the association relationship between entities and graph data nodes, and to help refine the dependency relationship of the neighborhood nodes.

[0058] S3, converting the word sequence, the entity relation graph and the line graph into word vectors by a pre-trained language model, converting the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splicing the plurality of feature tensors to obtain joint features.

[0059] wherein step S3 specifically comprises the following steps:

[0060] S31, converting the word sequence, the entity relation graph and the nodes in the line graph into word vectors by a pre-trained language model, the word vectors being respectively represented as:

[0061]

[0062]

[0063]

[0064] wherein |Q| represents the maximum length of the word sequence, |G E | represents the total number of nodes in the entity relation graph, |L(G E )| represents the total number of nodes in the line graph, and d represents the dimension of the word vector. represents the word vector feature of the i-th word in the word sequence, represents the word vector feature of the i-th node in the entity relation graph, represents the word vector feature of the i-th node in the line graph, the word vector feature of the i-th node in the line graph being obtained by calculating the average of the word vectors of the adjacent nodes constituting the node in the entity relation graph.

[0065] S32, converting the word vectors converted from the word sequence, the entity relation graph and the nodes in the line graph respectively by corresponding BiLSTM models to obtain feature tensors containing context information, the feature tensors being respectively represented as:

[0066]

[0067]

[0068]

[0069] wherein d l represents the hidden layer dimension of the BiLSTM 1 , BiLSTM 2 and BiLSTM 3 represent three BiLSTM models with different parameters.

[0070] S33, splice all feature tensors to obtain joint features. By generating feature tensors containing context information, it is beneficial to the semantic analysis of the question and the database.

[0071] S4, input the joint features into an encoder to obtain feature encoding.

[0072] The model of the encoder in step S4 includes an RGAT model. Using RGAT as the encoder enhances the representation of the dependency relationship in the graph node and outputs feature encoding.

[0073] S5, decode the feature encoding through a decoder to obtain an AQL sequence, select the graph node information with the maximum probability through a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement.

[0074] The model of the decoder in step S5 includes an LSTM model.

[0075] S6, execute the AQL query statement based on the graph database to obtain a query result.

[0076] The graph database described above includes an ArangoDB graph database.

[0077] In one specific embodiment, a graph database retrieval method of a fusion entity recognition technology will be specifically described below:

[0078] The present application designs a graph database retrieval method of a fusion entity recognition technology for a graph database. The entity information in the natural language question is extracted through the named entity recognition technology, the words in the natural language question that need to be associated with the database are determined, and then a line graph is constructed combined with the content of the graph database to strengthen the association relationship between the entity and the graph data node, which is helpful to refine the dependency relationship of the neighborhood node. The feature of the natural language question word sequence and the graph is represented through the word vector model and the BiLSTM model, and the feature tensor containing the context information is generated, which is beneficial to the semantic analysis of the question and the database. Finally, the encoder enhances the representation of the dependency relationship in the graph node and outputs the feature encoding, and the decoder outputs the AQL sequence, which effectively improves the execution accuracy of the AQL query statement in the graph database and reduces the interaction threshold of the user and the graph database.

[0079] Figure 3 is a framework diagram of a specific graph database retrieval method of a fusion entity recognition technology of the present application, referring to Figure 3 The graph database retrieval method of a fusion entity recognition technology disclosed in this embodiment specifically includes the following steps:

[0080] Step 1: To enhance the semantic association capability, the present invention uses entity recognition technology to analyze natural language query sentences, extract named entities in the sentences, and guide the model to further mine the relationship information with entity-related data. First, define the named entity information to be identified, including names of people, places, organizations, dates and times, and domain-related proper nouns (such as music genres in the music field). Then, the natural language sentence asked by the user is segmented to obtain the word sequence Q = {q1,...,q |Q|}, the maximum sequence length is |Q|. Then select any entity recognition model (such as LSTM+CRF) to extract the entity information E={e1,...,e |E|}, the maximum number of entities extracted is |E|.

[0081] Step 2: To strengthen the description of the association between entities and database information, the present invention introduces a line graph to depict the association relationship. The line graph is constructed based on the entity and the graph database. (a) The graph generated by the graph database ArangoDB is denoted as G. The nodes in the graph are represented by the database table name T = {t1,...,t |T|} and column names C = {c1,...,c |C|}, each table is connected to the corresponding column by an edge, and the total number of graph nodes |G|=|T|+|C|.

[0082] (b) Add entity information as a node on the basis of graph G to determine whether the entity matches the content in the database. If there is a match, add an edge connection between the entity node and the related node to form graph G. E , the total number of nodes in the graph is |G E |=|G|+|E|.

[0083] (c) Figure G E All edges in the graph are used as nodes to construct the line graph L(G E ), adjacent nodes in the line graph are adjacent if and only if they are in the graph G E The corresponding edges are adjacent, and the number of nodes is expressed as |L(G E )|. Line graphs can directly reflect the structural information of the original graph data and can deeply mine the deep correlation information between entities and graph data from neighborhood nodes.

[0084] Step 3: Combine natural language question Q and graph G E With the line graph L(G E ) to construct a joint feature as the input feature of the encoder. First, select any PLM (Pre-trained Language Model, such as Bert, Elmo) to convert the word sequence, graph and line graph of the question into word vector representation.

[0085] WQ = PLM(Q)

[0086]

[0087]

[0088] wherein

[0089]

[0090]

[0091]

[0092] d denotes the dimension of word vector; denotes the word vector feature of the i-th word in the question; denotes the word vector feature of the i-th node n E in the graph G i ; denotes the word vector feature of the i-th node m E in the line graph |L(G i )|. The node feature in the line graph is obtained by averaging the word vectors of the two nodes n E , n i in the graph G i that constitute the line graph node m j ; The edge feature between m i and m j in the line graph is represented by the word vectors of the adjacent nodes of the two line graph nodes in the graph G E . As an example, the node features of nodes (1, 2) and (2, 3) in the line graph are The edge feature of nodes (1, 2) and (2, 3) is

[0093] After that, the word vector features of the question sequence, the graph nodes and the line graph nodes are respectively passed through 3 BiLSTM models to obtain the corresponding feature tensors, which contain rich context information.

[0094]

[0095]

[0096]

[0097] wherein d l denotes the hidden layer dimension of the BiLSTM model, BiLSTM 1 , BiLSTM 2 and BiLSTM3 BiLSTM models with three different parameters are represented;

[0098] Finally, the three types of feature tensors are spliced to form joint features as the input X of the encoder.

[0099]

[0100] Step four, obtain feature encoding through the encoder. Under the guidance of the Encoder-Decoder framework, the RGAT (Relational Graph Attention Network) model is selected as the encoder to deeply analyze the semantic information of natural language and graph database, learn the influence of neighboring nodes between different dependencies in the line graph, mine the association information of nodes, enhance the semantic analysis ability, and output feature encoding Z.

[0101] Z = RGAT (X, L (G E ))

[0102] Step five, generate AQL sequence through the decoder. The LSTM is selected as the decoder to decode the feature encoding into the AQL sequence. In order to ensure the correctness of the output AQL syntax, an AQL template with slot values can be defined in advance, and the AQL statement is generated by slot filling.

[0103] Y = LSTM (Z)

[0104] The state of the last hidden layer in the LSTM model is selected by the softmax activation function, and the graph node information with the maximum probability at the current time is selected as the output value, which is filled into the slot value template to generate the AQL query statement.

[0105] Step six, execute the generated AQL statement in ArangoDB and return the graph database query result.

[0106] The graph database retrieval method disclosed in the present application effectively improves the execution accuracy of the AQL query statement in the graph database and reduces the interaction threshold between the user and the graph database.

[0107] The following will be described with reference to Figure 4 , Figure 4Figure 1 is a framework diagram of a graph database retrieval system of a fusion entity recognition technology according to an embodiment of the present application. The system architecture includes: a named entity extraction module 401 configured to receive a natural language question sentence proposed by a user, perform word segmentation on the natural language question sentence to obtain a word sequence, and extract named entity information in the word sequence based on a named entity recognition model, the named entity information including names, place names, organizations, dates and times, and domain-related proper nouns; a graph construction module 402 configured to generate an initial graph through a graph database, add the named entity information to the initial graph to construct an entity relationship graph, and construct a line graph with all edges in the entity relationship graph as nodes; a feature tensor acquisition module 403 configured to convert the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, convert the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splice the plurality of feature tensors to obtain joint features; an encoding module 404 configured to input the joint features into an encoder to obtain feature encoding; a decoding module 405 configured to decode the feature encoding through a decoder to obtain an AQL sequence, select the graph node information with the maximum probability through a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement; and an execution module 406 configured to execute the AQL query statement based on the graph database to obtain a query result.

[0108] Reference will now be made to the following description Figure 5 which shows a structural schematic diagram of a computer system 500 suitable for implementing an electronic device according to an embodiment of the present application. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present application.

[0109] As shown in Figure 5 , the computer system 500 includes a central processing unit (CPU) 501 which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or programs loaded from a storage portion 509 into a random access memory (RAM) 504. In the RAM 504, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502 and the RAM 504 are connected to each other through a bus 505. An input / output (I / O) interface 506 is also connected to the bus 505.

[0110] The following components are connected to the I / O interface 506: an input section 507 including a keyboard, a mouse, etc.; an output section 508 including a display such as a liquid crystal display (LCD), and a speaker, etc.; a storage section 509 including a hard disk, etc.; and a communication section 510 including a network interface card such as a LAN card, a modem, etc. The communication section 510 performs a communication process via a network such as the Internet. A drive 511 is also connected to the I / O interface 506 as necessary. A removable recording medium 512 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 511 as necessary, so that a computer program read out therefrom is installed in the storage section 509 as necessary.

[0111] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable storage medium, the computer program comprising program code for performing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 510, and / or installed from the removable medium 512. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the methods of the present application are performed. It should be noted that the computer readable storage medium of the present application can be either a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, be - but is not limited to - an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device. In the present application, the computer readable signal medium can include a data signal that is propagated in baseband or as part of a carrier wave, in which the computer readable program code is carried. Such propagated data signal can take a variety of forms, including but not limited to electro-magnetic, optical or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the above.

[0112] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0113] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0114] The modules involved in the embodiments of the present application can be implemented in the form of software, or can be implemented in the form of hardware.

[0115] As another aspect, the present application also provides a computer readable storage medium, which can be included in the electronic device described in the above embodiments, or can exist independently without being assembled into the electronic device. The computer readable storage medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: receive a natural language question sentence proposed by a user, perform word segmentation on the natural language question sentence to obtain a word sequence, and extract named entity information in the word sequence based on a named entity recognition model, the named entity information including names, place names, organizations, dates and times, and domain-related proper nouns; generate an initial graph through a graph database, add the named entity information to the initial graph to construct an entity relationship graph, and construct a line graph with all edges in the entity relationship graph as nodes; convert the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, convert the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splice the plurality of feature tensors to obtain joint features; input the joint features into an encoder to obtain feature encodings; decode the feature encodings through a decoder to obtain an AQL sequence, select the graph node information with the maximum probability through a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement; and execute the AQL query statement based on the graph database to obtain a query result.

[0116] The above description is merely the preferred embodiments of the present application and the explanation of the applied technical principles. It should be understood by those skilled in the art that the scope of the application involved in the present application is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features can be replaced with the technical features disclosed in the present application (but not limited to) with similar functions to form technical solutions.

Claims

1. A graph database retrieval method integrating entity recognition technology, characterized in that: The method comprises the following steps: S1, receiving a natural language question sentence proposed by a user, performing word segmentation on the natural language question sentence to obtain a word sequence, and extracting named entity information in the word sequence based on a named entity recognition model, the named entity information including a person name, a place name, an organization, a date and time, and a domain-related proper noun; S2, generating an initial graph through a graph database, adding the named entity information to the initial graph to construct an entity relationship graph, and constructing a line graph with all edges in the entity relationship graph as nodes; S3, converting the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, converting the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splicing the plurality of feature tensors to obtain joint features; S4, inputting the joint features into an encoder to obtain feature encoding; S5, decoding the feature encoding through a decoder to obtain an AQL sequence, selecting the graph node information with the maximum probability through a softmax function, and filling the graph node information into a preset slot value template to obtain an AQL query statement; S6, executing the AQL query statement based on the graph database to obtain a query result. 2.The graph database retrieval method of fusing entity recognition technology according to claim 1, wherein, The named entity recognition model in step S1 comprises an LSTM+CRF model. 3.The method of claim 1, wherein, Step S2 specifically comprises the following steps: S21, generating an initial graph through a graph database, the nodes in the initial graph being composed of table names and column names of the graph database, each table node in the initial graph being connected to a corresponding column node through an edge, and the total number of graph nodes being the sum of the number of tables and columns in the graph database; S22, adding the named entity information to the initial graph as a node, connecting the named entity node to the matched content association node as an edge in response to the named entity information matching the content in the graph database, and obtaining an entity relationship graph, wherein the total number of nodes in the entity relationship graph is the sum of the total number of nodes in the initial graph and the number of named entity information; S23, constructing a line graph with all edges in the entity relationship graph as nodes, and adjacent nodes in the line graph being a plurality of nodes connected by edges in the entity relationship graph. 4.The method of claim 3, wherein, Step S3 specifically comprises the following steps: S31, converting the word sequence, the entity relationship graph and the nodes in the line graph into word vectors through a pre-trained language model, the word vectors being respectively represented as: wherein |Q| represents the maximum length of the word sequence, |G E | represents the total number of nodes in the entity relation graph, |L(G E )| represents the total number of nodes in the line graph, d represents the word vector dimension, W qi represents the word vector feature of the i-th word in the word sequence, represents the word vector feature of the i-th node in the entity relation graph, represents the word vector feature of the i-th node in the line graph, which is obtained by calculating the average of the word vectors of the adjacent nodes constituting the node in the entity relation graph; S32, respectively converting the word vectors converted from the word sequence, the entity relationship graph and the nodes in the line graph through corresponding BiLSTM models to obtain feature tensors containing context information, the feature tensors being respectively represented as: wherein d l represents the hidden layer dimension of the BiLSTM model, BiLSTM 1 , BiLSTM 2 and BiLSTM 3 represent three BiLSTM models with different parameters; S33, splicing all feature tensors to obtain joint features.

5. The graph database retrieval method of claim 1, wherein, The model of the encoder in step S4 comprises an RGAT model.

6. The graph database retrieval method of claim 1, wherein, The model of the decoder in step S5 comprises an LSTM model.

7. The graph database retrieval method of fusing entity resolution techniques according to any one of claims 1-6, wherein, The graph database comprises an ArangoDB graph database.

8. A graph database retrieval system that fuses entity resolution techniques, characterized in that, The system comprises: The named entity extraction module is configured to receive a natural language question sentence proposed by a user, perform word segmentation on the natural language question sentence to obtain a word sequence, and extract named entity information in the word sequence based on a named entity recognition model, the named entity information including a person name, a place name, an organization, a date and time, and a domain-related specific term; The graph construction module is configured to generate an initial graph through a graph database, add the named entity information to the initial graph to construct an entity relationship graph, and construct a line graph with all edges in the entity relationship graph as nodes; The feature tensor acquisition module is configured to convert the word sequence, the entity relationship graph and the line graph into word vectors through a pre-trained language model, convert the corresponding word vectors into a plurality of feature tensors containing context information based on a plurality of BiLSTM models, and splice the plurality of feature tensors to obtain joint features; The encoding module is configured to input the joint features into an encoder for encoding to obtain feature encodings; The decoding module is configured to decode the feature encodings through a decoder to obtain an AQL sequence, select graph node information with the maximum probability through a softmax function, and fill the graph node information into a preset slot value template to obtain an AQL query statement; The execution module is configured to execute the AQL query statement based on the graph database to obtain a query result.

9. An electronic device, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Graph structure query method and device and storage medium

    CN114647764A

  • System and method of managing knowledge for knowledge graphs

    US20230081891A1