A complex query method for knowledge base based on neural symbolic enhancement

Through the neural symbol enhancement method, combined with the embedded representation and symbol representation in the knowledge graph, the cascade error and incomplete problems in the e-commerce knowledge graph are solved, and the accuracy and applicability of complex queries are improved.

CN115391507BActive Publication Date: 2025-08-26ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211005950.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2025-08-26
Estimated Expiration
2042-08-22

AI Technical Summary

Technical Problem

The existing complex logic query methods for knowledge graphs have cascade error accumulation problems in e-commerce scenarios, and cannot effectively deal with the incomplete knowledge graphs, resulting in a decrease in query accuracy.

Method used

Using a method based on neural symbol enhancement, the embedded representation and symbolic representation of missing triples in logical expressions are learned through the parameter optimization knowledge representation model. Combining neural reasoning and symbolic reasoning, relationship mapping and logical operation reasoning of missing entities are carried out, cascade errors are reduced and knowledge graphs are completed.

Benefits of technology

It effectively reduces cascade errors, improves the accuracy of complex queries, and supports the operation of multiple logical operators, adapts to different knowledge representation models, and is suitable for complex queries in e-commerce knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391507B_ABST
    Figure CN115391507B_ABST
Patent Text Reader

Abstract

The present invention discloses a complex query method for a knowledge base based on neural symbol enhancement. It uses the method of separate symbolic and neural reasoning and mutual conversion in relational mapping operations to alleviate the problems of incomplete graphs and cascade errors in multiple reasoning. Then, the logical calculation is completed on the symbolic representation and converted into an embedded representation. Any known neural reasoning method can be used to replace the neural reasoning part in the framework, which has strong scalability. At the same time, it only requires link prediction tasks to train the knowledge representation model to complete complex logical queries. This method has great practical value for reasoning and querying complex logical questions represented in knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data query and processing technology, and specifically relates to a complex logic query method based on mutual enhancement of neural networks and symbols in knowledge graphs. Background Art

[0002] Knowledge graphs have received significant attention in recent years and have been successfully applied in many fields, such as search engines, intelligent customer service, and voice robots. Many large-scale knowledge graphs have been gradually constructed, such as the Google Knowledge Graph and open platforms like Freebase and Yago. Knowledge graphs primarily consist of entities, relationships, and triples. Each triple represents a piece of knowledge, i.e., a relationship between two entities. These triples are represented by (h, r, t), where h and t represent the head and tail entities, respectively, and r represents the relationship. For example, (Hangzhou, located in China) represents the piece of knowledge "Hangzhou is located in China."

[0003] In the knowledge graph, complex logic query is a method proposed for data query. The so-called complex query is to use various logical operation symbols, such as AND, OR, NOT and their combinations, to conduct queries containing logical combinations in the knowledge graph during the query process. Compared with general knowledge graph completion, the tasks required are more complex. For example, (Hangzhou, located in the country is, X) is a typical knowledge graph completion example. Only one step of reasoning is needed to get the answer to X. However, as a complex query, the question may be "What are the provincial capital cities along the coast?", which is converted into a logical expression of '(X, located in, coastal area) ∧ (X, level, provincial capital city)'. Similar to this, simple single-step reasoning is linked together through logical symbols such as AND, OR, NOT to perform logical queries or multi-step queries, which are called complex queries on the knowledge graph.

[0004] In e-commerce scenarios, search queries based on e-commerce knowledge graphs are urgently needed. While traditional methods of searching for answers by traversing the e-commerce knowledge graph can find answers that actually exist in the e-commerce knowledge graph, due to the incompleteness of the e-commerce knowledge graph itself, it is impossible to find answers that are theoretically correct but lack one or more relationship annotations. Furthermore, as the scale of the e-commerce knowledge graph expands, such methods will lead to increasing query times. Therefore, current research on complex query methods on e-commerce knowledge graphs is based on representation learning. The core idea is to learn a representation in a vector space for each entity and relationship. When performing complex logical queries, an answer representation in the same space is obtained based on the query statement. Finally, implicit reasoning is achieved through calculations between these representations.

