Fuzzy query method, device, equipment, medium and product

By semantic recognition and membership function matching of fuzzy query statements, the problem of being unable to handle relative quantifiers in the prior art is solved, efficient fuzzy query of graph databases is realized, and the accuracy and user experience of the query are enhanced.

CN114020806BActive Publication Date: 2024-12-20CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111277743.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2024-12-20
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

The existing fuzzy query method cannot be applied to fuzzy query containing relative quantifiers, and cannot effectively process relative quantifiers such as "most" and "almost nothing" input by user, which represent set proportions.

Method used

By obtaining the fuzzy query statement to be identified, semantic recognition is performed and split into words with fuzzy semantics and clear semantics, the preset membership function and membership range threshold for relative quantifier matching are determined, and local and global are determined in combination with adjacent clear semantics words Clarify the query scope and query the target data from the graph database.

Benefits of technology

Fuzzy queries containing relative quantifiers are realized, the accuracy and user experience of data query are improved, the relative quantifiers in user input can be effectively processed, and the query capabilities of the graph database are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114020806B_ABST
    Figure CN114020806B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of artificial intelligence technology, and specifically provides a fuzzy query method, device, equipment, medium and product, the method comprising: obtaining a fuzzy query statement to be identified; performing semantic recognition on the fuzzy query statement to be identified and splitting the fuzzy query statement to be identified into multiple words with fuzzy semantics and multiple words with clear semantics; determining a preset membership function and a preset membership range threshold that match each word with fuzzy semantics; determining a local clear query range corresponding to the word with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold; determining a global clear query range corresponding to the fuzzy query statement according to each local clear query range, words with clear semantics adjacent to relative quantifiers and other words with clear semantics, so as to perform a query. The fuzzy query method of the present invention can realize a fuzzy query including relative quantifiers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a fuzzy query method, device, equipment, medium and product. Background Art

[0002] With the advent of the big data era, the amount of data is growing exponentially, and users' demand for data query is also increasing. In the past, users used absolute words that can clearly indicate specific data to query data. Absolute words such as 2001 in time and the 10th in sequence can clearly indicate specific data. The method of querying with absolute words is very dependent on the user's understanding of the query content. If the user does not understand the specific content and only knows the approximate range, it is difficult to search for the desired data.

[0003] In order to solve the above problems, fuzzy query of graph database has become the main research direction of data query. Fuzzy query refers to the words with fuzzy meanings such as "approximately", "almost", "almost" etc. input by the user. Fuzzy words include fuzzification operators, mood operators, relative quantifiers, etc. By combining the words with fuzzy meanings with the absolute words input by the user, a more precise fuzzy range can be determined for the user to select the data to be queried.

[0004] However, the current fuzzy query method does not take into account relative quantifiers such as "mostly" and "almost none" that indicate the proportion of a set, and therefore cannot be applied to fuzzy queries with relative quantifiers. Summary of the invention

[0005] The present invention provides a fuzzy query method, device, equipment, medium and product, which are used to solve the problem that the current fuzzy query method cannot be applied to fuzzy queries with relative quantifiers.

[0006] A first aspect of the present invention provides a fuzzy query method, comprising:

[0007] Obtaining a fuzzy query statement to be identified;

[0008] Performing semantic recognition on the fuzzy query statement to be recognized and splitting the fuzzy query statement to be recognized into a plurality of words with fuzzy semantics and a plurality of words with clear semantics; the words with clear semantics are consistent with entities corresponding to nodes in the graph database; the words with fuzzy semantics include relative quantifiers;

[0009] Determining a preset membership function and a preset membership range threshold that match each of the words with fuzzy semantics;

[0010] Determining a local clear query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds;

[0011] Determining a global clear query scope corresponding to the fuzzy query statement according to each of the local clear query scopes, words with clear semantics adjacent to the relative quantifier, and other words with clear semantics;

[0012] The target data is queried from the graph database according to the global explicit query scope.

[0013] Further, in the method as described above, the other semantically explicit words include query target entities;

[0014] The determining of the global explicit query scope corresponding to the fuzzy query statement according to each of the local explicit query scopes, the words with explicit semantics adjacent to the relative quantifier and other words with explicit semantics includes:

[0015] Determine the total number of associated nodes required for the query corresponding to the nodes in the graph database that match the query target entity; wherein the associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier;

[0016] Determining the total number of associated nodes required for the query as a local explicit query range of words with explicit semantics adjacent to the relative quantifier;

[0017] Determine the data contained in the nodes in the other explicit semantics word correspondence graph database as the local explicit query scope of the other explicit semantics words;

[0018] The local explicit query scope of each word with fuzzy semantics, the local explicit query scope of the word with explicit semantics adjacent to the relative quantifier and the local explicit query scope of other words with explicit semantics are determined as the global explicit query scope corresponding to the fuzzy query statement.

[0019] Furthermore, in the method as described above, the words with fuzzy semantics further include: a mood operator;

[0020] The determining of the local explicit query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes:

[0021] If the word with fuzzy semantics is a mood operator, a preset membership range threshold matching the mood operator is determined as a first membership range threshold;

[0022] determining a first initial query range according to the first membership range threshold and a preset membership function matching the mood operator;

[0023] The first initial query range is defuzzified to determine a local explicit query range corresponding to the mood operator.

[0024] Furthermore, in the above method, if the word with fuzzy semantics is a relative quantifier, the determining of the local explicit query range corresponding to the word with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes:

[0025] The preset membership range threshold matching the relative quantifier is determined as the second membership range threshold; the preset membership function matching the relative quantifier is a linear membership function;

[0026] determining a second initial query range according to the second membership range threshold and the linear membership function;

[0027] The second initial query scope is defuzzified by using a reverse method to determine a local clear query scope corresponding to the relative quantifier.

[0028] Furthermore, in the method as described above, the words with fuzzy semantics further include: a fuzzification operator;

[0029] The determining of the local explicit query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes:

[0030] If the word with fuzzy semantics is a fuzzification operator, a preset membership range threshold matching the fuzzification operator is determined as a third membership range threshold;

[0031] Determining matching adjustment parameters and words with clear semantics adjacent to the fuzzy operator in the fuzzy query statement according to a preset membership function matching the fuzzy operator;

[0032] Taking the third membership range threshold as a boundary condition, the adjustment parameter and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are input into a preset membership function matching the fuzzification operator to output a local clear query range corresponding to the fuzzification operator.

[0033] Furthermore, in the above method, the preset membership function matching the fuzzification operator is:

[0034]

[0035] Among them, x represents a value in the local clear query range corresponding to the fuzzification operator, y represents the clear semantic words adjacent to the fuzzification operator, and δ represents the adjustment parameter.

[0036] A second aspect of the present invention provides a fuzzy query device, comprising:

[0037] An acquisition module, used for acquiring a fuzzy query statement to be identified;

[0038] A semantic recognition module, used for performing semantic recognition on the fuzzy query statement to be recognized and splitting the fuzzy query statement to be recognized into a plurality of words with fuzzy semantics and a plurality of words with clear semantics; the words with clear semantics are consistent with the entities corresponding to the nodes in the graph database; the words with fuzzy semantics include relative quantifiers;

[0039] A function determination module, used to determine a preset membership function and a preset membership range threshold that match each of the words with fuzzy semantics;

[0040] A local range determination module, used to determine the local clear query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds;

[0041] A global scope determination module, configured to determine a global explicit query scope corresponding to the fuzzy query statement according to each of the local explicit query scopes, the words with explicit semantics adjacent to the relative quantifier and other words with explicit semantics;

[0042] A query module is used to query target data from the graph database according to the global clear query scope.

[0043] Further, in the above-mentioned apparatus, the other semantically explicit words include query target entities;

[0044] The global scope determination module is specifically used for:

[0045] Determine the total number of associated nodes required for the query corresponding to the nodes in the graph database that match the query target entity; wherein the associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier; determine the total number of associated nodes required for the query as the local clear query scope of the words with clear semantics adjacent to the relative quantifier; determine the data contained in the nodes in the graph database corresponding to the other words with clear semantics as the local clear query scope of the other words with clear semantics; determine the local clear query scope of each word with fuzzy semantics, the local clear query scope of the words with clear semantics adjacent to the relative quantifier, and the local clear query scope of the words with other clear semantics as the global clear query scope corresponding to the fuzzy query statement.

[0046] Furthermore, in the above-mentioned device, the words with fuzzy semantics further include: a mood operator;

[0047] The local range determination module is specifically used for:

[0048] If the word with fuzzy semantics is a mood operator, the preset membership range threshold matching the mood operator is determined as the first membership range threshold; the first initial query range is determined according to the first membership range threshold and the preset membership function matching the mood operator; the first initial query range is defuzzified to determine the local clear query range corresponding to the mood operator.

[0049] Furthermore, in the above-mentioned device, if the word with ambiguous semantics is a relative quantifier, the local range determination module is specifically used to:

[0050] The preset membership range threshold matching the relative quantifier is determined as the second membership range threshold; the preset membership function matching the relative quantifier is a linear membership function; the second initial query range is determined according to the second membership range threshold and the linear membership function; the second initial query range is defuzzified by the reverse method to determine the local clear query range corresponding to the relative quantifier.

[0051] Furthermore, in the above-mentioned device, the words with fuzzy semantics further include: a fuzzification operator;

[0052] The local range determination module is specifically used for:

[0053] If the word with fuzzy semantics is a fuzzification operator, the preset membership range threshold matching the fuzzification operator is determined as the third membership range threshold; the matching adjustment parameters and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are determined according to the preset membership function matching the fuzzification operator; with the third membership range threshold as a boundary condition, the adjustment parameters and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are input into the preset membership function matching the fuzzification operator to output the local clear query range corresponding to the fuzzification operator.

[0054] Further, in the above device, the preset membership function matching the fuzzification operator is:

[0055]

[0056] Among them, x represents a value in the local clear query range corresponding to the fuzzification operator, y represents the clear semantic words adjacent to the fuzzification operator, and δ represents the adjustment parameter.

[0057] A third aspect of the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0058] The memory stores computer-executable instructions;

[0059] The processor executes the computer-executable instructions stored in the memory to implement the fuzzy query method as described in any one of the first aspects.

[0060] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the fuzzy query method described in any one of the first aspects.

[0061] A fifth aspect of the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the fuzzy query method described in any one of the first aspects.

