CN112632106B - Knowledge graph query method, device, equipment and storage medium - Google Patents
Knowledge graph query method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN112632106B CN112632106B CN202011603861.0A CN202011603861A CN112632106B CN 112632106 B CN112632106 B CN 112632106B CN 202011603861 A CN202011603861 A CN 202011603861A CN 112632106 B CN112632106 B CN 112632106B
- Authority
- CN
- China
- Prior art keywords
- query
- entity
- attribute
- knowledge graph
- representing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 239000013598 vector Substances 0.000 claims description 45
- 238000004590 computer program Methods 0.000 claims description 10
- 238000012512 characterization method Methods 0.000 claims description 4
- 230000003993 interaction Effects 0.000 abstract description 10
- 238000010586 diagram Methods 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 3
- 238000013136 deep learning model Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
- G06F16/288—Entity relationship models
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a knowledge graph query method, a device, equipment and a storage medium, wherein the method comprises the following steps: receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph; acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result; and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results. According to the method and the device, the deep semantic understanding of the query sentence can be realized, and the question-answer interaction is further carried out by combining the knowledge graph, so that the intelligent question-answer interaction based on the knowledge graph can be effectively and accurately realized.
Description
Technical Field
The invention relates to the technical field of intelligent question and answer, in particular to a knowledge graph query method, a knowledge graph query device, knowledge graph query equipment and a knowledge graph storage medium.
Background
With the continuous development of artificial intelligence technology, the traditional knowledge acquisition mode based on search engines is more and more difficult to meet the requirement of people for acquiring information from the Internet; the intelligent question-answering system receives more and more attention because the search intention of the user is accurately captured, the natural language question of the user is understood, and the answer is directly returned to the user; the rapid development of the knowledge graph provides a high-quality knowledge source for the realization of the intelligent question-answering system, and directly promotes the development of the intelligent question-answering system in the industry field (such as customer service, finance and the like). The intelligent question-answering system comprises comprehensive knowledge in multiple fields such as information retrieval and a dialogue system, and the technical key of realizing the question-answering system is to realize deep semantic understanding of user questions and to perform question-answering interaction by combining a knowledge graph; therefore, how to realize the deep semantic understanding of the user problem and further combine the knowledge graph to perform question-answer interaction is a problem to be solved by the person skilled in the art.
Disclosure of Invention
The invention aims to provide a knowledge graph query method, a device, equipment and a storage medium, which can realize deep semantic understanding of query sentences and further perform question-answer interaction by combining a knowledge graph, so that intelligent question-answer interaction based on the knowledge graph can be effectively and accurately realized.
In order to achieve the above object, the present invention provides the following technical solutions:
a knowledge graph query method, comprising:
receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph;
acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result;
and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results.
Preferably, determining all entity categories serving as query conditions and all entity categories serving as query results in the query statement includes:
the probability of each entity category in the query statement as a query condition or query result is calculated according to the following formula:
wherein ,representing entity class T in the query statement i E as query conditions or as probabilities of query results q Representing a low-dimensional vector representation, W, of the query statement derived based on a transducer model T B T Respectively representing the characteristic vector and the offset of the transducer model;
and if the probability that any entity category in the query statement is used as a query condition or a query result is larger than a corresponding threshold value, determining that the any entity category is used as the query condition or the query result.
Preferably, the obtaining the attribute and the attribute value of each entity category as the query condition includes:
calculating attribute values as query conditions of each entity category as query conditions in the query statement according to the following formula:
wherein ,Pk Representing the probability that the character k in the query sentence is an attribute value as a query condition, E Q Representing a low-dimensional vector representation of the query statement derived based on BiLSTM-ATT-CRF model, E t1 Representing a low-dimensional vector representation of the entity class t1 as a query condition derived based on the BiLSTM-ATT-CRF model,representing the attribute p of entity class t1 1i Is characterized by a low-dimensional vector of concat () k Representing a stitching operation between low-dimensional vector representations, W V And feature vectors and offset b respectively representing BiLSTM-ATT-CRF model V ;
And if the probability that any character in the query statement is the attribute value serving as the query condition is larger than the corresponding threshold value, determining that the any character and the corresponding attribute are the attribute and the attribute value serving as the query condition.
Preferably, obtaining the attribute as the query result of each entity category as the query result includes:
the attribute as the query result of each entity category as the query result in the query statement is calculated according to the following formula:
wherein ,representing entity class P in the query statement 2i Probability of having an attribute as a query result, E' Q A low-dimensional vector representation representing the query statement based on a transducer model,/i>Representing entity class P based on a transducer model 2i Low-dimensional vector characterization of W P B P Feature vectors and offsets respectively representing a transducer modelAn amount of;
and if the probability that the attribute of any entity category in the query statement is used as the query result is larger than the corresponding threshold value, determining that the attribute is the attribute used as the query result.
Preferably, before constructing the query statement, the method further includes:
and converting different words representing the same meaning into unified words in the entity category, attribute and attribute value serving as the query condition and the entity category and attribute information serving as the query result.
Preferably, the query is performed in the knowledge graph by using the target sentence, and after a corresponding query result is obtained, the method further includes:
and displaying the query result.
Preferably, constructing the target sentence includes:
constructing a target sentence based on a cytoer grammar provided by the graph database.
A knowledge graph query device, comprising:
a determining module for: receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph;
an acquisition module for: acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result;
a query module for: and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results.
A knowledge graph query device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the knowledge graph query method as described in any one of the above when executing the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the knowledge graph querying method of any of the above.
The invention provides a knowledge graph query method, a device, equipment and a storage medium, wherein the method comprises the following steps: receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph; acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result; and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results. When the query of the query statement is needed to be realized in the knowledge graph, the entity category, the attribute of the entity category and the attribute corresponding attribute value of the attribute of the entity category which are used as query conditions are extracted from the query statement, and the entity category and the attribute of the entity category which are used as query results are extracted from the query statement, so that the query is performed in the knowledge graph by utilizing the statement containing the extracted information, and finally the result of the needed query is obtained. Therefore, the type and the characteristics of the result to be queried are extracted from the query statement, and the corresponding query is realized based on the type and the characteristics, so that the deep semantic understanding of the query statement can be realized, and the question-answer interaction is further carried out by combining the knowledge graph, so that the intelligent question-answer interaction based on the knowledge graph can be effectively and accurately realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a knowledge graph query method according to an embodiment of the present invention;
fig. 2 is a sample diagram of a knowledge graph in a knowledge graph query method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of calculating an attribute value as a query condition by using a BiLSTM-ATT-CRF model in a knowledge graph query method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of probability of calculating an attribute as a query result by using a transducer model in the knowledge graph query method according to the embodiment of the present invention;
fig. 5 is a schematic structural diagram of a knowledge graph query device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart of a knowledge graph query method provided by an embodiment of the present invention may specifically include:
s11: and receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph.
The implementation main body of the knowledge graph query method provided by the embodiment of the invention can be a corresponding knowledge graph query device which can be arranged in the intelligent question-answering system, so that the implementation main body of the knowledge graph query method can be a corresponding intelligent question-answering system.
Receiving a statement currently input by a user for realizing a knowledge graph query, namely a query statement Q, such as "what are products facing an individual investor and expected to have a annual income ratio of 3.5? "; and then, combining the pre-created knowledge graph K to obtain a set T of all entity categories contained in the knowledge graph K, and judging a set T1 of entity categories which are related to the entity category set T and serve as query conditions and a set T2 of entity categories which serve as query results in the query statement Q by utilizing a transducer model. The entity is an object which exists objectively and can be distinguished from each other, the entity category is different categories obtained by dividing all the entities in advance, for example, a personal investor is an entity, and the corresponding investor is an entity category; the query condition is the characteristics of the result to be queried, and the query result is the type of the result to be queried, such as what are "what are products facing the individual investors and the clients expect annual income rate to be 3.5%? The query condition includes that the investor is an individual investor, the annual income ratio is 3.5%, the entity category as the query condition includes the investor and the annual income ratio, the corresponding query result is the investment product which reaches the query condition, and the entity category as the query result is the investment product.
S12: the attribute and the attribute value of each entity category as the query condition are acquired, and the attribute of each entity category as the query result is acquired.
The attribute is information representing the characteristics of the entity category, and the attribute value is a specific value of the attribute, for example, the attribute of the investor can include name, age and the like, and the attribute value one-to-one correspondence can include personal investors, full 18 years and the like. After determining all entity categories as query conditions and all entity categories as query results in the query statement, the attribute set P of each entity category T1 in the set of entity categories T1 as query conditions can be obtained 1 Then, query statement Q and attribute p are combined by using BiLSTM-ATT-CRF model 1i (i.e. property set P 1 I-th attribute of (a) extracts a Condition value Condition-V of the query Condition i I.e., the attributes and attribute values of the entity class as query conditions. Simultaneously combining the set T2 of entity categories as query results to respectively acquire each entity category T in T2 2 Attribute set P of (2) 2 And judging the attribute of the entity class which can be used as the query result in the query statement Q by using a transducer model, namely, a query Target, and obtaining a corresponding set target_p.
S13: and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in a knowledge graph by using the target sentence to obtain corresponding query results.
Combining entity class set T1 and attribute p as query conditions 1i And extracted Condition value Condition-V i And constructing a query statement S of the knowledge graph by the entity class set T2 and the target_p serving as the query result, so that the query statement S simultaneously contains the characteristics of the result to be queried and the type of the result to be queried, and further, carrying out corresponding query in the knowledge graph based on the query statement S, thereby finally obtaining the result conforming to the content of the query statement.
When the query of the query statement is needed to be realized in the knowledge graph, the entity category, the attribute of the entity category and the attribute corresponding attribute value of the attribute of the entity category which are used as query conditions are extracted from the query statement, and the entity category and the attribute of the entity category which are used as query results are extracted from the query statement, so that the query is performed in the knowledge graph by utilizing the statement containing the extracted information, and finally the result of the needed query is obtained. Therefore, the type and the characteristics of the result to be queried are extracted from the query statement, and the corresponding query is realized based on the type and the characteristics, so that the deep semantic understanding of the query statement can be realized, and the question-answer interaction is further carried out by combining the knowledge graph, so that the intelligent question-answer interaction based on the knowledge graph can be effectively and accurately realized.
The method for querying the knowledge graph provided by the embodiment of the invention for determining all entity categories serving as query conditions and all entity categories serving as query results in query sentences can comprise the following steps:
the probability of each entity class in the query statement as a query condition or query result is calculated according to the following formula:
wherein ,representing entity class T in a query statement i E as query conditions or as probabilities of query results q Representing a low-dimensional vector representation of a query statement derived based on a transducer model, W T B T Respectively representing the characteristic vector and the offset of the transducer model (the characteristic vector and the offset are the corresponding parameters which are determined when the training of the transducer model is completed);
if the probability of any entity category in the query statement as the query condition or as the query result is larger than the corresponding threshold value, determining the any entity category as the query condition or the query result.
The embodiment of the application combines the knowledge graph K to obtain the set T of all entity categories contained in the knowledge graph K, and judges the set T1 of the query condition entity categories and the set T2 of the query result entity categories which are related to the entity category set T in the query statement Q by utilizing a transducer model. Specifically, a sample of the knowledge graph K is shown in fig. 2, in which two categories of entities are included, namely, a set T of entity categories is a set that can be expressed as:
t= { investor }, investor }
The transducer model is a semantic representation model based on an attribute mechanism, and is utilized to obtain semantic representation E of a query statement Q q Combining sigmod function to obtain entity category contained in query statement Q, wherein if the entity category in query statement Q is obtained by using the formula as query conditionIf the probability of the entity class in the query statement Q is larger than the corresponding threshold, the entity class is indicated as the query condition, and if the probability of the entity class in the query statement Q as the query result is larger than the corresponding threshold, the entity class is indicated as the query result, and the thresholds involved in the embodiment of the application can be set according to actual needs; for example, a query statement is "what are products facing a personal investor and the customer expects a annual income ratio of 3.5%? The entity category as the query condition in the query sentence is "investor".
The method for querying the knowledge graph provided by the embodiment of the invention for obtaining the attribute and the attribute value of each entity category serving as the query condition can comprise the following steps:
the attribute value as the query condition that each entity class as the query condition in the query statement has is calculated according to the following formula:
wherein ,Pk Representing the probability that the character k in the query sentence is an attribute value as a query condition, E Q Representing a low-dimensional vector representation of a query statement derived based on the BiLSTM-ATT-CRF model, E t1 Representing a low-dimensional vector representation of the entity class t1 as a query condition derived based on the BiLSTM-ATT-CRF model,representing the attribute p of entity class t1 1i Is characterized by a low-dimensional vector of concat () k Representing a stitching operation between low-dimensional vector representations, W V And feature vectors and offset b respectively representing BiLSTM-ATT-CRF model V (the feature vector and the offset are the corresponding parameters which are determined when the BiLSTM-ATT-CRF model training is completed); />
If the probability that any character in the query sentence is the attribute value as the query condition is greater than the corresponding threshold value, determining that the any character and the corresponding attribute are the attribute and the attribute value as the query condition.
Combining the obtained query condition entity category sets T1 to respectively obtain attribute sets P of each entity category T1 in the T1 1 By using BiLSTM-ATT-CRF model and combining user query statement Q and related attribute p 1i Extracting Condition value Condition-V i . Specifically, the attributes corresponding to the two entity categories "invested product" and "investor" obtained may be as follows:
TABLE 1 investor-related Properties
Table 2 investment product related attributes
A schematic diagram of calculating attribute values as query conditions of each entity category as query conditions in a query sentence by using BiLSTM-ATT-CRF model can be shown as figure 3, wherein Q is the query sentence input by a user, T1 is one entity category in the entity category set T1 as query conditions, and p 1i Attribute set P for entity class T1 1 Is included in the set of data. According to the method and the device, the probability of each character in the query statement serving as the attribute value of the query condition is calculated in sequence by utilizing the formula, if the probability is larger than the corresponding threshold value, the corresponding character is indicated to be the attribute value serving as the query condition, otherwise, the corresponding character is indicated to be not the attribute value serving as the query condition, and finally, the attribute value serving as the query condition and the attribute can be determined to be the attribute value serving as the query condition and the attribute. In short, when determining the attribute value and the attribute value as the query condition by using the above formula, for any attribute in each attribute of any entity class, extracting the attribute value corresponding to the any attribute from the query statement, if the query is possible, indicating that the any attribute and the attribute value are the attribute and the attribute value as the query condition, otherwise, indicating that the any attribute and the attribute value areThe attribute value is not an attribute or attribute value that is a query condition. For example: what are the query statements "personal investors facing and the customer expects a product with annual income ratio of 3.5%? "what are the inputs when calculating probabilities using the above formulas are" what are products facing an individual investor and whose clients expect annual income ratio to be 3.5%? When $ investor $ name ", the attribute value extracted is" personal investor ", and when the probability is calculated using the above formula, the input is" what are products facing personal investors and the customer expects a annual income percentage of 3.5%? When the $ annual income rate of the investment product is $ and the extracted attribute value is 3.5%, the condition for obtaining the query corresponding to the query statement is { investment, name = "personal investor", investment product $ annual income rate = "3.5%"; in this way, the attributes and attribute values of the entity class as query conditions can be determined in a simple and efficient manner.
The method for querying the knowledge graph provided by the embodiment of the invention for obtaining the attribute of each entity category serving as the query result, which is used as the query result, can comprise the following steps:
the attribute as the query result of each entity class as the query result in the query statement is calculated according to the following formula:
wherein ,representing entity class P in a query statement 2i Probability of having an attribute as a query result, E' Q A low-dimensional vector representation representing a query statement based on a transducer model,/A->Representing entity class P based on a transducer model 2i Low-dimensional vector characterization of W P B P Respectively represent the characteristic vector and offset (characteristic vector and offset) of the transducer modelAll are the corresponding parameters that have been determined when the transducer model training is completed);
if the probability that any entity class in the query statement has an attribute as a query result is greater than a corresponding threshold, the attribute is determined to be the attribute as the query result.
Combining the entity category set T2 of the query result to respectively acquire each entity category T in the T2 2 Attribute set P of (2) 2 Judging a query Target set target_p in the query statement Q by using a transducer model; the schematic diagram of calculating the probability of using the transform model to calculate the attribute of the entity class in the query statement as the query result may be as shown in fig. 4, if the calculated probability of using the attribute of the entity class in the query statement as the query result is greater than the corresponding threshold, it indicates that the attribute is the attribute that the result to be queried should have, that is, the query target, otherwise, it indicates that the attribute is not the attribute that the result to be queried should have, so that the attribute serving as the query result is accurately determined in the above manner.
The knowledge graph query method provided by the embodiment of the invention can further comprise the following steps before constructing a query sentence:
and converting different words representing the same meaning into unified words in the entity category, attribute and attribute value serving as the query condition and the entity category and attribute information serving as the query result.
In order to further facilitate analysis of corresponding information, in the embodiment of the present application, different terms having the same meaning in the entity category, attribute and attribute value serving as the query condition and the entity category and attribute serving as the query result may be replaced by corresponding unified terms, for example, "a bank" and "the line" may be replaced by "a bank", so as to implement unification of different terms having the same meaning, and facilitate subsequent operations such as analysis processing.
The knowledge graph query method provided by the embodiment of the invention utilizes the target sentence to query in the knowledge graph, and after obtaining the corresponding query result, the method can further comprise the following steps:
and displaying the query result.
After the results corresponding to the query sentences are queried, the results can be returned to the user in a mode of displaying the results, so that the external user can conveniently acquire, analyze and other operations on the information. Wherein the query statement is "what are products facing the individual investors and the clients expect annual income ratio of 3.5%? When the knowledge graph is shown in fig. 2, the query result is JC20201026001.
The knowledge graph query method provided by the embodiment of the invention constructs the target sentence, and can comprise the following steps:
constructing a target sentence based on a cytoer grammar provided by the graph database.
Combining entity class set T1 and attribute p as query conditions 1i And Condition value Condition-V i And constructing a query sentence of the knowledge graph, namely a Target sentence S, by using the entity class set T2 and the target_p as query results; and can be implemented according to the cytoer grammar employed by graph database neo4j when constructing the target statement, such as query statement "what are products facing the individual investors and the clients expect annual income rate of 3.5? The corresponding target sentence may then be:
MATCH (n 1: investment product) - [ r: purchasing object ] - > (n 2: personal investor)
WHERE n2. Name= "personal investors", n1. year conversion yield= "3.5%":
RETURN n1.name。
the method comprises the steps that a user inquiry statement and a knowledge graph are combined, and a model is utilized to identify an entity class set T1 of inquiry condition classes and an entity class set T2 of inquiry result classes in the inquiry statement; combining the obtained query condition entity category sets T1, respectively obtaining attribute sets P of each entity category T1 in the T1 1 By using BiLSTM-ATT-CRF model and combining user query statement Q and related attribute p 1i Extracting Condition value Condition-V i The method comprises the steps of carrying out a first treatment on the surface of the Combining the obtained query result entity category sets T2 to respectively obtain attribute sets P of each entity category T2 in T2 2 Judging a query Target set target_p in the query statement Q by using a transducer model; bonding ofEntity class set T1 of acquired query condition and related attribute p 1i And extracted Condition value Condition-V i And constructing a knowledge graph query statement S by the entity class set T2 and the target_p of the obtained query result, and further realizing the query in the knowledge graph based on the query statement S. Therefore, the method and the device can better mine the question-answer query elements in the user semantics by combining the deep learning model with the knowledge graph information; the semantic analysis process utilizes a deep learning model, and can be combined with actual application data to carry out data annotation, so that the model can be better fitted in an application scene to solve the problem more accurately; the information of the industry knowledge graph is directly introduced, the three-element information and the frame information in the knowledge graph are more directly adopted, and the utilization rate of the knowledge graph is higher; through deep understanding of the user query sentences, the query elements in the user question sentences are identified by using a deep learning model, and the identified query elements can be combined with query grammar of different data storage structures more effectively, so that the query sentences of the corresponding data storage structures can be generated more flexibly, and the query request is completed.
The embodiment of the invention also provides a knowledge graph query device, as shown in fig. 5, which may include:
a determining module 11, configured to: receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph;
an acquisition module 12 for: acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result;
a query module 13 for: and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in a knowledge graph by using the target sentence to obtain corresponding query results.
The knowledge graph query device provided by the embodiment of the invention, the acquisition module may include:
a first acquisition unit configured to: the probability of each entity class in the query statement as a query condition or query result is calculated according to the following formula:
wherein ,representing entity class T in a query statement i E as query conditions or as probabilities of query results q Representing a low-dimensional vector representation of a query statement derived based on a transducer model, W T B T Respectively representing the characteristic vector and the offset of the transducer model; if the probability of any entity category in the query statement as the query condition or as the query result is larger than the corresponding threshold value, determining the any entity category as the query condition or the query result.
The knowledge graph query device provided by the embodiment of the invention, the acquisition module may include:
a second acquisition unit configured to: the attribute value as the query condition that each entity class as the query condition in the query statement has is calculated according to the following formula:
wherein ,Pk Representing the probability that the character k in the query sentence is an attribute value as a query condition, E Q Representing a low-dimensional vector representation of a query statement derived based on the BiLSTM-ATT-CRF model, E t1 Representing a low-dimensional vector representation of the entity class t1 as a query condition derived based on the BiLSTM-ATT-CRF model,representing the attribute p of entity class t1 1i Is a low-dimensional vector representation of concat (.) k Representing a stitching operation between low-dimensional vector representations, W V And feature vectors and offset b respectively representing BiLSTM-ATT-CRF model V The method comprises the steps of carrying out a first treatment on the surface of the If the probability that any character in the query sentence is the attribute value as the query condition is greater than the corresponding threshold value, determining that the any character and the corresponding attribute are the attribute and the attribute value as the query condition.
The knowledge graph query device provided by the embodiment of the invention, the acquisition module may include:
a third acquisition unit configured to: the attribute as the query result of each entity class as the query result in the query statement is calculated according to the following formula:
wherein ,representing entity class P in a query statement 2i Probability of having an attribute as a query result, E' Q A low-dimensional vector representation representing a query statement based on a transducer model,/A->Representing entity class P based on a transducer model 2i Low-dimensional vector characterization of W P B P Respectively representing the characteristic vector and the offset of the transducer model; if the probability that any entity class in the query statement has an attribute as a query result is greater than a corresponding threshold, the attribute is determined to be the attribute as the query result.
The knowledge graph query device provided by the embodiment of the invention can further comprise:
the unified module is used for: before constructing a query sentence, converting different words representing the same meaning into unified words in entity category, attribute and attribute value serving as query conditions and entity category and attribute information serving as query results.
The knowledge graph query device provided by the embodiment of the invention can further comprise:
a display module for: and inquiring in the knowledge graph by utilizing the target sentence, and displaying the inquiring result after obtaining the corresponding inquiring result.
The knowledge graph query device provided by the embodiment of the invention, the query module can comprise:
a construction unit for: constructing a target sentence based on a cytoer grammar provided by the graph database.
The embodiment of the invention also provides knowledge graph query equipment, which can comprise:
a memory for storing a computer program;
and the processor is used for realizing the steps of any one of the knowledge graph query methods when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the computer program can realize the steps of any one of the knowledge graph query methods when being executed by a processor.
It should be noted that, for the description of the related parts in the knowledge graph query device, the device and the storage medium provided by the embodiment of the present invention, please refer to the detailed description of the corresponding parts in the knowledge graph query method provided by the embodiment of the present invention, and no further description is given here. In addition, the parts of the above technical solutions provided in the embodiments of the present invention, which are consistent with the implementation principles of the corresponding technical solutions in the prior art, are not described in detail, so that redundant descriptions are avoided.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. The knowledge graph query method is characterized by comprising the following steps of:
receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph;
acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result;
and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results.
2. The method of claim 1, wherein determining all entity categories in the query statement that are query conditions and all entity categories that are query results comprises:
the probability of each entity category in the query statement as a query condition is calculated according to the following formula:
wherein ,Trepresenting a set of all entity categories contained in the knowledge-graph,irepresenting a set of all entity categoriesTThe number corresponding to any one of the entity categories,representing the entity category in the query statement>Probability as query condition->A low-dimensional vector representation representing said query statement obtained by a Transformer based query condition discrimination model,/o>Is->Respectively representing the characteristic vector and the bias of the query condition discrimination model based on the transducer;
if any entity class in the query statementIf the probability as query condition is greater than the corresponding threshold value, determining the arbitrary entity class +.>The entity category as the query condition is obtained as all entity categories T1 as the query condition;
the probability of each entity category in the query statement as a query result is calculated according to the following formula:
wherein ,representing the entity category in the query statement>Probability as query result->A low-dimensional vector representation representing said query statement obtained by a Transformer based query result discrimination model,/o>Is->Respectively representing the characteristic vector and the offset of the query result discrimination model based on the transducer;
3. The method according to claim 2, wherein obtaining the attribute and the attribute value as the query condition included in each entity class as the query condition includes:
calculating attribute values as query conditions of each entity category as query conditions in the query statement according to the following formula:
wherein ,representing characters in the query statementkProbability of being attribute value as query condition, +.>A low-dimensional vector representation representing the query statement derived based on the BiLSTM-ATT-CRF model,/I>Representing the fact as query condition based on BiLSTM-ATT-CRF modelBody classtLow-dimensional vector characterization of 1 +.>Representing entity categoriest1 has an attribute ofLow-dimensional vector representation of->Representing a stitching operation between low-dimensional vector representations, < ->Is->Respectively representing the characteristic vector and the bias of the BiLSTM-ATT-CRF model;
and if the probability that any character in the query statement is the attribute value serving as the query condition is larger than the corresponding threshold value, determining the any character and the corresponding attribute as the attribute and the attribute value of the query condition.
4. A method according to claim 3, wherein obtaining attributes as query results that each entity class has as query results comprises:
the attribute as the query result of each entity category as the query result in the query statement is calculated according to the following formula:
wherein ,each entity category in the set T2 of query result entity categories representing the query statementt2, set of attributesP 2 Arbitrary property +.>Probability as query result->A low-dimensional vector representation representing the query statement based on a transducer model,/i>Representing the properties obtained based on the transducer model +.>Low-dimensional vector representation of->Is->Respectively representing the characteristic vector and the offset of the transducer model;
5. The method of claim 4, further comprising, prior to constructing the query statement:
and converting different words representing the same meaning into unified words in the entity category, attribute and attribute value serving as the query condition and the entity category and attribute information serving as the query result.
6. The method of claim 5, wherein the query is performed in the knowledge graph by using the target sentence, and after obtaining the corresponding query result, further comprising:
and displaying the query result.
7. The method of claim 6, wherein constructing the target sentence comprises:
constructing a target sentence based on a cytoer grammar provided by the graph database.
8. A knowledge graph query device, comprising:
a determining module for: receiving a query sentence currently input by a user, and determining all entity categories serving as query conditions and all entity categories serving as query results in the query sentence based on a pre-established knowledge graph;
an acquisition module for: acquiring attributes and attribute values which are used as query conditions and are possessed by each entity class which is used as a query condition, and acquiring attributes which are used as query results and are possessed by each entity class which is used as a query result;
a query module for: and constructing a target sentence by using the entity category, the attribute and the attribute value which are used as query conditions and the entity category and the attribute which are used as query results, and querying in the knowledge graph by using the target sentence to obtain corresponding query results.
9. A knowledge graph query device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the knowledge graph querying method according to any of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the knowledge-graph querying method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011603861.0A CN112632106B (en) | 2020-12-29 | 2020-12-29 | Knowledge graph query method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011603861.0A CN112632106B (en) | 2020-12-29 | 2020-12-29 | Knowledge graph query method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112632106A CN112632106A (en) | 2021-04-09 |
CN112632106B true CN112632106B (en) | 2023-05-23 |
Family
ID=75287558
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011603861.0A Active CN112632106B (en) | 2020-12-29 | 2020-12-29 | Knowledge graph query method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112632106B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113515640B (en) * | 2021-04-13 | 2024-07-12 | 北京捷通华声科技股份有限公司 | Query statement generation method and device |
CN113657102B (en) * | 2021-08-17 | 2023-05-30 | 北京百度网讯科技有限公司 | Information extraction method, device, equipment and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1482418A1 (en) * | 2003-05-28 | 2004-12-01 | Sap Ag | A data processing method and system |
CN103425714A (en) * | 2012-05-25 | 2013-12-04 | 北京搜狗信息服务有限公司 | Query method and system |
CN106557528A (en) * | 2015-09-30 | 2017-04-05 | 富士通株式会社 | Information processor and method |
CN107526812A (en) * | 2017-08-24 | 2017-12-29 | 北京奇艺世纪科技有限公司 | A kind of searching method, device and electronic equipment |
CN108268582A (en) * | 2017-07-14 | 2018-07-10 | 广东神马搜索科技有限公司 | Information query method and device |
CN110019844A (en) * | 2019-02-20 | 2019-07-16 | 众安信息技术服务有限公司 | A kind of insurance industry knowledge mapping question answering system construction method and device |
CN111309863A (en) * | 2020-02-10 | 2020-06-19 | 北京声智科技有限公司 | Natural language question-answering method and device based on knowledge graph |
CN111324609A (en) * | 2020-02-17 | 2020-06-23 | 腾讯云计算(北京)有限责任公司 | Knowledge graph construction method and device, electronic equipment and storage medium |
CN111666479A (en) * | 2019-03-06 | 2020-09-15 | 富士通株式会社 | Method for searching web page and computer readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8019783B2 (en) * | 2009-05-19 | 2011-09-13 | Oracle International Corporation | Search interface for finding data items of interest from a database system |
CN104636478B (en) * | 2015-02-13 | 2019-12-20 | 广州神马移动信息科技有限公司 | Information query method and equipment |
US10909156B2 (en) * | 2017-02-10 | 2021-02-02 | Microsoft Technology Licensing, Llc | Search and filtering of message content |
-
2020
- 2020-12-29 CN CN202011603861.0A patent/CN112632106B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1482418A1 (en) * | 2003-05-28 | 2004-12-01 | Sap Ag | A data processing method and system |
CN103425714A (en) * | 2012-05-25 | 2013-12-04 | 北京搜狗信息服务有限公司 | Query method and system |
CN106557528A (en) * | 2015-09-30 | 2017-04-05 | 富士通株式会社 | Information processor and method |
CN108268582A (en) * | 2017-07-14 | 2018-07-10 | 广东神马搜索科技有限公司 | Information query method and device |
CN107526812A (en) * | 2017-08-24 | 2017-12-29 | 北京奇艺世纪科技有限公司 | A kind of searching method, device and electronic equipment |
CN110019844A (en) * | 2019-02-20 | 2019-07-16 | 众安信息技术服务有限公司 | A kind of insurance industry knowledge mapping question answering system construction method and device |
CN111666479A (en) * | 2019-03-06 | 2020-09-15 | 富士通株式会社 | Method for searching web page and computer readable storage medium |
CN111309863A (en) * | 2020-02-10 | 2020-06-19 | 北京声智科技有限公司 | Natural language question-answering method and device based on knowledge graph |
CN111324609A (en) * | 2020-02-17 | 2020-06-23 | 腾讯云计算(北京)有限责任公司 | Knowledge graph construction method and device, electronic equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
Leveraging Linked Open Data to Automatically Answer Arabic Questions;Mohammad AI-Smadi 等;《IEEE Access》;20191127;第7卷;177122-177136 * |
基于图结构信息的知识表示学习方法研究;聂斌玲;《中国博士学位论文全文数据库 基础科学辑》;20200815;A002-7 * |
基于知识图谱的"一带一路"投资问答***构建;陈璟浩等;《图书情报工作》;20200628;第64卷(第12期);95-105 * |
Also Published As
Publication number | Publication date |
---|---|
CN112632106A (en) | 2021-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021000676A1 (en) | Q&amp;a method, q&amp;a device, computer equipment and storage medium | |
CN111538894B (en) | Query feedback method and device, computer equipment and storage medium | |
Tang et al. | Knowledge representation learning with entity descriptions, hierarchical types, and textual relations | |
CN111767408A (en) | Causal graph construction method based on integration of multiple neural networks | |
CN106934012A (en) | A kind of question answering in natural language method and system of knowledge based collection of illustrative plates | |
CN112148851A (en) | Construction method of medicine knowledge question-answering system based on knowledge graph | |
CN110705612A (en) | Sentence similarity calculation method, storage medium and system with mixed multi-features | |
CN111368049A (en) | Information acquisition method and device, electronic equipment and computer readable storage medium | |
WO2021218028A1 (en) | Artificial intelligence-based interview content refining method, apparatus and device, and medium | |
CN105843897A (en) | Vertical domain-oriented intelligent question and answer system | |
CN111611775B (en) | Entity identification model generation method, entity identification device and equipment | |
CN107402912B (en) | Method and device for analyzing semantics | |
CN112632106B (en) | Knowledge graph query method, device, equipment and storage medium | |
WO2022252636A1 (en) | Artificial intelligence-based answer generation method and apparatus, device, and storage medium | |
CN113076411B (en) | Medical query expansion method based on knowledge graph | |
CN110781681B (en) | Automatic first-class mathematic application problem solving method and system based on translation model | |
CN113590837A (en) | Deep learning-based food and health knowledge map construction method | |
CN112487202A (en) | Chinese medical named entity recognition method and device fusing knowledge map and BERT | |
WO2021061231A1 (en) | Semantic parsing of natural language query | |
CN113569023A (en) | Chinese medicine question-answering system and method based on knowledge graph | |
CN112632250A (en) | Question and answer method and system under multi-document scene | |
CN105117388A (en) | Intelligent robot interaction system | |
CN113409907A (en) | Intelligent pre-inquiry method and system based on Internet hospital | |
CN116303537A (en) | Data query method and device, electronic equipment and storage medium | |
CN111104481B (en) | Method, device and equipment for identifying matching field |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |