A knowledge graph storage and query method and device based on a graph database

By constructing a central mapping registry in the graph database to assign unique identifiers to attributes, the storage and querying of knowledge graphs are optimized, solving the problems of wasted storage space and low query efficiency. This achieves efficient knowledge graph storage and querying, adapts to complex query scenarios, and reduces development difficulty.

CN120723947BActive Publication Date: 2025-11-18INSPUR SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511195537.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-26
Publication Date
2025-11-18
Estimated Expiration
2045-08-26

AI Technical Summary

Technical Problem

Existing technologies suffer from wasted storage space and low query efficiency in knowledge graph storage and retrieval. In particular, they are unable to meet real-time requirements when performing large-scale concurrent retrieval and complex condition filtering. Especially in fields such as financial anti-fraud, existing methods are unable to complete the judgment of complex combinations of hundreds of risk labels within tens of milliseconds.

Method used

This paper adopts a knowledge graph storage and query method based on graph database. By constructing a central mapping registry, a unique attribute positioning identifier is assigned to each attribute. The nodes of the graph database are used for attribute storage management. The storage and query of attributes are optimized through the central mapping registry, enabling cross-dimensional multi-attribute combination query retrieval.

Benefits of technology

It achieves a storage compression rate of over 90%, significantly improves query speed, supports efficient queries with any combination of tags/attributes, has the ability to adapt to business query modes, can evolve smoothly and seamlessly integrate with the existing ecosystem, lowers the development threshold, and accelerates project implementation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120723947B_ABST
    Figure CN120723947B_ABST
Patent Text Reader

Abstract

The application discloses a knowledge graph storage and query method and device based on a graph database, and relates to the fields of artificial intelligence and graph database technologies; the method comprises the following steps: step 1, collecting all attributes involved in a knowledge graph, and constructing a central mapping register of global attributes of the knowledge graph in a graph database; step 2, storing and managing attributes by using nodes in the graph database; and step 3, performing combined query and retrieval of cross-dimension multiple attributes: according to a query request of multiple target attributes, attribute positioning identifiers of each target attribute are found out according to the central mapping register, and storage unit indexes of each target attribute are obtained; if the storage unit indexes of all target attributes are the same, internal retrieval of the storage unit is performed; if the storage unit indexes of the target attributes are different, cross-storage unit associated retrieval is performed; and the application provides an efficient solution for high-performance application of large-scale knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a method and apparatus for storing and querying knowledge graphs based on graph databases, relating to the fields of artificial intelligence and graph database technology. Background Technology

[0002] Knowledge graphs are widely used in fields such as intelligent question answering, recommendation systems, and risk analysis. As the scale of knowledge graphs expands, managing the multiple labels and attributes of nodes and relationships becomes a performance bottleneck. Existing methods typically use string arrays or multi-table structures to store labels and attributes, leading to wasted storage space and low query efficiency. Performance issues are particularly pronounced during large-scale concurrent retrieval and complex condition filtering. For example, in fields with extremely stringent response time requirements, such as financial fraud prevention, a single transaction needs to complete a complex judgment of hundreds of risk labels within tens of milliseconds. Existing methods, due to their involvement of multiple graph database queries or complex in-memory computations, struggle to meet these real-time requirements. Summary of the Invention

[0003] This invention addresses the problems of existing technologies by providing a method and apparatus for storing and querying knowledge graphs based on graph databases. The specific solution proposed by this invention is as follows:

[0004] This invention provides a method for storing and querying knowledge graphs based on graph databases, including:

[0005] Step 1: Collect all attributes involved in the knowledge graph and construct a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit.

[0006] Step 2: Attribute storage management is performed using nodes in the graph database. Each node in the graph database has a pre-defined composite attribute storage unit, which includes at least one of the aforementioned storage units.

[0007] When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored.

[0008] When removing an attribute from an entity in a knowledge graph, the system searches for the attribute's corresponding location identifier based on the central mapping registry. Then, based on the obtained storage unit index and attribute placeholder value, the attribute information is deleted.

[0009] Step 3: Perform cross-dimensional multi-attribute combined query retrieval: Based on the query requests for multiple target attributes, find the attribute positioning identifier of each target attribute according to the central mapping registry, obtain the storage unit index of each target attribute, if the storage unit indexes of all target attributes are the same, perform an internal retrieval within the storage unit, if the storage unit indexes of the target attributes are different, perform a cross-storage unit association retrieval.

[0010] Furthermore, in step 1 of the knowledge graph storage and query method based on graph database, attribute positioning identifiers are assigned to attributes through a central mapping registry, including: analyzing the co-occurrence frequency of different attributes being queried simultaneously based on historical query logs. The co-occurrence frequency refers to the frequency at which attributes are combined and queried in the same search. Attributes with higher co-occurrence frequencies are preferentially assigned to the same storage unit index.

[0011] Furthermore, in step 1 of the knowledge graph storage and query method based on graph database, when a new attribute is introduced, it is registered through the central mapping registry, and an unoccupied binary bit is found from the last storage unit to assign an attribute positioning identifier to the new attribute. When all the bits of the storage unit are allocated, a new storage unit is activated through the composite attribute storage body.

[0012] Furthermore, in step 2 of the knowledge graph storage and query method based on graph database, new attributes are assigned to entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body according to the obtained storage unit index, performing a logical union calculation on the attribute placeholder base value of the new attribute and the value currently stored in the selected storage unit, and storing the calculated new value back to the storage unit. The logical union calculation means merging the two values ​​while ensuring that their independent placeholder information is not lost, thus completing the information storage of the new attribute.

[0013] Removing attributes from entities in a knowledge graph includes: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical difference calculation between the attribute's placeholder reference value and the currently stored value in the selected storage unit; storing the calculated new value back into the storage unit; the logical difference calculation refers to performing a logical intersection calculation with the inverted value of the attribute's placeholder reference value; removing the attribute's placeholder information from the original value; and completing the deletion of the attribute's information.

[0014] Furthermore, in step 3 of the knowledge graph storage and query method based on graph database, the internal retrieval of the storage unit includes: calculating the attribute placeholder benchmark values ​​of all target attributes through logical union, combining them into a single retrieval verification benchmark value, performing a numerical matching verification calculation in the graph database, and performing logical intersection detection between the recorded storage unit value and the retrieval verification benchmark value. If the detection result is completely equal to the retrieval verification benchmark value itself, it proves that the recorded storage unit matches all query conditions.

[0015] Perform cross-storage unit association retrieval, including: performing independent numerical matching verification calculations for each involved storage unit and the corresponding retrieval verification benchmark value, and associating the independent verification steps through logical AND, and finally filtering out the records of storage units that meet all verification conditions.

[0016] This invention also provides a knowledge graph storage and query device based on a graph database, including a mapping module, a storage module, and a query module.

[0017] The mapping module collects all attributes involved in the knowledge graph and constructs a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit.

[0018] The storage module utilizes nodes in the graph database for attribute storage management. Each node in the graph database has a pre-defined composite attribute storage body, which includes at least one of the aforementioned storage units.

[0019] When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored.

[0020] When removing an attribute from an entity in a knowledge graph, the system searches for the attribute's corresponding location identifier based on the central mapping registry. Then, based on the obtained storage unit index and attribute placeholder value, the attribute information is deleted.

[0021] The query module performs cross-dimensional, multi-attribute combined queries and retrievals: based on query requests for multiple target attributes, it finds the attribute location identifier of each target attribute according to the central mapping registry, obtains the storage unit index of each target attribute, and if the storage unit indexes of all target attributes are the same, it performs an internal retrieval within the storage unit; if the storage unit indexes of the target attributes are different, it performs a cross-storage unit association retrieval.

[0022] Furthermore, the mapping module of the knowledge graph storage and query device based on graph database assigns attribute positioning identifiers to attributes through a central mapping registry, including: analyzing the co-occurrence frequency of different attributes being queried simultaneously based on historical query logs, where co-occurrence frequency refers to the frequency with which attributes are combined in the same retrieval, and prioritizing the allocation of attributes with higher co-occurrence frequencies to the same storage unit index.

[0023] Furthermore, in the knowledge graph storage and query device based on graph database, when a new attribute is introduced, the mapping module registers it through the central mapping registry and finds an unoccupied binary bit in the last storage unit to assign an attribute positioning identifier to the new attribute. When all the occupants of the storage unit are allocated, a new storage unit is activated through the composite attribute storage body.

[0024] Furthermore, the storage module of the knowledge graph storage and query device based on graph database assigns new attributes to entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body according to the obtained storage unit index, performing a logical union calculation on the attribute placeholder base value of the new attribute and the value currently stored in the selected storage unit, and storing the calculated new value back to the storage unit. The logical union calculation means merging the two values ​​while ensuring that their independent placeholder information is not lost, thus completing the information storage of the new attribute.

[0025] The storage module removes attributes from entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical difference calculation between the attribute's placeholder reference value and the currently stored value in the selected storage unit; storing the calculated new value back into the storage unit; the logical difference calculation refers to performing a logical intersection calculation with the inverted value of the attribute's placeholder reference value; removing the attribute's placeholder information from the original value; and completing the deletion of the attribute's information.

[0026] Furthermore, the query module of the knowledge graph storage and query device based on graph database performs internal retrieval within the storage unit, including: calculating the attribute placeholder benchmark values ​​of all target attributes through logical union, combining them into a single retrieval verification benchmark value, performing a numerical matching verification calculation in the graph database, performing logical intersection detection between the recorded storage unit value and the retrieval verification benchmark value, and proving that the recorded storage unit matches all query conditions if the detection result is completely equal to the retrieval verification benchmark value itself.

[0027] Perform cross-storage unit association retrieval, including: performing independent numerical matching verification calculations for each involved storage unit and the corresponding retrieval verification benchmark value, and associating the independent verification steps through logical AND, and finally filtering out the records of storage units that meet all verification conditions.

[0028] The advantages of this invention are:

[0029] Optimized Compression and Efficiency: Compared to existing methods that serialize data into JSON arrays or directly store static attribute information, this invention achieves a compression rate of over 90% in terms of storage space. For example, storing 128 independent tag / attribute information requires only 16 bytes, or two 64-bit integers. This extreme compactness greatly reduces hardware costs and data transmission overhead.

[0030] Optimized query performance: Because the core calculations involve numerical logic operations natively supported by the CPU, the query speed of this invention far exceeds that of traditional methods.

[0031] Flexibility and Adaptability: This invention supports efficient querying and statistics for any combination of tags / attributes, and through the intelligent optimization allocation strategy described in step one, it can adapt to business query patterns and continuously improve operational efficiency.

[0032] Smooth system evolution capability: Through the dynamic expansion mechanism of "storage units," this invention fundamentally solves the capacity limitation problem of existing bitwise operation schemes. Adding new tags or attributes only requires registration in the mapping table, without requiring structural changes to the graph database, ensuring smooth, uninterrupted evolution of business operations 24 / 7.

[0033] Seamless integration with the existing ecosystem and dual optimization: This invention combines the breadth filtering capabilities of the native index with its own extreme performance in depth and complex filtering.

[0034] Optimized development and user experience: This invention greatly lowers the barrier to entry for application developers, allowing them to focus on business logic without worrying about the details of numerical coding, thus accelerating the implementation and promotion of this invention in actual projects. Attached Figure Description

[0035] Figure 1 This is a schematic diagram of the loss reduction process of the algorithm in this invention. Detailed Implementation

[0036] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0037] Example 1: This invention provides a knowledge graph storage and query method based on graph databases, including:

[0038] Step 1: Collect all attributes involved in the knowledge graph and construct a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit. The storage unit index can be a zero-based ordinal number, explicitly specifying which independent storage unit in the subsequent data structure the attribute information should be stored in. The attribute placeholder value can be a 64-bit value, in binary form, with only one bit set to "1" and the remaining bits set to "0", serving as a unique and irreplaceable identity for the attribute within the specified storage unit.

[0039] Furthermore, in step 1, when assigning attribute location identifiers to attributes through the central mapping registry, the process can include: analyzing the co-occurrence frequency of different attributes being queried simultaneously based on historical query logs. Co-occurrence frequency refers to the frequency with which attributes are combined in the same search, and prioritizing the allocation of attributes with higher co-occurrence frequencies to the same storage unit index. For example, in the aforementioned financial scenario, the three tag attributes "high risk," "nighttime trading," and "login from another location" are frequently combined in queries. These should be prioritized for allocation to the same storage unit index. Through this intelligent pre-aggregation allocation based on usage patterns, the most frequent complex queries can be maximized to be transformed into the most efficient "internal storage unit search," thereby further improving average query performance on a macro level and endowing the invention with adaptive optimization capabilities.

[0040] In step 1, when a new attribute is introduced, it can be registered through a central mapping registry. An unoccupied binary bit is then located in the last storage unit to assign an attribute location identifier to the new attribute. Once all 64 bits in the storage unit have been allocated, a new storage unit is activated through the composite attribute storage. The entire process has no intrusive impact on existing data and system structure, thus enabling the infinite and smooth evolution of the attribute system.

[0041] Step 2: Attribute storage management is performed using nodes in the graph database. Each node in the graph database has a pre-defined composite attribute storage unit, which includes at least one of the aforementioned storage units.

[0042] When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored.

[0043] When removing an attribute from an entity in a knowledge graph, the attribute location identifier corresponding to the attribute is found according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder base value, the attribute information is deleted.

[0044] Assigning new attributes to entities in a knowledge graph can include: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical union calculation on the attribute placeholder base value of the new attribute and the value currently stored in the selected storage unit; and storing the calculated new value back into the storage unit. The logical union calculation means merging the two values ​​while ensuring that their independent placeholder information is not lost, thus completing the information storage of the new attribute.

[0045] Removing attributes from entities in a knowledge graph includes: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical difference calculation between the attribute's placeholder reference value and the currently stored value in the selected storage unit; storing the calculated new value back into the storage unit; the logical difference calculation refers to performing a logical intersection calculation with the inverted value of the attribute's placeholder reference value; removing the attribute's placeholder information from the original value; and completing the deletion of the attribute's information.

[0046] Step 3: Perform cross-dimensional multi-attribute combined query retrieval: Based on the query requests for multiple target attributes, find the attribute positioning identifier of each target attribute according to the central mapping registry, obtain the storage unit index of each target attribute, if the storage unit indexes of all target attributes are the same, perform an internal retrieval within the storage unit, if the storage unit indexes of the target attributes are different, perform a cross-storage unit association retrieval.

[0047] The internal retrieval of the storage unit includes: calculating the logical union of all target attribute placeholder benchmark values ​​to form a single retrieval verification benchmark value; performing a numerical matching verification calculation in the graph database; performing a logical intersection detection between the value of the recorded storage unit and the retrieval verification benchmark value; and proving that the recorded storage unit matches all query conditions if the detection result is completely equal to the retrieval verification benchmark value itself.

[0048] Cross-storage unit association retrieval is performed, including: independently calculating numerical matching verification for each involved storage unit and its corresponding retrieval verification benchmark, and then associating these independent verification steps using a logical AND operation. Finally, records from storage units that meet all verification conditions are selected. This avoids the costly OR conditional associations or multiple queries found in traditional graph databases, while maintaining extremely high efficiency.

[0049] Furthermore, this invention can also be applied to complex queries in graph traversal. Its advantages are further demonstrated in scenarios involving graph traversal queries such as multi-hop relationship lookup and neighbor analysis. At each step of the traversal process, the complex attribute storage of the current node can be checked in real time and efficiently. By performing the numerical matching verification calculation described in step 3, it is determined whether the current entity meets the preset complex attribute conditions on the path, thereby quickly eliminating a large number of invalid traversal paths and greatly improving the performance and response speed of complex graph analysis.

[0050] The method proposed in this invention can be seamlessly integrated with the underlying mechanisms of graph databases, such as indexing numeric fields, to further improve query performance. Because its core data structure, the composite attribute storage, adopts an extremely compact numerical format, it significantly reduces data storage costs and disk read / write overhead compared to existing text or multi-field storage methods, providing strong technical support for applications requiring high throughput and low latency, such as real-time analysis and risk warning.

[0051] Example 2: The present invention also provides a knowledge graph storage and query device based on a graph database, including a mapping module, a storage module, and a query module.

[0052] The mapping module collects all attributes involved in the knowledge graph and constructs a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit.

[0053] The storage module utilizes nodes in the graph database for attribute storage management. Each node in the graph database has a pre-defined composite attribute storage body, which includes at least one of the aforementioned storage units.

[0054] When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored.

[0055] When removing an attribute from an entity in a knowledge graph, the system searches for the attribute's corresponding location identifier based on the central mapping registry. Then, based on the obtained storage unit index and attribute placeholder value, the attribute information is deleted.

[0056] The query module performs cross-dimensional, multi-attribute combined queries and retrievals: based on query requests for multiple target attributes, it finds the attribute location identifier of each target attribute according to the central mapping registry, obtains the storage unit index of each target attribute, and if the storage unit indexes of all target attributes are the same, it performs an internal retrieval within the storage unit; if the storage unit indexes of the target attributes are different, it performs a cross-storage unit association retrieval.

[0057] The information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description in the method embodiment of the present invention, and will not be repeated here.

[0058] Similarly, the advantages of the device of the present invention are:

[0059] Optimized Compression and Efficiency: Compared to existing methods that serialize data into JSON arrays or directly store static attribute information, this invention achieves a compression rate of over 90% in terms of storage space. For example, storing 128 independent tag / attribute information requires only 16 bytes, or two 64-bit integers. This extreme compactness greatly reduces hardware costs and data transmission overhead.

[0060] Optimized query performance: Because the core calculations involve numerical logic operations natively supported by the CPU, the query speed of this invention far exceeds that of traditional methods.

[0061] Flexibility and Adaptability: This invention supports efficient querying and statistics for any combination of tags / attributes, and through the intelligent optimization allocation strategy described in step one, it can adapt to business query patterns and continuously improve operational efficiency.

[0062] Smooth system evolution capability: Through the dynamic expansion mechanism of "storage units," this invention fundamentally solves the capacity limitation problem of existing bitwise operation schemes. Adding new tags or attributes only requires registration in the mapping table, without requiring structural changes to the graph database, ensuring smooth, uninterrupted evolution of business operations 24 / 7.

[0063] Seamless integration with the existing ecosystem and dual optimization: This invention combines the breadth filtering capabilities of the native index with its own extreme performance in depth and complex filtering.

[0064] Optimized development and user experience: This invention greatly lowers the barrier to entry for application developers, allowing them to focus on business logic without worrying about the details of numerical coding, thus accelerating the implementation and promotion of this invention in actual projects.

[0065] It should be noted that not all steps and modules in the above processes and device structures are mandatory; some steps or modules can be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.

[0066] The embodiments described above are merely preferred embodiments for fully illustrating the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.

Claims

1. A knowledge graph storage and query method based on graph databases, characterized by: include: Step 1: Collect all attributes involved in the knowledge graph and construct a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit. Step 2: Attribute storage management is performed using nodes in the graph database. Each node in the graph database has a pre-defined composite attribute storage unit, which includes at least one of the aforementioned storage units. When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored. When removing an attribute from an entity in a knowledge graph, the system searches for the attribute's corresponding location identifier based on the central mapping registry. Then, based on the obtained storage unit index and attribute placeholder value, the attribute information is deleted. Step 3: Perform cross-dimensional multi-attribute combined query retrieval: Based on the query requests for multiple target attributes, find the attribute positioning identifier of each target attribute according to the central mapping registry, obtain the storage unit index of each target attribute, if the storage unit indexes of all target attributes are the same, perform an internal retrieval within the storage unit, if the storage unit indexes of the target attributes are different, perform a cross-storage unit association retrieval.

2. The knowledge graph storage and query method based on graph database according to claim 1, characterized in that: Step 1 assigns attribute location identifiers to attributes through a central mapping registry, including: analyzing the co-occurrence frequency of different attributes being queried simultaneously based on historical query logs. Co-occurrence frequency refers to the frequency with which attributes are combined in the same retrieval. Attributes with higher co-occurrence frequencies are preferentially assigned to the same storage unit index.

3. The knowledge graph storage and query method based on graph database according to claim 1, characterized in that: In step 1, when a new attribute is introduced, it is registered through the central mapping registry and an unoccupied binary bit is found in the last storage unit to assign an attribute location identifier to the new attribute. After all the bits in the storage unit have been allocated, a new storage unit is enabled through the composite attribute storage body.

4. The knowledge graph storage and query method based on graph database according to claim 1, characterized in that: Step 2 assigns new attributes to entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body according to the obtained storage unit index, performing a logical union calculation on the attribute placeholder base value of the new attribute and the value currently stored in the selected storage unit, and storing the calculated new value back to the storage unit. The logical union calculation means merging the two values ​​while ensuring that their independent placeholder information is not lost, thus completing the information storage of the new attribute. Removing attributes from entities in a knowledge graph includes: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical difference calculation between the attribute's placeholder reference value and the currently stored value in the selected storage unit; storing the calculated new value back into the storage unit; the logical difference calculation refers to performing a logical intersection calculation with the inverted value of the attribute's placeholder reference value; removing the attribute's placeholder information from the original value; and completing the deletion of the attribute's information.

5. A knowledge graph storage and query method based on a graph database according to claim 1, characterized in that: Step 3 involves internal retrieval within the storage unit, including: calculating the logical union of all target attribute placeholder benchmark values ​​to form a single retrieval verification benchmark value; performing a numerical matching verification calculation in the graph database; and performing a logical intersection detection between the recorded storage unit value and the retrieval verification benchmark value. If the detection result is completely equal to the retrieval verification benchmark value itself, it proves that the recorded storage unit matches all query conditions. Perform cross-storage unit association retrieval, including: performing independent numerical matching verification calculations for each involved storage unit and the corresponding retrieval verification benchmark value, and associating the independent verification steps through logical AND, and finally filtering out the records of storage units that meet all verification conditions.