[0062] The present invention provides a fuzzy query method, device, equipment, medium and product, the method comprising: obtaining a fuzzy query statement to be identified; performing semantic recognition on the fuzzy query statement to be identified and splitting the fuzzy query statement to be identified into multiple words with fuzzy semantics and multiple words with clear semantics; the words with clear semantics are consistent with the entities corresponding to the nodes in the graph database; the words with fuzzy semantics include relative quantifiers; determining a preset membership function and a preset membership range threshold that match each of the words with fuzzy semantics; determining a local clear query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range threshold; determining a global clear query range corresponding to the fuzzy query statement according to each of the local clear query ranges, the words with clear semantics adjacent to the relative quantifier and other words with clear semantics; querying target data from the graph database according to the global clear query range. The fuzzy query method of the present invention performs semantic recognition on the fuzzy query statement to be identified and splits it into multiple words with fuzzy semantics and multiple words with clear semantics. A matching membership function and a membership range threshold are preset for relative quantifiers, so as to determine the local clear query range corresponding to the relative quantifier. Then, the global clear query range corresponding to the fuzzy query statement is determined by combining the clear semantic words adjacent to the relative quantifier, each of the local clear query ranges, and other clear semantic words, so as to realize the fuzzy query including the relative quantifier. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0064] Figure 1 A scene graph that can implement the fuzzy query method of the embodiment of the present invention;

[0065] Figure 2 A schematic diagram of a fuzzy query method according to a first embodiment of the present invention;

[0066] Figure 3 A schematic diagram of a fuzzy query method according to a second embodiment of the present invention;

[0067] Figure 4 A schematic diagram of a linear membership function of a fuzzy query method provided in a second embodiment of the present invention;

[0068] Figure 5 A schematic diagram of the structure of a fuzzy query device provided in a third embodiment of the present invention;

[0069] Figure 6 A schematic structural diagram of an electronic device provided in a fourth embodiment of the present invention.

[0070] The above drawings have shown clear embodiments of the present invention, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0071] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0072] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0073] In order to clearly understand the technical solution of the present application, the relevant terms involved in the technical solution are first explained.

[0074] Fuzzy sets and membership functions:

[0075] A fuzzy subset A on the domain U is: All have μ A (x)∈[0,1] corresponds to it, where μ A (x) is called the membership function of the fuzzy subset A, or the membership degree of x to the fuzzy subset A.

[0076] By mapping:

[0077]

[0078] Determine a fuzzy subset A of the universe U.

[0079] The membership function is a quantitative description of fuzzy concepts. Correctly determining the membership function is the basis for using fuzzy set theory to solve practical problems. Typical fuzzy distributions include step type, exponential type, normal type, linear type, power function type, sine type, etc.

[0080] α cut set:

[0081] The membership function μ corresponding to all elements x in the domain U A A set whose values ​​of (x) are not less than α is called the α-cut set of the fuzzy set A.

[0082] Among them, α is the confidence level (threshold). A fuzzy set can be converted into a normal set using the α cutoff.

[0083] Mood Operator:

[0084] In fuzzy theory, words such as "relatively", "very", "slightly" in natural language are regarded as a kind of operator, called the mood operator H. λ The mood operator restricts the fuzzy semantics in terms of degree and changes the membership of the fuzzy semantics at different levels. For example, the fuzzy semantics "high" can be expressed as "very high", "relatively high", "a little high", etc. The mood operator is a transformation, that is: H λ A(X)=[A(X)] λ When λ>1, H λ is a centralization operator. When λ<1, H λ is the diffuse operator. Usually H 4 H means "extremely" 2 H means "very". 0.75 Indicates "comparison", H 0.5 It means "a little bit".

[0085] Words with fuzzy semantics such as "approximately", "nearly", and "almost" are often placed before a precise word or language variable to indicate a fuzzy range, which is called a fuzzification operator.

[0086] The degree of conformity of the fuzzy set:

[0087] Fuzzy queries on fuzzy data can be expressed by the degree of conformity of fuzzy sets. Let A and B be two fuzzy sets on the domain U, and μ A and μ B are their membership functions respectively. Then the degree of conformity between A and B is defined as:

[0088] The degree of conformity of A∪B = max{μ A (x), μ B (x)}

[0089] The degree of conformity of A∩B = min{μ A (x), μ B (x)}

[0090] A does not meet the degree of compliance = 1-μ A (x)

[0091] In order to more clearly understand the technical solution of the present application, the solution of the prior art is introduced in detail. When performing fuzzy query in the database, the conventional method is to perform fuzzy matching, which needs to be combined with regular expressions and is very limited. It is impossible to process fuzzy expressions in natural language such as "relatively high" and "a little low". In order to solve the problem of this type of fuzzy query, a lot of research has been done at home and abroad using fuzzy mathematics theory.

[0092] First, most current research focuses on relational databases. However, with the advent of the big data era, the amount of data is growing exponentially, and the data format is beginning to shift to unstructured data. Relational databases have become difficult to construct, store, and process such a large amount of data. Graph databases such as Neo4j do not need to store structured data in tables, but only need to connect all nodes through relationships and store them in the form of a network. All nodes are formed into a large graph through relationships, which makes it very easy to add, delete, and search for data nodes and relationships.

[0093] However, the current fuzzy query method for graph databases does not take into account relative quantifiers such as "mostly" and "almost none" that represent the proportion of a set. Therefore, it cannot be applied to fuzzy queries with relative quantifiers.

[0094] Therefore, in view of the problem that the fuzzy query method in the prior art cannot be applied to fuzzy queries with relative quantifiers, the inventors found in their research that in order to solve this problem, a membership function matching the relative quantifier can be pre-set. After many studies and attempts, the inventors found that the linear membership function is more suitable for relative quantifiers. At the same time, when determining the global clear query range containing relative quantifiers, the inventors also found differences from the fuzzy query method in the prior art.

[0095] Specifically, first obtain the fuzzy query statement to be identified, and perform semantic identification on the fuzzy query statement to be identified, so as to split the fuzzy query statement to be identified into multiple words with fuzzy semantics and multiple words with clear semantics. The words with clear semantics are consistent with the entities corresponding to the nodes in the graph database. The words with fuzzy semantics include relative quantifiers. Then determine the preset membership function and the preset membership range threshold that match each word with fuzzy semantics, and determine the local clear query range corresponding to the words with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold. Finally, determine the global clear query range corresponding to the fuzzy query statement according to each local clear query range, the words with clear semantics adjacent to the relative quantifier, and other words with clear semantics to query the target data, thereby realizing a fuzzy query including relative quantifiers.

[0096] Based on the above creative findings, the inventor proposed the technical solution of the present application.

[0097] The following is an introduction to the application scenarios of the fuzzy query method provided by the embodiment of the present invention. Figure 1 As shown, 1 is an electronic device, 2 is a terminal device, and 3 is a graph database cluster. The network architecture of the application scenario corresponding to the fuzzy query method provided in the embodiment of the present invention includes: electronic device 1, terminal device 2 and graph database cluster 3. Database cluster 3 includes multiple graph databases, such as graph database A, graph database B...graph database N, and terminal device 2 can be an electronic device such as a computer, a server, or a mobile phone.

[0098] When a user needs to perform a fuzzy query, a fuzzy query statement can be sent to the electronic device 1 through the terminal device 2. The fuzzy query statement is such as movies about 1997 in which the actor is so-and-so. When the electronic device 1 receives the fuzzy query statement sent by the terminal device 2, it performs semantic recognition on the fuzzy query statement to be recognized and splits the fuzzy query statement to be recognized into multiple words with fuzzy semantics and multiple words with clear semantics. Among them, the words with clear semantics are consistent with the entities corresponding to the nodes in the graph database. Words with fuzzy semantics include relative quantifiers.

[0099] At the same time, the electronic device 1 determines the preset membership function and the preset membership range threshold that match each word with fuzzy semantics, and determines the local clear query range corresponding to the word with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold. Finally, the electronic device 1 determines the global clear query range corresponding to the fuzzy query statement according to each local clear query range, the words with clear semantics adjacent to the relative quantifier and other words with clear semantics, so as to query the target data from the graph database according to the global clear query range. Assuming that the target data is located in the graph database A in the graph database cluster 3, the target data will be obtained from the graph database A. After querying the target data, the electronic device 1 feeds the target data back to the terminal device 2 for the user to view and process.

[0100] The embodiments of the present invention are described below in conjunction with the accompanying drawings.

[0101] Figure 2 A schematic diagram of a fuzzy query method provided by the first embodiment of the present invention is shown in FIG. Figure 2 As shown, in this embodiment, the execution subject of the embodiment of the present invention is a fuzzy query device, which can be integrated in an electronic device. The fuzzy query method provided by this embodiment includes the following steps:

[0102] It should be noted that graph databases store unstructured data. Based on directed graph theory, the three data elements of graph databases are:

[0103] Node: A record in the graph data. Nodes can define attributes and types.

[0104] Relationship: Edges used to connect nodes, directed.

[0105] Attribute: Also called the value of data, both nodes and relationships can have attributes.

[0106] Step S101, obtaining a fuzzy query statement to be identified.

[0107] In this embodiment, the fuzzy query statement is such as movies about 1997, actors about 40 years old who have played in about 5 movies, most of the music is written by a certain music production company, etc. The fuzzy query statement to be identified can be input by the user through the user terminal, or directly input through an electronic device that can execute the fuzzy query method, which is not limited in this embodiment.

[0108] Step S102, semantic recognition is performed on the fuzzy query statement to be recognized and the fuzzy query statement to be recognized is split into a plurality of words with fuzzy semantics and a plurality of words with clear semantics. The words with clear semantics are consistent with the entities corresponding to the nodes in the graph database. The words with fuzzy semantics include relative quantifiers.

[0109] In this embodiment, semantic recognition is performed on the fuzzy query sentence to be recognized, so that each word in the fuzzy query sentence can be determined. For example, for movies about 1997, the word about with fuzzy semantics and the words 1997 and movies with clear semantics can be recognized. If it is a fuzzy query sentence containing relative quantifiers, such as the movie that most of the music is written by a certain music production company, the words with fuzzy semantics and the majority of the relative quantifiers can be recognized, and the words music, a certain music production company, and movies with clear semantics can be recognized.

[0110] The graph database stores data according to nodes, and words with clear semantics are generally consistent with the entities corresponding to the nodes in the graph database. That is, the above-mentioned movies, music, and a music production company can all be stored as node data in the graph database.

[0111] Step S103, determining a preset membership function and a preset membership range threshold that match each word with fuzzy semantics.

[0112] In this embodiment, the words with fuzzy semantics are divided into multiple types, such as fuzzification operators, mood operators, relative quantifiers, etc. For each word with fuzzy semantics, a matching membership function is preset. For example, the mood operator can use a parabolic membership function, the fuzzification operator can use a similar fuzzy relationship function, and the relative quantifier can use a linear membership function. At the same time, the same kind of words with fuzzy semantics can also use different membership functions, and the values ​​of the membership functions can also be different.

[0113] The preset membership range threshold is to determine a membership range for the membership function. Since the value of the membership function is between 0 and 1, when the preset membership range threshold is set to 0.5, the range where the membership function is less than or equal to 0.5 represents the α cutoff of the fuzzy set. The α cutoff can be used to determine the local clear query range corresponding to the fuzzy semantic words.

[0114] Step S104: determining a local explicit query range corresponding to the words with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold.

[0115] According to each preset membership function and the corresponding preset membership range threshold, the α cutoff representing the fuzzy set can be determined first. Assume that the α cutoff is the range where the membership function is less than or equal to 0.5, and the membership function is μ most (x)=2x, then it can be determined that x is less than or equal to 0.25 as the determined local clear query range.

[0116] Step S105 , determining a global explicit query scope corresponding to the fuzzy query statement according to each local explicit query scope, words with explicit semantics adjacent to the relative quantifier, and other words with explicit semantics.

[0117] In this embodiment, after determining each local clear query range, the data of the graph database node corresponding to the clear semantics word can be obtained through the clear semantics words, thereby determining the data range in the graph database to be queried, that is, the global clear query range. At the same time, when the words with fuzzy semantics contain relative quantifiers, since the graph database may not store the data range as a node, the global clear query range to be searched may need to obtain part of the data from the nodes of the graph database and combine them to obtain the data range in the graph database to be queried. Therefore, it is necessary to combine the clear semantics words adjacent to the relative quantifiers and other clear semantics words to determine the global clear query range.

[0118] For example, if the fuzzy query statement is "movies in which most actors have experience", the graph database stores data according to the two nodes of actor and movie. Most of these relative quantifiers need to consider the direct relationship between actors and movies, that is, the number of actors in the movie needs to be considered. However, the graph database does not have data nodes for actors in movies. Therefore, it is necessary to determine the data corresponding to the number of actors through the two nodes of actor and movie, so as to determine the global and clear query scope.

[0119] Step S106, querying the target data from the graph database according to the global clear query scope.

[0120] In this embodiment, after the global explicit query range is determined, for example, the global explicit query range is determined to be movies with three actors from 1990 to 1995, the global explicit query range can be used to query from the graph database.

[0121] A fuzzy query method provided by an embodiment of the present invention comprises: obtaining a fuzzy query statement to be identified. Performing semantic identification on the fuzzy query statement to be identified and splitting the fuzzy query statement to be identified into a plurality of words with fuzzy semantics and a plurality of words with clear semantics. The words with clear semantics are consistent with the entities corresponding to the nodes in the graph database. The words with fuzzy semantics include relative quantifiers. Determine a preset membership function and a preset membership range threshold that match each word with fuzzy semantics. Determine a local clear query range corresponding to the words with fuzzy semantics based on each preset membership function and the corresponding preset membership range threshold. Determine a global clear query range corresponding to the fuzzy query statement based on each local clear query range, words with clear semantics adjacent to the relative quantifier and other words with clear semantics. Query target data from the graph database based on the global clear query range.

[0122] The fuzzy query method of the present invention performs semantic recognition on a fuzzy query sentence to be recognized, and splits it into a plurality of words with fuzzy semantics and a plurality of words with clear semantics. A matching membership function and a membership range threshold are preset for relative quantifiers, so as to determine a local clear query range corresponding to the relative quantifier. Then, the global clear query range corresponding to the fuzzy query sentence is determined by combining the words with clear semantics adjacent to the relative quantifier, each local clear query range, and other words with clear semantics, so as to realize a fuzzy query including the relative quantifier.

[0123] Figure 3 A flow chart of a fuzzy query method provided by the second embodiment of the present invention is shown in FIG. Figure 3 As shown, the fuzzy query method provided in this embodiment is a further refinement of the fuzzy query method provided in the previous embodiment of the present invention. The fuzzy query method provided in this embodiment includes the following steps.

[0124] Step S201, obtaining a fuzzy query statement to be identified.

[0125] In this embodiment, the implementation of step 201 is similar to the implementation of step 101 in the previous embodiment of the present invention, and will not be described in detail here.

[0126] Step S202 : semantically identifying the fuzzy query statement to be identified and splitting the fuzzy query statement to be identified into a plurality of words with fuzzy semantics and a plurality of words with clear semantics.

[0127] In this embodiment, the implementation of step 202 is similar to the implementation of step 102 in the previous embodiment of the present invention, and will not be described in detail here.

[0128] Step S203: determining a preset membership function and a preset membership range threshold that match each word with fuzzy semantics.

[0129] In this embodiment, the implementation of step 203 is similar to the implementation of step 103 in the previous embodiment of the present invention, and will not be described in detail here.

[0130] Step S204: determining a local explicit query range corresponding to the words with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold.

[0131] In this embodiment, the implementation of step 204 is similar to the implementation of step 104 in the previous embodiment of the present invention, and will not be described in detail here.

[0132] Words with fuzzy semantics may include mood operators, relative quantifiers, fuzzification operators, and the like.

[0133] Optionally, in this embodiment, if the word with ambiguous semantics is a mood operator, a preset membership range threshold matching the mood operator is determined as the first membership range threshold.

[0134] A first initial query range is determined according to a first membership range threshold and a preset membership function that matches the mood operator.

[0135] The first initial query range is defuzzified to determine a local explicit query range corresponding to the mood operator.

[0136] Meanwhile, if the word with fuzzy semantics is a relative quantifier, the preset membership range threshold matching the relative quantifier is determined as the second membership range threshold. The preset membership function matching the relative quantifier is a linear membership function.

[0137] The second initial query range is determined according to the second membership range threshold and the linear membership function.

[0138] The second initial query scope is defuzzified by using the reverse method to determine the local clear query scope corresponding to the relative quantifier.