[0005] Existing complex logic query methods for knowledge graphs primarily focus on alleviating the incompleteness of e-commerce knowledge graphs and supporting various logical operators. However, complex queries, due to the multi-step reasoning required, also pose a significant challenge: cascading error. This error occurs when errors in reasoning performed through representation learning accumulate from one step to the next. Consequently, after multiple steps of reasoning, the final answer representation can deviate significantly from the correct answer due to these accumulated errors. Summary of the Invention

[0006] In view of the above, the purpose of the present invention is to provide a complex query method for a knowledge base based on neural symbol enhancement, which can reduce the cascade error generated by knowledge representation search, alleviate the problem of incomplete e-commerce knowledge graph, and support different logical operator operations, adapt to the knowledge representation learning of various knowledge representation models, and improve the accuracy of complex queries.

[0007] To achieve the above-mentioned object of the invention, an embodiment provides a complex query method for a knowledge base based on neural symbol enhancement, comprising the following steps:

[0008] Step 1: receiving a logical expression for a product query, wherein the logical expression is formed by connecting missing triples through logical operations;

[0009] In step 2, the parameter-optimized knowledge representation model is used to learn the embedding representations of the known entities and relations in the missing triples in the logical expression, and the symbolic representation of the initial entities in the logical expression is initialized. Each element in the symbolic representation represents the probability value of the corresponding entity.

[0010] Step 3: For missing triples in the logical expression, perform relational mapping reasoning on the missing triples based on the entity embedding representation and symbolic representation to predict the embedding representation and symbolic representation of the missing entity in the missing triple. Use the embedding representation of the missing entity to supplement the symbolic representation of the missing entity, and use the supplemented symbolic representation to correct the embedding representation of the missing entity.

[0011] Step 4: For the logical operations in the logical expression, perform logical operation reasoning based on the symbolic representation of the missing entity to obtain the symbolic representation of the predicted entity, and calculate the embedding representation of the predicted entity based on the symbolic representation of the predicted entity;

[0012] In step 5, when the predicted entity is used as a candidate target entity, the symbolic representation and embedded representation of the predicted entity are combined to determine the final target entity from the candidate target entities. The target entity is the query result obtained for the logical expression.

[0013] Compared with the prior art, the present invention has the following beneficial effects:

[0014] When performing relationship mapping, symbolic reasoning (mapping reasoning based on symbolic representation) and neural reasoning (mapping reasoning based on embedded representation) are used to enhance each other, alleviating the problems of incomplete e-commerce knowledge graphs and cascade errors.

[0015] For the neural reasoning part, any knowledge representation model that can predict relational connections can be used, which broadens the application field.

[0016] Since logical operations do not involve parameters, the knowledge representation model can be trained using only relational connection prediction tasks. This makes it easier to deploy in practical applications and achieves significant results in complex logical queries, improving the accuracy of complex queries. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 is a flow chart of a complex query method for a knowledge base based on neural symbolic enhancement provided by an embodiment;

[0019] Figure 2 It is a graphical diagram of the logical expression of the commodity search statement instance provided in the embodiment;

[0020] Figure 3 The embodiment provides a relational mapping reasoning diagram and a logical operator principle diagram. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0022] In the current e-commerce application scenario, the search business logic can be expressed as "search query → query semantic understanding → recall → sorting → search results". When searching for products, a query in the form of a logical expression is received. This query may contain complex logical semantics, so it is necessary to use logical operations such as AND, OR, and NOT to perform a complete semantic representation. After it is expressed as a regular logical expression, it is convenient for the computer to query it, recall relevant documents or products, and sort them by the algorithm according to the customer's actual search intention, and finally solve their search needs and realize business conversion operations. The embodiment provides a method for completing queries in such a query scenario with logical participation. Taking into account that in the case of incomplete knowledge graphs in real e-commerce, all correct answer entities cannot be found by traversal, the embodiment adopts an embedded representation learning method to perform queries, and uses symbolic representation to solve the cascade error problem in multi-step queries.

[0023] like Figure 1 As shown, the embodiment provides a knowledge base complex query method based on neural symbol enhancement, including the following steps:

[0024] Step 1: Receive a logical expression for a product query, wherein the logical expression is formed by connecting missing triples through logical operations.

[0025] In the embodiment, the logical operation includes an AND operator, an OR operator, and a NOT operator, such as Figure 3 According to the principle shown in , a normal triple is composed of a head entity, a relationship, and a tail entity. A missing triple indicates that a normal triple is missing a head entity, a tail entity, or a triple formed by a head and tail entity. For the received logical expression for a product query, the logical expression is formed by connecting missing triples through logical operations, and is expressed as {missing triple 1 logical operator 1 missing triple 2 logical operator 2...}. For example, a statement instance with logical semantics: "Who are the citizens of developing countries and have won the Turing Award?", convert the instance into a logical expression {(developing country, including, X) and (X, citizen, Y1) logical operator and (Turing Award, won, Y2)}, and the logical expression is visualized as follows Figure 2 shown.

[0026] In step 2, the parameter-optimized knowledge representation model is used to learn the embedded representations of known entities and relations in the missing triples in the logical expression, and at the same time initialize the symbolic representation of the initial entities in the relationship mapping, where each element represents the probability value of the corresponding entity.

[0027] In the embodiment, each entity in the e-commerce knowledge graph and the missing triples is represented by symbolic representation and embedded representation. Among them, the embedded representation of known entities and relationships learned by the knowledge representation model is d represents the dimension of the embedding vector.

[0028] In the embodiment, the symbolic representation of the initial entity in the relationship mapping is also initialized, wherein the symbolic representation is represented by the vector The vector representation of n e Indicates the number of entities, that is, n e Each element in the dimensional vector p corresponds to the possible probability value of a single entity in the e-commerce knowledge graph. For the initial entity, the symbol represents that the position corresponding to the entity index is 1, and the rest of the positions are 0.

[0029] Step 3: For the missing triples in the logical expression, perform relational mapping reasoning on the missing triples based on the embedding representation and symbolic representation of the entity to predict the embedding representation and symbolic representation of the missing entity in the missing triple, use the embedding representation of the missing entity to supplement the symbolic representation of the missing entity, and use the supplemented symbolic representation to correct the embedding representation of the missing entity.

[0030] In this embodiment, relational mapping reasoning consists of two parts: a neural reasoning part (i.e., mapping reasoning based on embedded representations) and a symbolic reasoning part (i.e., mapping reasoning based on symbolic representations). The neural reasoning part uses embedded representations to address information missing issues caused by incomplete knowledge graphs, while the symbolic reasoning part can obtain absolutely correct but potentially incomplete query information. The information from these two parts is combined and reinforced, thereby retaining the advantages of both reasoning methods.

[0031] In the embodiment, for the mapping reasoning based on embedding representation, the embedding representation of the relationship with the same dimension as the embedding representation of the known entity is used for calculation. Here, all models based on embedding reasoning can be used. Its generalization is also an advantage of the method. The RotatE model can be preferred. Specifically, according to the embedding representation v of the known entity in the missing triple, h and the embedding representation v of the relation r , calculate the embedding representation of the missing entity in the missing triple Among them, the symbol represents the Hadamard product.

[0032] In the embodiment, for the mapping reasoning based on symbolic representation, the relational adjacency matrix of the e-commerce knowledge graph is used for calculation, and the relational adjacency matrix is ​​defined as Assume that entity e i With entity e j Connected by relationship r, then M r (i, j) is 1, otherwise it is 0. Specifically, according to the relationship adjacency matrix M of the e-commerce knowledge graph r and the symbolic representation of known entities in missing triples p h, compute the symbolic representation of the missing entity in the missing triple Among them, g(·) represents the normalization function, p n M r The symbol indicates p h With M r Multiply.

[0033] In this embodiment, when performing complex queries, it is necessary to examine the reasoning ability when the e-commerce knowledge graph is incomplete. The symbolic representation of the missing entity is used to correct the embedded representation of the missing entity, specifically including:

[0034] First, calculate the embedding representation v of the missing entity t and the embedding representation v of all entities in the e-commerce knowledge graph e The similarity between them is obtained by the similarity vector Y, where the similarity calculation adopts D(v r , v e )=γ-||v r -v e ||1, where γ is a predefined constant and ||·||1 is a norm.