6. A knowledge graph storage and query device based on a graph database, characterized in that: It includes a mapping module, a storage module, and a query module. The mapping module collects all attributes involved in the knowledge graph and constructs a central mapping registry for the global attributes of the knowledge graph in the graph database. Each attribute is assigned a unique attribute location identifier through this central mapping registry. The attribute location identifier includes a storage unit index and an attribute placeholder value. The storage unit index indicates which storage unit the attribute information is stored in, and the attribute placeholder value specifies the attribute's unique identity within that storage unit. The storage module utilizes nodes in the graph database for attribute storage management. Each node in the graph database has a pre-defined composite attribute storage body, which includes at least one of the aforementioned storage units. When a new attribute is assigned to an entity in the knowledge graph, the attribute location identifier corresponding to the new attribute is looked up according to the central mapping registry. Based on the obtained storage unit index and attribute placeholder value, the information of the new attribute is stored. When removing an attribute from an entity in a knowledge graph, the system searches for the attribute's corresponding location identifier based on the central mapping registry. Then, based on the obtained storage unit index and attribute placeholder value, the attribute information is deleted. The query module performs cross-dimensional, multi-attribute combined queries and retrievals: based on query requests for multiple target attributes, it finds the attribute location identifier of each target attribute according to the central mapping registry, obtains the storage unit index of each target attribute, and if the storage unit indexes of all target attributes are the same, it performs an internal retrieval within the storage unit; if the storage unit indexes of the target attributes are different, it performs a cross-storage unit association retrieval.

7. A knowledge graph storage and query device based on a graph database according to claim 6, characterized in that: The mapping module assigns attribute location identifiers to attributes through a central mapping registry, including: analyzing the co-occurrence frequency of different attributes being queried simultaneously based on historical query logs. The co-occurrence frequency refers to the frequency with which attributes are combined in the same retrieval, and attributes with higher co-occurrence frequencies are preferentially assigned to the same storage unit index.

8. A knowledge graph storage and query device based on a graph database according to claim 6, characterized in that: When a new attribute is introduced, the mapping module registers it through the central mapping registry and finds an unoccupied binary bit in the last storage unit to assign an attribute location identifier to the new attribute. Once all the bits in the storage unit have been allocated, a new storage unit is enabled through the composite attribute storage body.

9. A knowledge graph storage and query device based on a graph database according to claim 6, characterized in that: The storage module assigns new attributes to entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body according to the obtained storage unit index, performing a logical union calculation on the attribute placeholder base value of the new attribute and the value currently stored in the selected storage unit, and storing the calculated new value back to the storage unit. The logical union calculation means merging the two values ​​while ensuring that their independent placeholder information is not lost, thus completing the information storage of the new attribute. The storage module removes attributes from entities in the knowledge graph, including: selecting the correct storage unit in the composite attribute storage body based on the obtained storage unit index; performing a logical difference calculation between the attribute's placeholder reference value and the currently stored value in the selected storage unit; storing the calculated new value back into the storage unit; the logical difference calculation refers to performing a logical intersection calculation with the inverted value of the attribute's placeholder reference value; removing the attribute's placeholder information from the original value; and completing the deletion of the attribute's information.

10. A knowledge graph storage and query device based on a graph database according to claim 6, characterized in that: The query module performs internal retrieval within the storage unit, including: calculating the logical union of all target attribute placeholder benchmark values ​​to form a single retrieval verification benchmark value; performing a numerical matching verification calculation in the graph database; performing a logical intersection detection between the value of the recorded storage unit and the retrieval verification benchmark value; and proving that the recorded storage unit matches all query conditions if the detection result is completely equal to the retrieval verification benchmark value itself. Perform cross-storage unit association retrieval, including: performing independent numerical matching verification calculations for each involved storage unit and the corresponding retrieval verification benchmark value, and associating the independent verification steps through logical AND, and finally filtering out the records of storage units that meet all verification conditions.

Citation Information

Patent Citations

  • Knowledge graph-based index creation method and device

    CN114297334A

  • Semantic search method based on secret state knowledge graph

    CN119691810A