[0139] If the word with fuzzy semantics is a fuzzification operator, the preset membership range threshold matching the fuzzification operator is determined as the third membership range threshold.

[0140] According to the preset membership function matching the fuzzification operator, the matching adjustment parameters and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query sentence are determined.

[0141] Taking the third membership range threshold as the boundary condition, the adjustment parameters and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are input into the preset membership function matching the fuzzification operator to output the local clear query range corresponding to the fuzzification operator.

[0142] For example, a fuzzy query sentence is used as an example of movies around 1998 in which most of the actors are very experienced.

[0143] By performing semantic recognition on fuzzy query sentences, we can determine that the words with fuzzy semantics are "approximately", "the vast majority", and "very experienced", and the words with clear semantics are "1998", "actor", and "movie".

[0144] "Approximately" belongs to the fuzzification operator. For example, if you want to query "movies released in approximately 1998", 1998 is a specific value, but adding "approximately" makes the word fuzzy. For the fuzzification operator "approximately", a similar fuzzy relationship function in a membership function can be used to adjust the fuzzy range. The similar fuzzy relationship function is as follows:

[0145]

[0146] Among them, x represents a value in the local clear query range corresponding to the fuzzification operator, y represents the word with clear semantics adjacent to the fuzzification operator, that is, 1998, and δ represents the adjustment parameter (δ>0).

[0147] Assuming that the membership range threshold here is 0.5, that is, E(x, y) ≥ 0.5, the specific range obtained by calculation is:

[0148] In this example, assuming δ=10, the query year is approximately 1998, and this fuzzy query can be converted into a local clear query range of years between 1990 and 2006.

[0149] "The vast majority" belongs to relative quantifiers. For relative mood quantifiers, a simple linear membership function is used, such as Figure 4 As shown, the horizontal axis is the proportion and the vertical axis is the degree of membership:

[0150]

[0151] Among them, x represents the proportion of qualified conditions under the group. It is generally believed that the proportion exceeds 5 / 6, which must belong to the "vast majority", so the membership degree is set to 1. Select the membership range threshold α = 0.9, and use the reverse method to defuzzify, and the fuzzy condition of "vast majority" can be converted into a local clear query range: x ≥ 0.8.

[0152] "Very experienced" is the tone operator, and the parabolic membership function is used:

[0153]

[0154] Among them, x represents the total number of movies that an actor has participated in. It is generally believed that if the total number of movies participated in is more than 4, it must be "very experienced", so the membership degree is set to 1. Selecting the threshold α = 16 / 25 and using the reverse method to defuzzify, it can be obtained that "very experienced" can be converted into a local clear query range: x ≥ 3.

[0155] The local clear query scope obtained from the above three parts and combined with words with clear semantics can get the final query scope, that is, the global clear query scope is:

[0156] Release year is between 1990 and 2006, the actor has played at least three roles in the film, and the proportion of the group meeting the filter criteria is greater than or equal to 0.8.

[0157] Since the graph database does not have the attribute of total number of actors, and this attribute is needed when querying. In this embodiment, Neo4j is used as an example of graph database. Since Cypher statements in Neo4j graph database do not support nested queries like SQL statements, the WITH statement can be used to obtain the number of associations between movies and actors, that is, to obtain the data of total number of actors corresponding to the movies, and then the SET statement can be used to batch add the value of this attribute.

[0158] Finally, query the required data in the graph database by globally specifying the query scope.

[0159] So far, by splitting the complex fuzzy query statements and defuzzifying them based on different membership functions and α cut-offs, we have obtained the global clear query scope of the fuzzy query statements. Through the grouping and aggregation of the WITH statement of the graph database and the batch setting of attributes by SET, we have overcome the problem that the Cypher statement in the graph database does not support nested queries of non-nodes, thus realizing the grouped fuzzy query of the Neo4j graph database.

[0160] Step S205, determining the total number of associated nodes required for the query corresponding to the nodes in the graph database that match the query target entity. Among them, other words with clear semantics include: query target entity. The associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier.

[0161] In this embodiment, the query target entity is the entity that the user wants to query. For example, if the user wants to query bicycles produced in 1981, the bicycle is the query target entity.

[0162] Assuming that the fuzzy query statement is that most bicycle areas are green, the query target entity is the bicycle, and the data will be stored according to the bicycle node in the graph database. The total number of associated nodes required for the query is the color of the bicycle area.

[0163] Step S206: determine the total number of associated nodes required for the query as the local explicit query range of the words with explicit semantics adjacent to the relative quantifier.

[0164] In this embodiment, since relative quantifiers represent proportional relationships, the data range that needs to be queried includes the data attribute of the number of associated nodes required for the query corresponding to the query target entity. Therefore, the total number of associated nodes required for the query is determined as the local clear query range of the words with clear semantics adjacent to the relative quantifiers.

[0165] Step S207 , determining the data contained in the nodes in the other explicit semantic words correspondence graph database as the local explicit query scope of the other explicit semantic words.

[0166] Step S208 , determining the local clear query scope of each word with fuzzy semantics, the local clear query scope of words with clear semantics adjacent to the relative quantifier, and the local clear query scope of other words with clear semantics as the global clear query scope corresponding to the fuzzy query statement.

[0167] In this embodiment, the global explicit query scope is composed of the local explicit query scope of the words with ambiguous semantics and the local explicit query scope of the words with explicit semantics.

[0168] Step S209, query the target data from the graph database according to the global clear query scope.