[0035] Then, the similarity vector Y is activated (such as softmax function processing) to obtain p t ′, p t ′ is added to the missing entity symbol p t In the above example, normalization is performed to obtain p t ″. In the specific normalization process, p t The above steps complete the use of embedded representation to solve the incomplete search problem of symbolic representation.

[0036] Finally, using p t ″ to correct the embedding representation v of the missing entity r , and get the corrected embedding representation v t ′. The significance of this process is that, because p t ″ contains the absolutely correct answer, so it can be used to correct v t The embedding representation of is inaccurate.

[0037]

[0038] Among them, S t The symbol indicates p t The set of entities corresponding to the non-zero elements in ″, e i Indicates that it belongs to the set S t The i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p t Entity e in ″ i The corresponding probability value, |S t | represents the set S t The essence of this calculation is to use p t The embedding representations of the entities represented by the meaningful elements in ″ are fused to obtain a reasonable embedding representation. t and v t We get p″ after the symbolic representation and the embedded representation are mutually enhanced. t and v′ t .

[0039] Step 4: For the logical operations in the logical expression, perform logical operation reasoning based on the symbolic representation of the missing entity to obtain the symbolic representation of the predicted entity, and calculate the embedded representation of the predicted entity based on the symbolic representation of the predicted entity.

[0040] In an embodiment, in logical operation reasoning, when performing logical operation and, logical operation or, and logical operation not calculation, because each element in the symbolic representation of the entity represents the probability of each entity at that step (fuzzy logic), the logical operation reasoning is performed based on the symbolic representation of the entity.

[0041] For the logical operation and in the logical expression: According to the symbolic representations p1 and p2 of the missing entities in the two missing triples connected by the known logical operation and, perform the and operation on p1 and p2, i.e. p1∧p2, and calculate the symbolic representation of the corresponding predicted entity Among them, g(·) represents the normalization function, and the symbol represents the Hadamard product;

[0042] For the logical operation or in the logical expression: According to the symbolic representations p1 and p2 of the missing entities in the two missing triples connected by the known logical operation or, perform an or operation on p1 and p2, that is, p1∨p2, and calculate the symbolic representation of the corresponding predicted entity

[0043] For the logical operation NOT in the logical expression: According to the symbolic representation p of the missing entity in the missing triplet connected by the known logical operation NOT, perform the NOT operation on p, that is, Symbolic representation of the corresponding computational prediction entity Among them, |n e | represents the number of entities in the e-commerce knowledge graph, α represents a constant. Preferably, α is obtained by dividing the average in-degree of each entity in the knowledge graph by two.

[0044] In the embodiment, the symbolic representation p of the predicted entity is obtained. yFinally, the embedding representation of the predicted entity is calculated based on the symbolic representation of the predicted entity, including:

[0045]

[0046] Among them, S y The symbol p represents the predicted entity y The set of entities corresponding to the non-zero elements in e i Indicates that it belongs to the set S y The i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p y Middle Entity e i The corresponding probability value, |S y | represents the set S y The number of entities in .

[0047] For example Figure 2 The logical expression shown in FIG4 is subjected to relational mapping reasoning and logical operation reasoning (i.e., intersection (and) logical operation reasoning) step by step according to steps 3 and 4 to obtain the symbolic representation and embedded representation of the predicted entity.

[0048] As can be seen from the above operations, logical operations such as AND, OR, and NOT require only mathematically clear operations, with no parameters to train. Therefore, this solution can be trained solely on link prediction tasks and used to complete complex logical queries. This allows the model to be trained using only simple tasks, even when a large number of complex query examples are unavailable in real-world scenarios. This is another advantage of this method over conventional complex logical query models.

[0049] In step 5, when the predicted entity is used as a candidate target entity, the symbolic representation and embedded representation of the predicted entity are combined to determine the final target entity from the candidate target entities. The target entity is the query result obtained for the logical expression.

[0050] In this embodiment, when determining that a predicted entity is a candidate target entity based on an input logical expression regarding a product query, it is necessary to comprehensively determine the final target entity from the candidate target entities by combining the symbolic representation and the embedded representation of the predicted entity. Specifically, the final target entity is determined using the following formula based on the symbolic representation and the embedded representation of the predicted entity:

[0051]

[0052] This formula is understood as multiplying the probability of each entity in the symbolic representation being the answer entity by λ, calculating the similarity between the result of the embedding representation and all entities and concatenating them into a vector (which can be understood as the probability of each entity represented by the embedding representation being the answer), and then multiplying it by 1-λ to obtain the combined result of the two inferences. In the formula, p y Represents the symbolic representation of the predicted entity, v y represents the embedding representation of the predicted entity, V represents the entity set in the e-commerce knowledge graph, and v e Denotes the embedding representation of entities in the entity set V, D(v y , v e ) represents the calculation of v y With v e The similarity of It means concatenating all similarities into one vector, which is understood as the probability of each entity represented by the embedding representation of the predicted entity as the target entity. λ represents the comprehensive ratio, and a represents the entity probability vector determined by the symbolic representation and embedding representation of the comprehensive predicted entity. The entity with the largest probability value in the entity probability vector a is determined as the target entity.

[0053] In this embodiment, when a predicted entity is determined, based on a logical expression regarding a product query, to serve only as an intermediate entity in a continuous entity join prediction and not as a candidate target entity for determining the target entity, the predicted entity is used as the head entity of the next missing triple in the continuous entity join prediction, and continuous entity join prediction continues. It should be noted that continuous instance join prediction involves predicting the tail entity based on a relationship based on the head entity of the first missing triple, using that tail entity as the head entity of the second missing triple, and then predicting another tail entity based on another relationship.

[0054] In the embodiment, the knowledge representation model needs to be parameter optimized before being applied, and the parameter optimization includes:

[0055] (a) Knowledge expression sentences are extracted from the e-commerce knowledge graph. After masking the keywords in the knowledge expression sentences, they are converted into logical expressions that connect missing triples through logical operations as sample data. The learning goal is to search for masked keywords.

[0056] (b) Calculate the symbolic representation and embedding representation of the predicted entity based on the sample data according to steps 2-4;

[0057] (c) constructing a first loss based on the embedding representation of the predicted entity, constructing a second loss based on the symbolic representation of the predicted entity, and constructing a third loss based on the conversion of the symbolic representation of the predicted entity to the embedding representation;

[0058] In the embodiment, the first loss L1 is expressed as:

[0059]

[0060] Among them, v y represents the embedding representation of the predicted entity, The embedding representation of the correct answer entity representing the sample data, represents the embedding representation of the i-th wrong answer entity, σ(·) represents the sigmoid function, D(·) represents the similarity, and n represents the number of wrong answer entities. The first term indicates that we hope that the embedding representation of the predicted entity is close to the embedding representation of the correct answer entity, and the second term indicates that we hope that the embedding representation of the predicted entity is far away from the embedding representation of the wrong answer entity.

[0061] In the embodiment, the second loss L2 is expressed as:

[0062]

[0063] in, represents the transpose of the symbolic representation of the predicted entity, The symbolic representation of the correct answer entity of the sample data, Indicates taking The symbol · represents the vector dot product. The purpose of optimizing the second loss L2 is to make the reasoning result of the symbol representation close to the correct answer entity.

[0064] In the embodiment, in order to make the MLP function that transforms the symbolic representation of the predicted entity into the embedded representation in step 3 be properly trained, a loss function is also designed separately to convert the symbolic representation of the predicted entity into the embedded representation. t The converted p′ t Convert back to v t The calculation of this step does not participate in reasoning, but is only used to train the process of converting symbolic representation into embedded representation. The third loss is expressed as follows:

[0065]

[0066] Among them, v t represents the embedding representation of the missing entity, p t ′ represents the symbolic representation obtained after the similarity vector Y is activated, S t ′ represents the symbol p t The set of entities corresponding to the non-zero elements in ′, e i Indicates that it belongs to the set S t ′, the i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p t Entity e in ′ iThe corresponding probability value, D(·) represents the similarity, σ(·) represents the sigmoid function, |S t ′| represents the set S t The number of entities in ′.

[0067] (d) Optimizing the parameters of the knowledge representation model based on three losses.