[0169] In this embodiment, the implementation of step 209 is similar to the implementation of step 106 in the previous embodiment of the present invention, and will not be described in detail here.

[0170] Figure 5 A schematic diagram of the structure of a fuzzy query device provided in the third embodiment of the present invention is shown in FIG. Figure 5 As shown, in this embodiment, the fuzzy query device 300 includes:

[0171] The acquisition module 301 is used to acquire the fuzzy query sentence to be identified.

[0172] The semantic recognition module 302 is used to perform semantic recognition on the fuzzy query statement to be recognized and split the fuzzy query statement to be recognized into multiple words with fuzzy semantics and multiple words with clear semantics. The words with clear semantics are consistent with the entities corresponding to the nodes in the graph database. The words with fuzzy semantics include relative quantifiers.

[0173] The function determination module 303 is used to determine a preset membership function and a preset membership range threshold that match each word with fuzzy semantics.

[0174] The local range determination module 304 is used to determine the local explicit query range corresponding to the words with fuzzy semantics according to each preset membership function and the corresponding preset membership range threshold.

[0175] The global scope determination module 305 is used to determine the global explicit query scope corresponding to the fuzzy query statement according to each local explicit query scope, the words with explicit semantics adjacent to the relative quantifier and other words with explicit semantics.

[0176] The query module 306 is used to query the target data from the graph database according to the global clear query scope.

[0177] The fuzzy query device provided in this embodiment can be executed Figure 2 The technical solution of the method embodiment shown in the figure has the same implementation principle and technical effect as Figure 2The method embodiments shown are similar and will not be described in detail here.

[0178] The fuzzy query device provided by the present invention is a further refinement of the fuzzy query device provided by the previous embodiment.

[0179] Optionally, in this embodiment, other words with clear semantics include the query target entity.

[0180] The global scoping module is specifically used for:

[0181] Determine the total number of associated nodes required for the query corresponding to the nodes in the graph database that match the query target entity. Among them, the associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier. The total number of associated nodes required for the query is determined as the local clear query scope of the words with clear semantics adjacent to the relative quantifier. The data contained in the nodes in the graph database corresponding to other words with clear semantics are determined as the local clear query scope of other words with clear semantics. The local clear query scope of each word with fuzzy semantics, the local clear query scope of words with clear semantics adjacent to the relative quantifier, and the local clear query scope of words with other clear semantics are determined as the global clear query scope corresponding to the fuzzy query statement.

[0182] Optionally, in this embodiment, the words with fuzzy semantics also include: a mood operator.

[0183] The local range determination module is specifically used for:

[0184] If the word with fuzzy semantics is a mood operator, a preset membership range threshold matching the mood operator is determined as a first membership range threshold. A first initial query range is determined according to the first membership range threshold and a preset membership function matching the mood operator. The first initial query range is defuzzified to determine a local clear query range corresponding to the mood operator.

[0185] Optionally, in this embodiment, if the word with ambiguous semantics is a relative quantifier, the local scope determination module is specifically used to:

[0186] The preset membership range threshold matching the relative quantifier is determined as the second membership range threshold. The preset membership function matching the relative quantifier is a linear membership function. The second initial query range is determined according to the second membership range threshold and the linear membership function. The second initial query range is defuzzified by the reverse method to determine the local clear query range corresponding to the relative quantifier.

[0187] Optionally, in this embodiment, the words with fuzzy semantics also include: a fuzzification operator.

[0188] The local range determination module is specifically used for:

[0189] If the word with fuzzy semantics is a fuzzification operator, the preset membership range threshold matching the fuzzification operator is determined as the third membership range threshold. According to the preset membership function matching the fuzzification operator, the matching adjustment parameter and the word with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are determined. With the third membership range threshold as a boundary condition, the adjustment parameter and the word with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are input into the preset membership function matching the fuzzification operator to output the local clear query range corresponding to the fuzzification operator.

[0190] Optionally, in this embodiment, the preset membership function matching the fuzzification operator is:

[0191]

[0192] Among them, x represents a value in the local clear query range corresponding to the fuzzification operator, y represents the clear semantic words adjacent to the fuzzification operator, and δ represents the adjustment parameter.

[0193] The fuzzy query device provided in this embodiment can be executed Figure 2-Figure 4 The technical solution of the method embodiment shown in the figure has the same implementation principle and technical effect as Figure 2-Figure 4 The method embodiments shown are similar and will not be described in detail here.

[0194] According to an embodiment of the present invention, the present invention also provides an electronic device, a computer-readable storage medium and a computer program product.

[0195] like Figure 6 As shown, Figure 6 1 is a schematic diagram of the structure of an electronic device provided by a fourth embodiment of the present invention. The electronic device is intended to be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a blade server, a mainframe computer, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0196] like Figure 6 As shown, the electronic device includes: a processor 401 and a memory 402. The various components are connected to each other using different buses and can be installed on a common mainboard or in other ways as required. The processor can process instructions executed in the electronic device.

[0197] The memory 402 is a non-transient computer-readable storage medium provided by the present invention. The memory stores instructions executable by at least one processor to enable at least one processor to execute the fuzzy query method provided by the present invention. The non-transient computer-readable storage medium of the present invention stores computer instructions, which are used to enable a computer to execute the fuzzy query method provided by the present invention.