[0068] In the embodiment, a total loss function L=L1+L2+L3 is constructed based on the three losses, and the optimization process of minimizing the total loss function can be optimized using any gradient descent-based optimization algorithm until the loss value converges.

[0069] The complex query method of the knowledge base based on neural symbol enhancement provided in the above embodiment cannot handle the problem of cascade errors well for the complex logical query method in the e-commerce knowledge graph, and cannot generalize the existing knowledge representation model to this problem. From the perspective of finding the correct answer through the traversal method, the answer determined in the middle of multi-step reasoning is used to correct the entity representation in the reasoning process. At the same time, because it still uses the representation reasoning method, it can retain the advantage of representation learning to overcome the incomplete graph. The two methods enhance each other to achieve better prediction effects.

[0070] The above embodiment provides a complex query method for the knowledge base based on neural symbol enhancement, which uses the method of separate reasoning and mutual conversion of symbols and neural networks in relational mapping operations to alleviate the problems of incomplete graphs and cascade errors in multiple reasonings, and then uses the symbolic representation to complete logical calculations and convert them into embedded representations. Any known neural reasoning method can be used to replace the neural reasoning part in the framework, and it has strong scalability. At the same time, it only needs to link the prediction task to train the knowledge representation model to complete complex logical queries. This method has great practical value for reasoning and querying complex logical questions represented in the knowledge graph.

[0071] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A complex query method for a knowledge base based on neural symbolic enhancement, comprising the following steps: Step 1: receiving a logical expression for a product query, wherein the logical expression is formed by connecting missing triples through logical operations; Step 2: Use the parameter-optimized knowledge representation model to learn the embedding representations of known entities and relations in the missing triples in the logical expression, and initialize the symbolic representation of the initial entities in the relationship mapping, where each element represents the probability value of the corresponding entity; Step 3: For the missing triples in the logical expression, perform relational mapping reasoning on the missing triples based on the embedding representation and symbolic representation of the entity to predict the embedding representation and symbolic representation of the missing entity in the missing triple. The embedding representation of the missing entity is used to supplement the symbolic representation of the missing entity, and the symbolic representation of the supplemented missing entity is used to correct the embedding representation of the missing entity, including: First, calculate the embedding representation v of the missing entity t The similarity between the embedding representations of all entities in the e-commerce knowledge graph is obtained as the similarity vector Y; Then, the similarity vector Y is activated to obtain p t ′, p t ′ is added to the missing entity symbol p t In the above example, normalization is performed to obtain p t ″; Finally, using p t ″ to correct the embedding representation v of the missing entity r , and get the corrected embedding representation v t ′: Among them, S t The symbol indicates p t The set of entities corresponding to the non-zero elements in ″, e i Indicates that it belongs to the set S t The i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p t Entity e in ″ i The corresponding probability value, |S t | represents the set S t The number of entities in Step 4: For the logical operation in the logical expression, perform logical operation reasoning based on the symbolic representation of the missing entity to obtain the symbolic representation of the predicted entity, and calculate the embedded representation of the predicted entity based on the symbolic representation of the predicted entity, wherein the logical operation reasoning includes: For the logical operation and in the logical expression: According to the symbolic representations p1 and p2 of the missing entities in the two missing triples connected by the known logical operation and, perform the and operation on p1 and p2, i.e. p1∧p2, and calculate the symbolic representation of the corresponding predicted entity Among them, g(·) represents the normalization function, and the symbol represents the Hadamard product; For the logical operation or in the logical expression: According to the symbolic representations p1 and p2 of the missing entities in the two missing triples connected by the known logical operation or, perform an or operation on p1 and p2, that is, p1∨p2, and calculate the symbolic representation of the corresponding predicted entity For the logical operation NOT in the logical expression: According to the symbolic representation p of the missing entity in the missing triplet connected by the known logical operation NOT, perform the NOT operation on p, that is, Symbolic representation of the corresponding computational prediction entity Among them, α is a constant, |n e | represents the number of entities in the e-commerce knowledge graph; Step 5: When the predicted entity is used as a candidate target entity, the symbolic representation and embedded representation of the predicted entity are combined to determine the final target entity from the candidate target entities. The target entity is the query result obtained for the logical expression; The knowledge representation model needs to be parameter optimized before being applied. The parameter optimization includes: Extract knowledge expression sentences from the e-commerce knowledge graph, mask the keywords in the knowledge expression sentences, and convert them into logical expressions that connect missing triples through logical operations as sample data. The learning goal is to search for masked keywords. Follow steps 2-4 to calculate the symbolic representation and embedding representation of the predicted entity based on the sample data; The first loss is constructed based on the embedding representation of the predicted entity, the second loss is constructed based on the symbolic representation of the predicted entity, and the third loss is constructed based on the conversion of the symbolic representation of the predicted entity to the embedding representation; The parameters of the knowledge representation model are optimized according to three losses.

2. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: In step 3, the relational mapping reasoning of missing triples is performed based on the embedding representation and symbolic representation of the initial entity, including: Mapping reasoning based on embedding representation: According to the embedding representation v of known entities in missing triples h and the embedding representation v of the relation r , calculate the embedding representation of the missing entity in the missing triple Among them, the symbol represents the Hadamard product; Mapping reasoning based on symbolic representation: According to the relational adjacency matrix M of the e-commerce knowledge graph r and the symbolic representation of known entities in missing triples p h , compute the symbolic representation of the missing entity in the missing triple Here, g(·) represents the normalization function.

3. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: In step 4, the embedding representation of the predicted entity is calculated based on the symbolic representation of the predicted entity, including: Among them, S y The symbol p represents the predicted entity y The set of entities corresponding to the non-zero elements in e i Indicates that it belongs to the set S y The i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p y Middle Entity e i The corresponding probability value, |S y | represents the set S y The number of entities in .

4. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: In step 5, the symbolic representation and embedding representation of the predicted entity are integrated to determine the final target entity from the candidate target entities, including: The following formula is used to determine the final target entity based on the symbolic representation and embedding representation of the predicted entity: Among them, p y Represents the symbolic representation of the predicted entity, v y represents the embedding representation of the predicted entity, V represents the entity set in the e-commerce knowledge graph, and v e Denotes the embedding representation of entities in the entity set V, D(v y ,v e ) represents the calculation of v y With v e The similarity of It means concatenating all similarities into one vector, which is understood as the probability of each entity represented by the embedding representation of the predicted entity as the target entity. λ represents the comprehensive ratio, and a represents the entity probability vector determined by the symbolic representation and embedding representation of the comprehensive predicted entity. The entity with the largest probability value in the entity probability vector a is determined as the target entity.

5. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: The first loss L1 is expressed as: Among them, v y represents the embedding representation of the predicted entity, The embedding representation of the correct answer entity representing the sample data, represents the embedding representation of the i-th wrong answer entity, σ(·) represents the sigmoid function, D(·) represents the similarity, and n represents the number of wrong answer entities. The first term indicates that we hope that the embedding representation of the predicted entity is close to the embedding representation of the correct answer entity, and the second term indicates that we hope that the embedding representation of the predicted entity is far away from the embedding representation of the wrong answer entity. The second loss L2 is expressed as: in, represents the transpose of the symbolic representation of the predicted entity, The symbolic representation of the correct answer entity of the sample data, Indicates taking For elements in that are greater than θ, the symbol · denotes the vector dot product.

6. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: The third loss L3 is expressed as: Among them, v t represents the embedding representation of the missing entity, p t ′ represents the symbolic representation obtained after the similarity vector Y is activated, S t ′ represents the symbol p t The set of entities corresponding to the non-zero elements in ′, e i Indicates that it belongs to the set S t ′, the i-th entity in Represents entity e i The embedding representation, MLP() represents a multi-layer perceptron, The symbol indicates p t Entity e in ′ i The corresponding probability value, D(·) represents the similarity, σ(·) represents the sigmoid function, |S t ′| represents the set S t The number of entities in ′.

7. The complex query method for knowledge base based on neural symbol enhancement according to claim 1 is characterized in that: When it is determined based on the logical expression about the product query that the predicted entity only serves as an intermediate entity for continuous entity connection prediction in the entire expression and is not a candidate target entity for determining the target entity, the predicted entity is used as the head entity of the next missing triplet in the continuous entity connection prediction, and the continuous entity connection prediction is continued.