[0198] The memory 402 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the fuzzy query method in the embodiment of the present invention (for example, the attached Figure 5 The processor 401 executes various functional applications and data processing of the electronic device by running the non-transient software programs, instructions and modules stored in the memory 402, that is, the fuzzy query method in the above method embodiment is implemented.

[0199] At the same time, this embodiment also provides a computer product. When instructions in the computer product are executed by a processor of an electronic device, the electronic device can execute the fuzzy query method of the above embodiment.

[0200] Those skilled in the art will readily appreciate other implementations of the embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the embodiments of the present invention that follow the general principles of the embodiments of the present invention and include common knowledge or customary technical means in the art that are not disclosed in the embodiments of the present invention. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the embodiments of the present invention are indicated by the following claims.

[0201] It should be understood that the embodiments of the present invention are not limited to the precise structures described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the embodiments of the present invention is limited only by the appended claims.

Claims

1. A fuzzy query method, characterized in that: include: Obtaining a fuzzy query statement to be identified; Performing semantic recognition on the fuzzy query statement to be recognized and splitting the fuzzy query statement to be recognized into a plurality of words with fuzzy semantics and a plurality of words with clear semantics; the words with clear semantics are consistent with entities corresponding to nodes in the graph database; the words with fuzzy semantics include relative quantifiers; Determining a preset membership function and a preset membership range threshold that match each of the words with fuzzy semantics; Determining a local clear query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds; Determine the total number of associated nodes required for the query corresponding to the nodes in the graph database that match the query target entity; wherein the associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier; Determining the total number of associated nodes required for the query as a local explicit query range of words with explicit semantics adjacent to the relative quantifier; Determining data contained in nodes in a graph database corresponding to other terms with clear semantics as a local clear query scope of other terms with clear semantics, wherein the other terms with clear semantics include: a query target entity; Determining the local clear query scope of each word with fuzzy semantics, the local clear query scope of the word with clear semantics adjacent to the relative quantifier, and the local clear query scope of other words with clear semantics as the global clear query scope corresponding to the fuzzy query statement; The target data is queried from the graph database according to the global explicit query scope.

2. The method according to claim 1, characterized in that The words with fuzzy semantics also include: mood operators; The determining of the local explicit query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes: If the word with fuzzy semantics is a mood operator, a preset membership range threshold matching the mood operator is determined as a first membership range threshold; determining a first initial query range according to the first membership range threshold and a preset membership function matching the mood operator; The first initial query range is defuzzified to determine a local explicit query range corresponding to the mood operator.

3. The method according to claim 2, characterized in that If the word with fuzzy semantics is a relative quantifier, then determining the local explicit query range corresponding to the word with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes: The preset membership range threshold matching the relative quantifier is determined as the second membership range threshold; the preset membership function matching the relative quantifier is a linear membership function; determining a second initial query range according to the second membership range threshold and the linear membership function; The second initial query scope is defuzzified by using a reverse method to determine a local clear query scope corresponding to the relative quantifier.

4. The method according to claim 3, characterized in that The words with fuzzy semantics also include: fuzzification operators; The determining of the local explicit query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds includes: If the word with fuzzy semantics is a fuzzification operator, a preset membership range threshold matching the fuzzification operator is determined as a third membership range threshold; Determining matching adjustment parameters and words with clear semantics adjacent to the fuzzy operator in the fuzzy query statement according to a preset membership function matching the fuzzy operator; Taking the third membership range threshold as a boundary condition, the adjustment parameter and the words with clear semantics adjacent to the fuzzification operator in the fuzzy query statement are input into a preset membership function matching the fuzzification operator to output a local clear query range corresponding to the fuzzification operator.

5. The method according to claim 4, characterized in that The preset membership function matching the fuzzification operator is: Among them, x represents a value in the local clear query range corresponding to the fuzzification operator, y represents the clear semantic words adjacent to the fuzzification operator, and δ represents the adjustment parameter.

6. A fuzzy query device, characterized in that: include: An acquisition module, used for acquiring a fuzzy query statement to be identified; A semantic recognition module, used for performing semantic recognition on the fuzzy query statement to be recognized and splitting the fuzzy query statement to be recognized into a plurality of words with fuzzy semantics and a plurality of words with clear semantics; the words with clear semantics are consistent with the entities corresponding to the nodes in the graph database; the words with fuzzy semantics include relative quantifiers; A function determination module, used to determine a preset membership function and a preset membership range threshold that match each of the words with fuzzy semantics; A local range determination module, used to determine the local clear query range corresponding to the words with fuzzy semantics according to each of the preset membership functions and the corresponding preset membership range thresholds; A global scope determination module, configured to determine a global explicit query scope corresponding to the fuzzy query statement according to each of the local explicit query scopes, the words with explicit semantics adjacent to the relative quantifier and other words with explicit semantics; A query module, used to query target data from the graph database according to the global clear query range; The other words with clear semantics include: a query target entity, the global scope determination module, which is specifically used to determine the total number of associated nodes required for the query corresponding to the nodes in the graph database matching the query target entity; wherein the associated nodes required for the query are the nodes in the graph database corresponding to the words with clear semantics adjacent to the relative quantifier; the total number of associated nodes required for the query is determined as the local clear query scope of the words with clear semantics adjacent to the relative quantifier; the data contained in the nodes in the graph database corresponding to the other words with clear semantics are determined as the local clear query scope of other words with clear semantics; the local clear query scope of each word with fuzzy semantics, the local clear query scope of the words with clear semantics adjacent to the relative quantifier, and the local clear query scope of the words with other clear semantics are determined as the global clear query scope corresponding to the fuzzy query statement.

7. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the fuzzy query method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the fuzzy query method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the fuzzy query method according to any one of claims 1 to 5 is implemented.