Storage method and apparatus

CN123011896APending Publication Date: 2026-10-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510573182.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]然而,真实的知识图谱数据往往比较稀疏,并且没有固定的模式,这导致基于关系的存储方案很难实现高效的知识图谱数据存储

Benefits of technology

[0012]通过上述几种可能的设计,本申请实现了对知识图谱中实体的高频次属性采用关系型存储方式进行存储,以及对知识图谱中实体的低频次属性采用非结构化存储方式(如KV方式)进行存储的混合存储模式,如此不仅能避免采用KV存储知识图谱中包含高频次属性在内的所有属性时键名大量重复的问题,还能解决采用关系型存储方式存储低频次属性时出现大量空值的问题,如此实现了知识图谱的高效存储。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011896A_ABST
    Figure CN123011896A_ABST
Patent Text Reader

Abstract

The application discloses a storage method and device, and belongs to the technical field of storage. The method comprises the following steps: acquiring an entity set, the entity set comprising a plurality of entities, the entity being an entity represented by a node of a knowledge graph, and the entity comprising at least one attribute; and storing the attributes of the entities in the entity set based on the frequency of each attribute contained by the entities in the entity set. The frequency of the attribute is used to indicate the number of entities in the entity set containing the attribute. Since the method stores the attributes of the entities in the knowledge graph based on the frequency of each attribute contained by the entities in the knowledge graph, for example, the high-frequency attributes of the entities in the knowledge graph are stored in a relational storage mode, and the low-frequency attributes are stored in a KV mode, the method can not only avoid the problem of a large number of repeated key names when all the attributes in the knowledge graph are stored in the KV mode, but also solve the problem of a large number of null values when the low-frequency attributes are stored in the relational storage mode, so that efficient storage of the knowledge graph is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to a storage method and apparatus. Background Technology

[0002] With the development of big data and the promotion of linked data, knowledge in more and more fields is being represented using knowledge graphs (KGs). Examples of fields that represent data in KG form include, but are not limited to, biomedicine, encyclopedias, and common knowledge.

[0003] Current mainstream knowledge graph storage solutions mainly include relational storage solutions. Relational storage solutions are primarily implemented using relational databases. Examples of relational storage solutions include, but are not limited to: triple tables, horizontal tables, property tables, vertical partitioning storage solutions, and sextuple indexing storage solutions.

[0004] However, real-world knowledge graph data is often sparse and lacks a fixed pattern, making it difficult for relation-based storage solutions to achieve efficient knowledge graph data storage. Summary of the Invention

[0005] This application provides a storage method and apparatus that enables efficient storage of knowledge graphs.

[0006] The technical solution provided in this application is as follows.

[0007] In a first aspect, this application provides a storage method, the method comprising: obtaining an entity set, the entity set including multiple entities, wherein the entities in the entity set are entities represented by nodes of a knowledge graph, and the entities in the entity set contain at least one attribute; storing the attributes of the entities in the entity set based on the frequency of each attribute contained in the entities in the entity set. Wherein, the entities in the entity set contain a first attribute, and the frequency of the first attribute is used to indicate the number of entities in the entity set containing the first attribute.

[0008] The method provided in this application achieves the goal of storing entity attributes in a knowledge graph based on the frequency of each attribute contained in the entity. For example, high-frequency attributes of entities in a knowledge graph can be stored using relational storage, while low-frequency attributes of entities in a knowledge graph can be stored using key-value (KV) storage. This avoids the problem of a large number of duplicate key names when storing all attributes in a knowledge graph using KV storage, and also solves the problem of a large number of null values ​​when storing low-frequency attributes using relational storage. Therefore, this method greatly compresses the storage space of the knowledge graph and achieves efficient storage of the knowledge graph.

[0009] In one possible design approach, storing the attributes of entities in the entity set based on the frequency of each attribute contained in the entities in the entity set includes: storing high-frequency attributes contained in the entities in the entity set using a relational storage method. The relational table used to store high-frequency attributes includes an identifier (ID) column and at least one high-frequency attribute column. The ID column stores the entity's ID, and each high-frequency attribute column stores one high-frequency attribute. When the number or proportion of entities in the entity set containing a first attribute exceeds a first threshold, the first attribute is considered a high-frequency attribute.

[0010] In another possible design approach, when the number or proportion of entities in the entity set containing the first attribute is below a first threshold, the first attribute is considered a low-frequency attribute, and the aforementioned relation table also includes a rare attribute column. The aforementioned storage of entity attributes in the entity set based on the frequency of each attribute contained in the entity set includes: storing low-frequency attributes contained in the entity set in the rare attribute column using an unstructured storage method.

[0011] In another possible design approach, the unstructured storage method is the KV storage method.

[0012] Through the above-mentioned possible designs, this application realizes a hybrid storage mode that uses relational storage to store high-frequency attributes of entities in a knowledge graph and unstructured storage (such as key-value pairs) to store low-frequency attributes of entities in a knowledge graph. This not only avoids the problem of a large number of duplicate key names when using key-value pairs to store all attributes, including high-frequency attributes, in a knowledge graph, but also solves the problem of a large number of null values ​​when using relational storage to store low-frequency attributes. Thus, efficient storage of knowledge graphs is achieved.

[0013] In another possible design approach, storing the attributes of entities in an entity set based on the frequency of each attribute contained in the entity set includes: determining multiple entity clusters based on the types of entities in the entity set, where each entity cluster includes at least one entity in the entity set, and the at least one entity has the same type; for a first entity cluster among the multiple entity clusters, storing the high-frequency attributes contained in the entities in the first entity cluster using a high-frequency attribute column in a first relational table, and storing the low-frequency attributes contained in the entities in the first entity cluster in an unstructured storage manner in a rare attribute column included in the first relational table. Here, the first entity cluster is any entity cluster among the multiple entity clusters. When the number of entities in the first entity cluster containing a second attribute exceeds a second threshold, the second attribute is a high-frequency attribute. When the number of entities in the first entity cluster containing a second attribute is less than the second threshold, the second attribute is a low-frequency attribute. The first relational table is a relational table used to store the attributes contained in the entities in the first entity cluster.

[0014] This design enables the storage of entities within a set of similar entities based on the frequency of each attribute. This reduces the problem of excessive storage space wastage caused by a large number of null values ​​in tables storing entities and their attributes, especially when attribute frequency distributions are extreme. An example of an extreme attribute frequency distribution is when two attributes of an entity in the set are both high-frequency attributes, but these two attributes are distributed across completely different entities in the set.

[0015] In another possible design approach, determining multiple entity clusters based on the types of entities in the entity set includes: grouping entities of the same type in the entity set into one entity cluster to obtain multiple entity clusters; or, determining multiple entity clusters based on the types of entities in the entity set and the attributes contained in the entities, wherein the multiple entity clusters include a first entity cluster, which is any one of the multiple entity clusters, and each entity in the first entity cluster contains common attributes.

[0016] In another possible design approach, the above-mentioned determination of multiple entity clusters based on the types and attributes of entities in the entity set includes: grouping entities of the same type in the entity set into one entity cluster to obtain multiple entity clusters; for a first entity cluster among the multiple entity clusters, dividing the first entity cluster into multiple unit clusters, each unit cluster containing one or more entities of the first entity cluster with the same attributes; determining a first unit cluster and a second unit cluster among the multiple unit clusters, wherein the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the second unit cluster is greater than a third threshold; for a third unit cluster among the multiple unit clusters, if the first dissimilarity is less than the second dissimilarity, grouping the first unit cluster and the third unit cluster into one entity cluster, and if the second dissimilarity is less than the first dissimilarity, grouping the second unit cluster and the third unit cluster into one entity cluster; wherein the first dissimilarity is the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the third unit cluster, and the second dissimilarity is the dissimilarity between the attributes contained in the entities in the second unit cluster and the attributes contained in the entities in the third unit cluster.

[0017] This design enables clustering of entities based on the dissimilarity of entity attributes. When storing entities based on the frequency of each attribute contained in the clustered entities, it avoids the problem of a large number of null values ​​generated in the tables storing entities and their attributes when the frequency distribution of attributes is extreme, thus preventing a significant waste of storage space.

[0018] Secondly, this application provides a storage device. This storage device is used to execute any of the methods provided in the first aspect. This application can divide the storage device into functional modules according to any of the methods provided in the first aspect. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into a single processing module. For example, this application can divide the storage device into acquisition units and storage units according to their functions. Descriptions of the possible technical solutions and beneficial effects of the various functional modules described above can be found in the solutions provided in the first aspect and any possible design method within the first aspect, and will not be repeated here.

[0019] Thirdly, this application provides a computing device. The computing device includes: a memory, a communication interface, and one or more processors. The one or more processors receive or transmit data through the communication interface, and are configured to read program instructions stored in the memory to execute the methods provided by the first aspect and any possible design of the first aspect.

[0020] Fourthly, this application provides a computer-readable storage medium that is a non-volatile computer-readable storage medium, the computer-readable storage medium including computer program instructions, which, when executed by a processor, a computing device including a processor, or a computer system, perform the methods provided by the first aspect and any possible design of the first aspect.

[0021] Fifthly, this application provides a computer program product containing instructions that, when executed by a processor, a computing device including a processor, or a computer system, cause the processor, the computing device including a processor, or the computer system to perform the methods provided by the first aspect and any possible design of the first aspect.

[0022] Sixthly, this application provides a chip that includes a processor for running program instructions or code. The chip or a device including the chip can be used to perform methods provided by the first aspect and any possible design embodiment within the first aspect. Exemplarily, the chip further includes an input interface, an output interface, and a memory. The chip's input interface, output interface, processor, and memory are connected via internal interconnection paths. The memory in the chip stores program instructions or code executed by the processor, and the input and output interfaces are used for communication and connection between the chip and other chips or devices.

[0023] It is understood that any of the storage devices, computing devices, computer-readable storage media, computer program products or chips provided above can be applied to the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.

[0024] In this application, the names of the aforementioned storage devices, etc., do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those in this application, they all fall within the protection scope of this application. Attached Figure Description

[0025] Figure 1 This is a schematic diagram of an implementation environment for the method provided in the embodiments of this application;

[0026] Figure 2 This is a flowchart illustrating a storage method provided in an embodiment of this application;

[0027] Figure 3 This is a schematic diagram illustrating the process of storing the attributes of entities in an entity set based on the frequency of each attribute contained in the entity set, as provided in an embodiment of this application.

[0028] Figure 4 This is a flowchart illustrating another storage method provided in an embodiment of this application;

[0029] Figure 5 This is a schematic diagram illustrating the process of determining multiple entity clusters based on the type of entities in an entity set and the attributes contained in the entities, as provided in an embodiment of this application.

[0030] Figure 6 This is another schematic diagram of the storage method provided in the embodiments of this application;

[0031] Figure 7 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application;

[0032] Figure 8 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0034] To facilitate understanding, the technologies and background involved in the embodiments of this application will be explained below.

[0035] Knowledge graph: In one common definition, a knowledge graph is a semantic network consisting of nodes and edges connecting them. Nodes represent entities or concepts, and edges represent the various semantic relationships between entities / concepts. In another, broader definition, a knowledge graph uses a graph as its underlying representation model to organize and utilize large-scale, diverse data to express explicit, general, or domain-specific knowledge.

[0036] Currently, fields that represent data in KGs (Knowledge Graphs) include, but are not limited to, biomedicine, encyclopedias, and common-sense knowledge. Furthermore, data represented in KGs is frequently used to enhance tasks such as entity recognition, query answering, and web search. With the continuous emergence of large-scale knowledge graph data, many knowledge graph datasets exceed one billion triples. Each triple represents a piece of knowledge in the knowledge graph, which is a relationship between entities or an attribute of an entity. Alternatively, the relationship between entities or the attribute of an entity can be understood as being described by three elements: subject, predicate, and object; these three elements are simply called a triple.

[0037] As knowledge graphs continue to grow in scale, their utility expands into new scenarios. In these scenarios, applications can access large knowledge graphs for various purposes. For example, a search engine might use SPARQL to query a knowledge graph, enriching search results with graph embeddings and then calculating centrality metrics to rank the results. In this case, the storage engine must be able to efficiently access large knowledge graphs and support efficient access from the query processing layer. SPARQL, short for SPARQL protocol and RDF query language, is a standardized language specifically designed for querying and manipulating Resource Description Framework (RDF) data.

[0038] Large-scale knowledge graphs are playing an increasingly important role in the digital age. They are not merely information repositories, but also key tools for connecting and interpreting the relationships behind complex data. Typically, large-scale knowledge graphs are primarily used in scenarios with frequent queries and infrequent modifications. Whether it's information retrieval in search engines, question-and-answer services in intelligent assistants, or knowledge discovery in scientific research, users increasingly rely on queries to obtain information from knowledge graphs rather than frequently modifying their content. This trend not only saves system resources but also improves query efficiency, thereby meeting users' needs for immediate and accurate information.

[0039] Given that large-scale knowledge graphs are primarily used in scenarios with frequent queries and infrequent modifications, stability and consistency are paramount in their design. Since knowledge graphs are often used to represent relationships and attributes between entities, frequent modifications can lead to data inconsistencies and information chaos. Therefore, large-scale knowledge graphs typically prioritize maintaining data stability and consistency by regularly maintaining and updating the knowledge graph, rather than frequently modifying it. This ensures the reliability and durability of information.

[0040] Furthermore, cost and efficiency considerations have also promoted the application of knowledge graphs in scenarios with many queries and few modifications. Optimizing the query performance of knowledge graphs can significantly improve the overall efficiency of systems that utilize them. By applying knowledge graphs to systems, not only can system stability be guaranteed, but the challenges and demands of large-scale applications can also be effectively addressed. For example, clinical decision support systems in the healthcare field, risk management in the financial industry, and personalized recommendation systems in e-commerce are typical examples of the successful application of knowledge graphs in scenarios with many queries and few modifications. These applications not only improve work efficiency but also provide users with a more accurate and personalized service experience.

[0041] Currently, mainstream knowledge graph storage solutions can be broadly categorized into two types: 1. Relational-based storage solutions; 2. Native knowledge graph storage solutions. Native knowledge graph storage is a storage management solution specifically designed for knowledge graphs and generally offers better performance. However, relational-based storage solutions are more mature and feature-rich than native knowledge graph storage solutions, and significantly outperform native solutions in several aspects, including scalability, transaction support, data compression, and security.

[0042] Because real-world knowledge graph data is often sparse and lacks a fixed pattern, knowledge graph data management presents significant challenges. This characteristic makes efficient knowledge graph data storage difficult to achieve on relational databases. In related technologies, relational storage schemes for knowledge graphs are primarily implemented using relational databases / tables. Exemplary relational storage schemes include, but are not limited to: triple tables, horizontal tables, attribute tables, vertical partitioning storage schemes, and six-fold indexing storage schemes. The following is a brief introduction to triple tables, horizontal tables, attribute tables, vertical partitioning storage schemes, and six-fold indexing storage schemes.

[0043] Triple tables are the simplest and most direct way to store knowledge graphs in relational databases. Specifically, a triplet table with a subject, predicate, and object is created in the relational database, and each triplet in the knowledge graph is stored as a row in the triplet table. A representative system using the triplet table storage scheme is the 3store system. While the triplet table storage scheme is simple and straightforward, the number of rows in the triplet table is the same as the number of edges in the knowledge graph. The biggest problem lies in the self-join problem of the triplet table after translating knowledge graph queries into Structured Query Language (SQL) queries. Multiple accesses to the same triplet table are called self-joins (i.e., multiple joins to the same triplet table for queries). For example, when querying the friends of A's friends, a first join to query A's friends is needed, followed by a second join to query those friends' friends. Each join requires a full traversal of the triplet table. When the triplet size is large, the self-join problem can severely impact SQL query performance.

[0044] A horizontal table is a table where each row records all the predicates and objects of a subject in a knowledge graph, essentially acting as an adjacency list for the knowledge graph. The number of columns in a horizontal table represents the number of distinct predicates in the knowledge graph, and the number of rows represents the number of distinct subjects. A representative example of a horizontal table storage scheme is the distributed linked database (DLDB) in the RDF database system. Compared to triple tables, horizontal tables can obtain query results through a single table traversal, thus improving query efficiency. However, horizontal table schemes are prone to exceeding the maximum number of columns and can also lead to an excessive number of null values.

[0045] Attribute Tables: The attribute table storage scheme is a refinement of the horizontal table approach. Specifically, it stores subjects of the same type in one table and subjects of different types in different tables. A representative system using the attribute table storage scheme is the RDF triplet library "Jena" (a database). Attribute tables overcome the self-join problem of triplet tables and solve the problem of excessive columns in horizontal tables. For large-scale real-world knowledge graph data, the attribute table scheme may require thousands to tens of thousands of tables to store different subject categories, often exceeding the limits of relational databases. Furthermore, in the attribute table storage scheme, when different subjects of the same type have significantly different predicate sets, a large number of null values ​​may be generated.

[0046] Vertical partitioning storage scheme: A table with two columns (subject and object) is created for each predicate, storing the subject and object values ​​connected by that predicate. The total number of tables corresponds to the number of different predicates in the knowledge graph. An example database using this scheme is "SW-Store". Vertical partitioning solves the null and multi-value problems of the schemes mentioned above and supports fast join queries between different predicate tables. However, like the attribute table scheme, it still suffers from an excessive number of tables, leading to higher data update and maintenance costs and time overhead from numerous table joins.

[0047] The six-fold index storage scheme is an extension of the triplet table and a typical "space-for-time" strategy. It establishes six tables corresponding to all six permutations of triplet tables. Exemplary systems using this scheme include RDF-3X and Hexastore. By joining these six tables, the six-fold index storage scheme not only alleviates the self-join problem of single-table triplet tables but also accelerates the efficiency of certain typical knowledge graph queries. However, it incurs significant storage space overhead, index maintenance costs, and consistency maintenance costs during data updates. These issues become increasingly prominent as the knowledge graph grows in size.

[0048] To overcome the aforementioned problems, embodiments of this application provide a storage method that balances the advantages and disadvantages of relation-based storage schemes and key-value (KV) storage schemes, enabling efficient storage and management of large-scale knowledge graphs while maintaining data flexibility. Specifically, this method stores entity attributes in the knowledge graph based on the frequency of each attribute contained in the entity. For example, by storing high-frequency attributes of entities in the knowledge graph using relational storage (i.e., relation-based storage scheme) and low-frequency attributes using KV storage, this avoids the problem of numerous duplicate key names when storing all attributes in the knowledge graph using KV storage, and solves the problem of numerous null values ​​when storing low-frequency attributes using relational storage. Furthermore, this method significantly reduces the storage space required to store the knowledge graph.

[0049] Relational storage is the core storage solution for enterprise applications and transaction systems. Specifically, it is a data management method based on the relational model, using tables as the core data structure and operating through SQL.

[0050] refer to Figure 1 , Figure 1 A schematic diagram of an implementation environment for the method provided in the embodiments of this application is shown. Figure 1 As shown, this implementation environment can be any computing device capable of storing data. For example, the computing device can be a general-purpose computer, a laptop computer, or other terminal device. As another example, the computing device can be a device implementing a storage system or server, or any device in a cluster of devices implementing a storage system or server; there is no limitation in this regard.

[0051] By executing the storage method provided in the embodiments of this application, the aforementioned computing device can efficiently store the attributes of entities in the acquired knowledge graph, and can avoid null values ​​generated when storing the attributes of entities in the knowledge graph to the greatest extent, and greatly compress the storage space of the knowledge graph.

[0052] In this embodiment, any entity in a knowledge graph that contains at least one attribute is called an entity set. Optionally, the entities in an entity set contain at least one attribute. For example, a node in knowledge graph 1 represents information about city A, meaning city A is an entity in knowledge graph 1. In this case, the attributes of the entity include, but are not limited to, city A belonging to province B, the population of city A, the geographical area of ​​city A, and the number of universities in city A. As another example, a node in knowledge graph 2 represents information about person A, meaning person A is an entity in knowledge graph 2. In this case, the attributes of the entity include, but are not limited to, person A's gender, age, date of birth, place of birth, and place of work.

[0053] For simplicity, in this embodiment of the application, the set of all attributes contained in an entity in the entity set is called the attribute set of that entity.

[0054] It should be understood that the above content is an exemplary description of the implementation environment of the method provided in the embodiments of this application, and does not constitute a limitation on the implementation environment of the method. As those skilled in the art know, as business needs change, the implementation environment can be adjusted according to application requirements, and the embodiments of this application do not list them one by one.

[0055] This application also provides a storage device for executing the storage method provided in this application. Exemplarily, this device can be implemented as the aforementioned computing device or a functional module within a computing device, and is not limited thereto.

[0056] The implementation process of the storage method provided in the embodiments of this application will be described below.

[0057] refer to Figure 2 , Figure 2 A flowchart illustrating a storage method provided in an embodiment of this application is shown. Optionally, the method is... Figure 1 The computing device shown performs the operation. For example... Figure 2 As shown, the method includes the following steps.

[0058] Step 101: The computing device obtains an entity set, which includes multiple entities. Entities are entities represented by nodes in the knowledge graph.

[0059] Among them, a knowledge graph is any knowledge graph to be stored.

[0060] In the embodiments of this application, any entity in a knowledge graph that contains at least one attribute is called an entity set.

[0061] Optionally, the computing device may receive a set of entities input by the user through an input interface. Alternatively, the computing device may receive a set of entities sent by other devices, without limitation.

[0062] Step 102: The computing device stores the attributes of the entities in the entity set based on the frequency of each attribute contained in the entity set.

[0063] In this context, for any entity in the entity set that contains a first attribute, the frequency of the first attribute is used to indicate the number of entities in the entity set that contain the first attribute. For example, if an entity in the entity set contains attribute 1, and all m entities in the entity set contain attribute 1, then the frequency of attribute 1 is m.

[0064] In this embodiment of the application, the computing device is able to divide all attributes contained in an entity in an entity set into high-frequency attributes and low-frequency attributes according to the frequency of each attribute.

[0065] Taking a first attribute contained in an entity set as an example, when the number or proportion of entities in the entity set containing the first attribute exceeds a first threshold, the first attribute is a high-frequency attribute. That is, when the number or proportion of entities in the entity set containing the first attribute exceeds the first threshold, it indicates that a large number of entities in the entity set contain the first attribute; therefore, this embodiment defines the first attribute as a high-frequency attribute. Correspondingly, when the number or proportion of entities in the entity set containing the first attribute is lower than the first threshold, the first attribute is a low-frequency attribute. That is, when the number or proportion of entities in the entity set containing the first attribute is lower than the first threshold, it indicates that only a small number of entities in the entity set contain the first attribute; therefore, this embodiment defines the first attribute as a low-frequency attribute. This embodiment does not specifically limit the value of the first threshold.

[0066] In one example, the first threshold is a specific quantity. For instance, taking a first threshold of 50, if the computing device determines that the number of entities in the entity set containing the first attribute exceeds 50, then the first attribute is determined to be a high-frequency attribute. Conversely, if the computing device determines that the number of entities in the entity set containing the first attribute is less than 50, then the first attribute is determined to be a low-frequency attribute.

[0067] In another example, the first threshold is a percentage. In this case, taking a first threshold of 60% as an example, if the computing device determines that the number of entities in the entity set containing the first attribute accounts for more than 60% of the total number of entities in the entity set, then the first attribute is determined to be a high-frequency attribute. Conversely, if the computing device determines that the number of entities in the entity set containing the first attribute accounts for less than 60% of the total number of entities in the entity set, then the first attribute is determined to be a low-frequency attribute.

[0068] Therefore, in this embodiment of the application, after the computing device obtains the entity set, it can first count the frequency of each attribute based on the attributes contained in each entity in the entity set, and further determine the high-frequency attributes and low-frequency attributes among the attributes contained in the entities in the entity set based on the frequency of each attribute and a first threshold.

[0069] Alternatively, the computing device can directly count the frequency of each attribute contained in the entities in the entity set.

[0070] Optionally, the computing device can aggregate entities with the same attributes into a subset based on the attributes contained in each entity in the entity set. The number of entities contained in a subset is then the frequency of the attribute set of that subset. Here, the attributes contained in entities within a subset (i.e., the aforementioned shared attributes) constitute the attribute set of that subset. For example, if the computing device aggregates all entities in the entity set that have attributes 1 and 2 into entity subset 1, then the attribute set of entity subset 1 (called attribute set 1) is (attribute 1, attribute 2). If the computing device determines that the number of entities in entity subset 1 is 100, then it can determine that the frequencies of attributes 1 and 2 in attribute set 1 are both 100.

[0071] Subsequently, the computing device uses different storage methods (i.e., hybrid storage) to store the high-frequency and low-frequency attributes of entities in the entity set.

[0072] It should be noted that an entity in an entity set may contain only high-frequency attributes, or only low-frequency attributes, or both high-frequency and low-frequency attributes at the same time.

[0073] In one exemplary embodiment, reference is made to Figure 3 The process by which a computing device stores the attributes of entities in an entity set based on the frequency of each attribute contained in the entity set can be implemented by the following steps 1021 to 1022.

[0074] Step 1021: The computing device uses a relational storage method to store the high-frequency attributes contained in the entities in the entity set.

[0075] When a computing device uses relational storage to store the high-frequency attributes of entities in an entity set, the specific implementation is to store these high-frequency attributes in a relational table. In other words, when a computing device uses relational storage to store the high-frequency attributes of entities in an entity set, it specifically stores these high-frequency attributes through a relational table.

[0076] In this embodiment, the relational table used to store high-frequency attributes using a relational storage method includes an ID column and at least one high-frequency attribute column, or an ID row and at least one high-frequency attribute row. The ID column / row stores the IDs of entities in the entity set, and the high-frequency attribute column / row stores high-frequency attributes. It should be understood that the number of high-frequency attribute columns / rows in the relational table is the same as the number of high-frequency attributes contained in the entities in the entity set, and they correspond one-to-one; that is, one high-frequency attribute column / row stores one high-frequency attribute contained in an entity in the entity set. Optionally, in the relational table used to store high-frequency attributes using a relational storage method, the name of the ID column / row can be the entity ID, and the name of each high-frequency attribute column / row is the name of a specific high-frequency attribute.

[0077] For example, taking a relational table that includes an ID column and at least one high-frequency attribute column as an example, assuming that the computing device determines that there are 3 high-frequency attributes among the attributes contained in the entity set, the relational table used to store these 3 high-frequency attributes in relational storage includes an ID column and 3 high-frequency attribute columns. The ID column is used to store the ID of the entity in the entity set, and the 3 high-frequency attribute columns are used to store these 3 high-frequency attributes one by one.

[0078] In one example, referring to Table 1, assuming the entity set contains 5 entities with IDs ID1 to ID5, and the computing device determines that attributes 1, 2, and 3 of each entity in the entity set are high-frequency attributes, the relational table (denoted as Relational Table 1) used by the computing device to store the high-frequency attributes of the entities in the entity set using relational storage is shown in Table 1. The ID column is named "Entity ID," and the high-frequency attribute columns are named the high-frequency attributes, namely attribute 1, attribute 2, and attribute 3. Thus, the values ​​of attribute 1, attribute 2, and attribute 3 contained in the entity set are stored in the cell where the row containing the entity intersects with the high-frequency attribute column. "**" indicates that a specific value exists.

[0079] Table 1

[0080] Entity ID Attribute 1 Attribute 2 Attribute 3 ID 1 ** ** ** ID 2 ** ** ** ID 3 ** ** ** ID 4 ** ** ** ID 5 ** ** **

[0081] In another example, referring to Table 1, assuming the entity set contains 10 entities with IDs ID 1 to ID 10, and the computing device determines that entities with IDs ID 1 to ID 5 contain attribute 1, attribute 2, and attribute 3 as high-frequency attribute 1, and entities with IDs ID 6 to ID 10 contain attribute 4 as high-frequency attribute 2, then the relational table (denoted as relational table 2) used by the computing device to store the high-frequency attributes of the entities in the entity set using relational storage is shown in Table 2. The ID column is named "Entity ID," and the high-frequency attribute columns are named the high-frequency attributes, namely attribute 1, attribute 2, attribute 3, and attribute 4. Thus, the values ​​of attribute 1, attribute 2, attribute 3, and attribute 4 contained in the entities in the entity set are stored in the cells where the row containing the entity intersects with the corresponding high-frequency attribute column. It can be seen that in this scenario, there are some empty cells in relational table 2. For example, entities with IDs 6 through 10 do not contain attributes 1 through 3, so the corresponding cells will be empty. Similarly, entities with IDs 1 through 5 do not contain attribute 4, so the corresponding cells will also be empty. Here, "**" indicates that a specific value exists. "Empty" indicates that the value is empty.

[0082] Table 2

[0083] Entity ID Attribute 1 Attribute 2 Attribute 3 Attribute 4 ID 1 ** ** ** null ID 2 ** ** ** null ID 3 ** ** ** null ID 4 ** ** ** null ID 5 ** ** ** null ID 6 null null null ** ID 7 null null null ** ID 8 null null null ** ID 9 null null null ** ID 10 null null null **

[0084] As shown in Tables 1 and 2, after storing the high-frequency attributes of entities in the entity set using a relational storage method, the ID in the ID column of the corresponding relational table can be used as the primary key for querying entity attribute information, while the attribute values ​​in the high-frequency attribute column are the key values ​​of the primary key. Furthermore, when the entities in the entity set contain only high-frequency attributes, the relational table storing the high-frequency attributes on the computing device is actually a horizontal table.

[0085] Step 1022: The computing device stores the low-frequency attributes contained in the entities in the entity set in an unstructured storage manner in the rare attribute column.

[0086] In this embodiment, if the computing device determines that a low-frequency attribute exists among the attributes contained in the entities in the entity set (for example, when the number or proportion of entities containing a first attribute in the entity set is lower than a first threshold, it indicates that the first attribute is a low-frequency attribute, that is, the first attribute, which is a low-frequency attribute, exists among the attributes contained in the entities in the entity set), then the relational table used by the computing device in step 1021 to store high-frequency attributes in relational storage also includes a rare attribute column or a rare attribute row. It should be understood that when the relational table used to store high-frequency attributes in relational storage includes an ID column and at least one high-frequency attribute column, the relational table also includes a rare attribute column. When the relational table used to store high-frequency attributes in relational storage includes an ID row and at least one high-frequency attribute row, the relational table also includes a rare attribute row. Optionally, the name of the rare attribute column / rare attribute row is "rare attribute".

[0087] Furthermore, the computing device can store the low-frequency attributes contained in entities within the entity set in an unstructured storage manner within the rare attribute column / row. In one example, the unstructured storage method is KV storage, in which case the value of the row containing the low-frequency attribute in the rare attribute column / row is a key-value pair consisting of the attribute name and the specific attribute value of the low-frequency attribute.

[0088] In one example, taking a relational table that includes an ID column, at least one high-frequency attribute column, and a rare attribute column, referring to Table 3, assuming the entity set contains 8 entities with IDs ID1 to ID8, and the computing device determines that entities with IDs ID1 to ID5 contain attributes 1, 2, and 3 as high-frequency attributes, entities with IDs ID6 to ID7 contain attribute 5 as low-frequency attribute 1, and entities with IDs ID8 contain attribute 6 as low-frequency attribute 2, then the relational table used by the computing device to store the high-frequency attributes of the entities in the entity set using relational storage (denoted as relational table 3) is shown in Table 3. It includes an ID column, three high-frequency attribute columns for storing attributes 1 to 3, and one rare attribute column. The ID column is named "Entity ID," the high-frequency attribute columns are named the high-frequency attributes (i.e., attribute 1, attribute 2, and attribute 3), and the rare attribute column is named "Rare Attribute."

[0089] Table 3

[0090] Entity ID Attribute 1 Attribute 2 Attribute 3 Rare attributes ID 1 ** ** ** null ID 2 ** ** ** null ID 3 ** ** ** null ID 4 ** ** ** null ID 5 ** ** ** null ID 6 null null null {Name of attribute 5 + Value of attribute 5} ID 7 null null null {Name of attribute 5 + Value of attribute 5} ID 8 null null null {Name of attribute 6 + Value of attribute 6}

[0091] It can be seen that when entities in an entity set contain both high-frequency and low-frequency attributes, the computing device stores the high-frequency attributes in a separate column (i.e., the high-frequency attribute column) and stores all the low-frequency attributes in a separate column (i.e., the rare attribute column) in the relation table. Alternatively, the computing device stores the high-frequency attributes in a separate row (i.e., the high-frequency attribute row) and stores all the low-frequency attributes in a separate row (i.e., the rare attribute row) in the relation table.

[0092] That is, as shown in Table 4, the table used to store entity attributes in the entity set contains 2+count(n) columns, where count(n) represents the number of high-frequency attributes of the entity in the entity set. The first column stores the unique ID of the entity in the entity set as the primary key for querying information. The count(n) columns after the first column are used to store the high-frequency attributes contained in the entity, and the name of the high-frequency attribute of the entity is used as the name of each column. The last column is called the rare attribute column, which is used to store the low-frequency attributes contained in the entity, and the value of the last column consists of key-value pairs of the name and value of the low-frequency attribute.

[0093] Table 4

[0094] Entity ID High frequency attribute 1 … Rare attributes … … … … … … … …

[0095] Furthermore, as shown in Table 5, which illustrates the storage of all attributes (including high-frequency and low-frequency attributes) of entities in the entity set shown in Table 3 using a horizontal table approach, it can be seen that for the same entity set, the number of columns and null values ​​generated when storing entity attributes using the scheme of this application (corresponding to Table 3) are reduced compared to the number of columns and null values ​​generated when storing using a horizontal table approach. Therefore, the scheme of this application can save storage space for storing the knowledge graph.

[0096] Table 5

[0097] Entity ID Attribute 1 Attribute 2 Attribute 3 Attribute 5 Attribute 6 ID 1 ** ** ** null null ID 2 ** ** ** null null ID 3 ** ** ** null null ID 4 ** ** ** null null ID 5 ** ** ** null null ID 6 null null null ** null ID 7 null null null ** null ID 8 null null null null **

[0098] The method described in steps 101-102 achieves efficient storage of entities and their attributes in the entity set corresponding to the knowledge graph. This method improves query efficiency for high-frequency attributes by storing them in a relational storage manner, and reduces the number of columns and null values ​​in the table storing entities and their attributes by storing them in an unstructured manner. This effectively reduces the storage space occupied when storing entities and their attributes in the entity set, thereby reducing the index maintenance cost and data update consistency maintenance cost of the table used to store entities and their attributes. In one example, actual measurements show that when the entity set's entities and their attributes are stored using a hybrid storage scheme combining relational and unstructured storage methods provided in this application embodiment, the storage space is reduced by half compared to using only a single storage method.

[0099] In some embodiments, when using steps 101-102 described above to store the attributes of all entities in the entity set according to their frequency using different storage methods, in cases where the frequency distribution of attributes is extreme, such as when two attributes of an entity in the entity set are both high-frequency attributes, but these two attributes are distributed in completely different entities in the entity set (as shown in Table 2), this will also lead to a large number of null values ​​in the table storing the entities and their attributes (i.e., the relationship table 2 mentioned above), resulting in a significant waste of storage space. To address this problem, embodiments of this application propose entity clustering based on attribute frequency. Entities of the same type are divided according to attribute frequency, so that entities with similar attribute frequency distributions form a cluster. The clusters are then further judged based on high and low frequency attributes and stored in a mixed manner.

[0100] refer to Figure 4 , Figure 4 A flowchart illustrating another storage method provided in an embodiment of this application is shown. Optionally, this method is... Figure 1 The computing device shown performs the operation. (Combined) Figure 2 ,like Figure 4 As shown, the method first performs step 101 as described above, and then replaces step 102 with steps 102a to 102b as described below.

[0101] Step 102a: The computing device determines multiple entity clusters based on the types of entities in the entity set. An entity cluster includes at least one entity in the entity set, and the at least one entity has the same type.

[0102] The computing device can extract the types of entities in the entity set after acquiring the entity set.

[0103] For example, assuming the entity set is S, and any entity in the entity set is s, s∈S, the computing device can use the function getType:s→type to obtain the type of entity s, where type represents the entity type.

[0104] The computing device can then divide the acquired entity set into multiple entity clusters using any of the following methods.

[0105] Method 1: The computing device can directly group entities of the same type in the entity set into one entity cluster, thus dividing the obtained entity set into multiple entity clusters.

[0106] In this approach, an entity cluster includes at least one entity from an entity set, and at least one entity has the same type.

[0107] Method 2: The computing device determines multiple entity clusters based on the types of entities in the entity set and the attributes contained in the entities.

[0108] Multiple entity clusters obtained in this way contain entities of the same type and common attributes. For example, for any entity cluster, such as the first entity cluster, each entity in the first entity cluster has the same type and common attributes. Here, "each entity in the entity cluster contains common attributes" specifically means that the attribute sets corresponding to each entity in the entity cluster have an intersection.

[0109] In one exemplary embodiment, reference is made to Figure 5 The process by which a computing device determines multiple entity clusters based on the types of entities in an entity set and the attributes contained within those entities can be achieved through... Figure 5 Steps s1 to s4 shown are implemented.

[0110] Step s1: The computing device groups entities of the same type in the entity set into one entity cluster to obtain multiple entity clusters.

[0111] After the computing device extracts the type of each entity in the entity set, it can group entities with the same type into one entity cluster, thus dividing the obtained entity set into multiple entity clusters.

[0112] Step s2: For the first entity cluster among multiple entity clusters, divide the first entity cluster into multiple unit clusters. Each unit cluster contains one or more entities with the same attributes in the first entity cluster.

[0113] The first entity cluster is any one of the multiple entity clusters.

[0114] It is understood that the computing device can execute steps s2 to s3 for each of the multiple entity clusters obtained in step s1. The embodiments of this application only use the first entity cluster as an example for description.

[0115] For a first entity cluster, the computing device can aggregate entities with the same attributes in the first entity cluster into a unit cluster based on the attributes contained in each entity in the first entity cluster. That is, a unit cluster contains one or more entities with the same attributes in the first entity cluster. In this way, the computing device can divide the first entity cluster into multiple unit clusters.

[0116] Since entities in a cell cluster contain identical attributes, the attributes of entities in a cell cluster can also be called the attributes or attribute set of that cell cluster.

[0117] Step s3: The computing device determines a first unit cluster and a second unit cluster among multiple unit clusters, wherein the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the second unit cluster is greater than a third threshold.

[0118] The dissimilarity between the attributes contained in entities in the first unit cluster and the attributes contained in entities in the second unit cluster can also be referred to as the dissimilarity between the attribute set of the first unit cluster and the attribute set of the second unit cluster. This dissimilarity is used to measure the similarity / degree of similarity between the attribute set of the first unit cluster and the attribute set of the second unit cluster (or the distance between the first unit cluster and the second unit cluster). This dissimilarity can be calculated using a mathematically defined distance metric formula, and the embodiments of this application do not specifically limit the metric formula.

[0119] In one example, the dissimilarity can be measured by whether the attribute sets of the two unit clusters have common attributes (i.e., whether the attribute sets of the two unit clusters have an intersection), or by the number of common attributes in the attribute sets of the two unit clusters, without limitation. For example, if the attribute set of unit cluster 1 includes attribute 1, attribute 2, and attribute 3, and the attribute set of unit cluster 2 includes attribute 1, attribute 3, and attribute 4, then the attribute sets of unit cluster 1 and unit cluster 2 have 2 common attributes: attribute 1 and attribute 3. Therefore, the computing device can determine that the dissimilarity between the attribute sets of unit cluster 1 and unit cluster 2 is 2.

[0120] Optionally, the computing device can calculate the dissimilarity of the attribute sets of the multiple unit clusters contained in the first entity class cluster pairwise, and determine whether there are two unit clusters among the multiple unit clusters contained in the first entity class cluster whose attribute sets have a dissimilarity greater than a third threshold.

[0121] In one example, the computing device can first calculate the dissimilarity of the attribute sets of multiple unit clusters contained in the first entity cluster to determine the two unit clusters with the maximum dissimilarity of their attribute sets. For example, the computing device can use the function findfarthest:C→(i,j) to determine the two unit clusters with the maximum dissimilarity in the first entity cluster, where C represents the first entity cluster, and i and j are positive integers used to represent the numbers of the two unit clusters in the first entity cluster. Then, the computing device determines whether the maximum dissimilarity is greater than a third threshold, thus determining whether there are two unit clusters among the multiple unit clusters contained in the first entity cluster whose attribute set dissimilarity is greater than the third threshold. For example, if the computing device determines that the maximum dissimilarity is greater than the third threshold, it can determine that there are two unit clusters among the multiple unit clusters contained in the first entity cluster whose attribute set dissimilarity is greater than the third threshold. As another example, if the computing device determines that the maximum dissimilarity is less than the third threshold, it can determine that there are no two unit clusters among the multiple unit clusters contained in the first entity cluster whose attribute set dissimilarity is greater than the third threshold.

[0122] The embodiments of this application do not specifically limit the value of the third threshold.

[0123] When the computing device determines that the attribute sets of two unit clusters among the multiple unit clusters contained in the first entity cluster have a dissimilarity greater than a third threshold, it indicates that the attribute sets of these two unit clusters have low similarity. Therefore, this embodiment considers splitting the first entity cluster into two entity clusters. When the computing device determines that the attribute sets of any two unit clusters among the multiple unit clusters contained in the first entity cluster have a dissimilarity lower than the third threshold, that is, there are no two unit clusters among the multiple unit clusters contained in the first entity cluster with a dissimilarity greater than the third threshold, it indicates that the attribute sets of any two unit clusters in the first entity cluster have high similarity. In this case, this embodiment considers not splitting the first entity cluster, but treating the first entity cluster as a single entity cluster for subsequent operations.

[0124] After the computing device determines that there are two unit clusters among the multiple unit clusters contained in the first entity class cluster that have an attribute set dissimilarity greater than a third threshold, these two unit clusters are identified as the first unit cluster and the second unit cluster.

[0125] Optionally, the first unit cluster and the second unit cluster can be any two unit clusters among the multiple unit clusters contained in the first entity class cluster whose attribute sets have a dissimilarity greater than the third threshold, or they can be the two unit clusters among the multiple unit clusters contained in the first entity class cluster whose attribute sets have the greatest dissimilarity, and there is no limitation on this.

[0126] Step s4: For the third unit cluster among multiple unit clusters, if the first dissimilarity is less than the second dissimilarity, the first unit cluster and the third unit cluster are classified into one entity cluster; if the second dissimilarity is less than the first dissimilarity, the second unit cluster and the third unit cluster are classified into one entity cluster.

[0127] The third unit cluster is any unit cluster among the multiple unit clusters contained in the first entity class cluster, excluding the first and second unit clusters. The first dissimilarity is the dissimilarity between the attributes contained in the entities in the first unit cluster (i.e., the attribute set of the first unit cluster) and the attributes contained in the entities in the third unit cluster (i.e., the attribute set of the third unit cluster). The second dissimilarity is the dissimilarity between the attributes contained in the entities in the second unit cluster (i.e., the attribute set of the second unit cluster) and the attributes contained in the entities in the third unit cluster.

[0128] When the computing device determines that the first dissimilarity is less than the second dissimilarity, it means that the attribute set of the third unit cluster is more similar to the attribute set of the first unit cluster than the attribute set of the second unit cluster. Alternatively, it can be understood that the third unit cluster is closer to the first unit cluster than the distance between the third unit cluster and the second unit cluster. In other words, the distance between the third unit cluster and the first unit cluster is less than the distance between the third unit cluster and the second unit cluster. Therefore, the computing device determines to classify the third unit cluster and the first unit cluster into one entity cluster.

[0129] When the computing device determines that the second dissimilarity is less than the first dissimilarity, it means that the attribute set of the third unit cluster is more similar to the attribute set of the first unit cluster than the attribute set of the third unit cluster. Alternatively, it can be understood that the third unit cluster is closer to the second unit cluster than the distance between the third unit cluster and the first unit cluster. In other words, the distance between the third unit cluster and the second unit cluster is less than the distance between the third unit cluster and the first unit cluster. Therefore, the computing device determines to classify the third unit cluster and the second unit cluster into one entity cluster.

[0130] Similarly, the computing device performs a similar operation on each unit cluster in the first entity class cluster to the third unit cluster, excluding the first, second, and third unit clusters. Specifically, based on the dissimilarity between the attribute set of each unit cluster and the attribute set of the first unit cluster, and based on the dissimilarity between the attribute set of each unit cluster and the attribute set of the second unit cluster, it groups each unit cluster and the first / second unit cluster into one entity cluster. This achieves the goal of splitting the multiple unit clusters contained in the first entity class cluster into two entity clusters. One of these entity clusters includes the first unit cluster and the unit clusters closer to the first unit cluster, while the other entity cluster includes the second unit cluster and the unit clusters closer to the second unit cluster.

[0131] Subsequently, for any entity cluster among the two entity clusters obtained by splitting the first entity cluster, such as the second entity cluster, the computing device executes steps s3 to s4 again for all the unit clusters contained in the second entity cluster, so as to split the second entity cluster into two entity clusters, until the dissimilarity of the attribute sets of any two unit clusters in the entity clusters split by the computing device is lower than the third threshold, or in other words, until the distance between any two unit clusters in the entity clusters split by the computing device is lower than the third threshold.

[0132] Thus, by iteratively executing steps s3 and s4, the embodiments of this application can split the first entity cluster into multiple entity clusters. It should be understood that the attribute set distribution of each unit cluster within the entity cluster ultimately obtained through this process tends to be the same. Furthermore, this process can be called hierarchical clustering. It can be seen that hierarchical clustering creates a hierarchical nested clustering tree by calculating the dissimilarity between different data points (such as the attribute set of a unit cluster). Therefore, the bottom-up hierarchical clustering algorithm can provide the similarity between data points based on the selected distance function and gradually merge data points according to the similarity until a termination condition is reached (such as the dissimilarity of the attribute set of a unit cluster being lower than a third threshold), thereby obtaining the expected cluster set.

[0133] As can be seen, the embodiments of this application can use the attribute information of entities in the unit cluster to make a vector representation of the entity set, and give the corresponding mathematical definition and distance measurement formula to determine the similarity of attribute sets between unit clusters, so as to obtain the approximate optimal partition of the unit cluster through hierarchical clustering algorithm, thereby solving the problem of sparse graph data attributes.

[0134] To enhance understanding, the process of steps s1 to s4 will be explained below with specific examples.

[0135] In one example, for any knowledge graph that needs to be stored, the computing device first obtains the entity set of the knowledge graph. Next, according to the entity type, the computing device groups entities of the same type in the entity set into one entity cluster, thus obtaining multiple entity clusters further divided by entity type. Then, the computing device performs hierarchical clustering based on entity attributes for each type of entity cluster. Taking entity cluster 1 (denoted as set C) as an example, the computing device first groups entities with the same attributes in set C into one unit cluster and performs operation 1: finding the two unit clusters C_i and C_j with the highest dissimilarity in attribute sets in set C (i.e., the distance d(C_i, C_j) between unit clusters is the largest), determining the distance between other unit clusters in set C (excluding C_i and C_j) and C_i and C_j, and assigning the other unit clusters to the closer unit clusters (C_i or C_j), thereby achieving the purpose of splitting set C into two entity clusters. The computing device then uses the newly obtained entity cluster as a new set C and repeats operation 1 until the dissimilarity of the attribute sets of any two unit clusters within the same entity cluster is less than the third threshold. Through hierarchical clustering, entities of the same type can be split into multiple entity clusters, and entities with similar attribute distributions are all in the same entity cluster.

[0136] In another example, a computing device can partition an entity set (denoted as ent) into multiple entity clusters C using the following algorithm. Taking the third threshold as the maximum dissimilarity diff as an example, the computing device can input the entity set ent and the third threshold diff into an algorithm that implements hierarchical clustering, and the algorithm can output multiple entity clusters C obtained by splitting the entity set ent. The algorithm's workflow is as follows.

[0137]

[0138] It can be seen that the complexity of the above hierarchical clustering algorithm consists of two parts: (1) the algorithm undergoes e (e is a positive integer) iterations; (2) in each iteration, it is necessary to compare the distances between unit clusters pairwise. Therefore, in the worst case, each unit cluster is an independent entity cluster, and the complexity of calculating the distance between unit clusters pairwise is O(|S|). 2 S is the number of entities in a cell cluster, and the time complexity of the hierarchical clustering algorithm is O(e|S|). 2 ). Where O is a constant.

[0139] Step 102b: For the first entity cluster among multiple entity clusters, the computing device uses the high-frequency attribute column in the first relation table to store the high-frequency attributes contained in the entities in the first entity cluster, and stores the low-frequency attributes contained in the entities in the first entity cluster in an unstructured storage manner in the rare attribute column included in the first relation table.

[0140] The first entity cluster is any one of the multiple entity clusters obtained by splitting the entity set by the computing device.

[0141] When the number of entities in the first entity cluster containing the second attribute exceeds the second threshold, the second attribute is a high-frequency attribute; when the number of entities in the first entity cluster containing the second attribute is less than the second threshold, the second attribute is a low-frequency attribute. It should be understood that the second threshold and the first threshold can be the same or different. For a detailed explanation of how the computing device determines high-frequency and low-frequency attributes among the attributes contained in entities in the first entity cluster, please refer to the description in step 102 above regarding the computing device's determination of high-frequency and low-frequency attributes among the attributes contained in entities in the entity set; it will not be repeated here. It should be noted that in step 102b, the computing device statistically analyzes and determines high-frequency and low-frequency attributes within the first entity cluster, while in step 102, the computing device statistically analyzes and determines high-frequency and low-frequency attributes within the entity set; this will not be repeated here.

[0142] The first relation table is used to store the attributes contained in the entities in the first entity cluster. It should be noted that, in the embodiments of this application, when the entity set is divided into multiple entity clusters, each entity cluster corresponds to a relation table used to store the attributes contained in the entities in that entity cluster, that is, one entity cluster corresponds to one relation table.

[0143] It should be understood that the first relation table includes an ID column. When the computing device determines that the attributes of entities in the first entity cluster include high-frequency attributes, the first relation table also includes a high-frequency attribute column for storing high-frequency attributes. When the attributes of entities in the first entity cluster include low-frequency attributes, the first relation table also includes a rare attribute column for storing low-frequency attributes. After determining the high-frequency and low-frequency attributes among the attributes contained in the entities in the first entity cluster, the computing device uses different storage methods (i.e., hybrid storage) to store the high-frequency and low-frequency attributes of the entities in the first entity cluster. For a detailed explanation, please refer to the descriptions of steps 1021 and 1022, which will not be repeated here.

[0144] pass Figure 4 The method described above performs hierarchical clustering of the entity set corresponding to the knowledge graph based on the dissimilarity of entity attributes. This groups units with low attribute dissimilarity into a single entity cluster, thus addressing the sparsity problem of real-world data. Subsequently, the computing device uses relational storage to store high-frequency entity attributes based on their frequency within a single entity cluster, improving query efficiency for these attributes. It also uses unstructured storage (such as key-value pairs) to store low-frequency entity attributes, reducing the number of columns and null values ​​in the tables storing entities and their attributes. This method effectively reduces the storage space required when storing entities and their attributes in an entity set.

[0145] As can be seen, the method provided in this application balances the advantages and disadvantages of relational storage and key-value (KV) storage, thereby maintaining data flexibility while efficiently managing large-scale knowledge graphs. Addressing the data sparsity problem, this application performs hierarchical clustering of sets of entities of the same type based on the attribute dissimilarity of unit clusters, thus dividing sets of entities of the same type into entity clusters with similar attribute distributions. Furthermore, this application stores low-frequency attributes of entities within each entity cluster in an unstructured manner (such as KV), and stores high-frequency attributes of entities within each entity cluster in a relational storage manner. This avoids the problem of numerous duplicate key names in KV storage and solves the problem of numerous null values ​​in columns of low-frequency attributes in relational storage, significantly reducing storage space.

[0146] It is understood that the above method describes a scheme for storing the entity set (i.e., the set of nodes / vertices) of a knowledge graph. Based on a similar scheme for storing the entity set of a knowledge graph, embodiments of this application can also store the edge set of the knowledge graph. As shown in Table 6, when storing the edge set of a knowledge graph, the table used to store the edge set contains 4 + count(m) columns. Here, count(m) represents the number of high-frequency attributes of the edges in the edge set. The first three columns of the table used to store the edge's unique ID, the starting vertex (i.e., node) ID (denoted as vidsrc), and the destination vertex ID (denoted as viddst), respectively. The count(m) column after the first three columns of the table used to store the edge is used to store the high-frequency attributes possessed by the edge, and the last column of the table used to store the edge's low-frequency attributes. The value of this last column consists of key-value pairs of attribute name and attribute value. For detailed explanations and implementation processes, please refer to the above. Figures 2-4 The method will not be described in detail here.

[0147] Table 6

[0148] Side ID vidsrc viddst High-frequency properties of edges 1 … Low-frequency properties of edges … … … … … … … … … … … …

[0149] To enhance understanding of the methods provided in the embodiments of this application, the methods provided in the embodiments of this application will be further described below with reference to specific examples.

[0150] Example 1, taking the entity set described in Table 7 as an example, the entity set includes unit clusters S1 to S5. The process of obtaining unit clusters S1 to S5 can be referred to the description of steps s1 and s2 above, and will not be repeated here.

[0151] Table 7

[0152] Unit cluster property type Entity count S1 P4, P5 City 500 S2 P1, P4, P5 City 2 S3 P2, P3 figure 100 S4 P2, P6, P7 figure 6 S5 P6, P7 figure 200

[0153] As shown in Table 7, the attribute sets corresponding to the entity sets are P1-P7, and each unit cluster in the entity set corresponds to its own attribute set. Each unit cluster has its own type, and the types of different unit clusters may be duplicated, such as S1 and S2 having the same type. Therefore, each unit cluster can be uniquely identified by its type and attribute set. For example, unit cluster S3 has the type "Character" and the attribute set {P2, P3}, and contains a total of 100 entities of this type. Unit cluster S5 has the same type as unit cluster S3. In relevant storage schemes, unit clusters S5 and S3 are usually classified into the same set according to type and stored in the same table. However, considering the attribute sets of unit clusters S5 and S3, it can be seen that the attribute sets of these two are quite different. Therefore, it is more reasonable to classify unit clusters S3 and S5 into different sets and store them in different tables.

[0154] Specifically, based on the method described in the embodiments of this application, the computing device can use a hierarchical clustering method to cluster unit clusters of the same type and similar attribute sets together according to a certain dissimilarity threshold (i.e., the first threshold mentioned above), thereby forming a new entity cluster. In this example, the computing device can calculate the dissimilarity between the attribute set {P4, P5} of unit cluster S1 and the attribute set {P1, P4, P5} of S2. Since the attribute sets {P4, P5} and {P1, P4, P5} have the same attributes P4 and P5, and the only different attribute is P1, it can be determined that the dissimilarity between the attribute sets {P4, P5} of unit cluster S1 and {P1, P4, P5} of S2 is lower than the third threshold. Therefore, the computing device determines that unit clusters S1 and S2 are aggregated / classified into one entity cluster, denoted as entity cluster 1. Next, based on the frequency and a first threshold of each attribute in the attribute set {P4, P5} of cell cluster S1 and the attribute set {P1, P4, P5} of S2, the computing device can determine that attributes P4 and P5 are high-frequency attributes, and that attribute P1 is a low-frequency attribute. Therefore, when storing entity cluster 1, the computing device creates separate columns for the high-frequency attributes P4 and P5. Since the low-frequency attribute P1 has a low frequency, creating a separate attribute column for P1 would result in a large number of null values. Therefore, to reduce the space overhead of storing key-value pairs in the KV storage method, the low-frequency attribute P1 is stored in the rare attribute column in KV form. Thus, the computing device forms the table shown in Table 8 when storing entity cluster 1. Here, "***" indicates that a specific value exists. "{}" indicates that the value is null. "{P1:a1}" indicates that the value of low-frequency attribute P1 is a1. "{P1:a2}" indicates that the value of low-frequency attribute P1 is a2.

[0155] Table 8

[0156] Entity ID P4 P5 Rare attributes 1.1 *** *** {} 1.2 *** *** {} … *** *** {} 1.501 *** *** {P1:a1} 1.502 *** *** {P1:a2}

[0157] Continuing with the entity set shown in Table 7, for unit clusters S3 to S5 within this entity set, the computing device can calculate the pairwise dissimilarity of the attribute sets of unit clusters S3 to S5. Since the attribute set {P2, P3} of unit cluster S3 is completely different from the attribute set {P6, P7} of unit cluster S5, and the attribute set {P2, P3} of unit cluster S3 and the attribute set {P2, P6, P7} of unit cluster S4 have a duplicate attribute P2, while the attribute set {P2, P6, P7} of unit cluster S4 and the attribute set {P6, P7} of unit cluster S5 have duplicate attributes P6 and P7. Therefore, the computing device can determine that the dissimilarity between the attribute set {P2, P3} of unit cluster S3 and the attribute set {P6, P7} of unit cluster S5 is the greatest and exceeds the third threshold. Next, since the attribute set {P2, P3} of unit cluster S3 and the attribute set {P2, P6, P7} of unit cluster S4 have only one duplicate attribute (P2), while the attribute set {P2, P6, P7} of unit cluster S4 and the attribute set {P6, P7} of unit cluster S5 have two duplicate attributes (P6 and P7), the computing device can determine that the distance from S4 to S5 is less than the distance from S4 to S3. Therefore, the computing device determines to group S4 and S5 into one entity cluster, denoted as entity cluster 2, and to consider S3 as an entity cluster, denoted as entity cluster 3.

[0158] For entity cluster 2 containing S4 and S5, the computing device, based on the frequency and a first threshold of each attribute in the attribute set {P2, P6, P7} of unit cluster S4 and the attribute set {P6, P7} of unit cluster S5, can determine that attributes P6 and P7 are high-frequency attributes, and attribute P2 is a low-frequency attribute. Therefore, the computing device creates separate columns for high-frequency attributes P6 and P7 when storing entity cluster 2. Since the low-frequency attribute P2 has a low frequency, creating a separate attribute column for P2 would result in a large number of null values. Therefore, to reduce the space overhead of storing key-value pairs in the KV storage method, the low-frequency attribute P2 is stored in a rare attribute column in KV form. Thus, the computing device forms the table shown in Table 9 when storing entity cluster 2. Here, "***" indicates the existence of a specific value. "{}" indicates a null value. "{P2:b1}" indicates that the value of low-frequency attribute Pb is b1. "{P2:b6}" indicates that the value of low-frequency attribute P2 is b6.

[0159] Table 9

[0160] Entity ID P6 P7 Rare attributes 2.1 *** *** {} 2.2 *** *** {} … *** *** {} 2.201 *** *** {P2:b1} … *** *** … 2.206 *** *** {P2:b6}

[0161] For entity cluster 3 containing S3, the computing device, based on the frequency of each attribute in the attribute set {P2, P3} of unit cluster S3 and a first threshold, can determine that attributes P2 and P3 are both high-frequency attributes, and that the entities in unit cluster S3 have no low-frequency attributes. Therefore, the computing device creates separate columns for high-frequency attributes P2 and P3 when storing entity cluster 3. Thus, the computing device forms the table shown in Table 10 when storing entity cluster 3. Here, "***" indicates the existence of a specific value, and "{}" indicates an empty value.

[0162] Table 10

[0163] Entity ID P2 P3 Rare attributes 3.1 *** *** {} 3.2 *** *** {} … *** *** {} 3.100 *** *** {}

[0164] Understandably, few RDF knowledge graph storage solutions utilize strong-mode storage. Strong-mode storage allows for a more compact storage structure and effectively supports query pruning and filtering of large amounts of intermediate results. However, in real-world datasets, the number of strong-mode storage schemes increases exponentially, severely impacting query efficiency. Furthermore, this scheme, based on key-value storage, does not utilize existing mature relational database solutions. This application proposes a strong hybrid storage scheme that divides entity clusters based on the attribute differences of entities within an entity set. It then proposes a strong hybrid storage scheme where attributes of entities within a single cluster are stored using different storage methods according to attribute frequency. This enables efficient storage of large-scale knowledge graphs. By optimizing the original unified storage scheme, this application improves data import efficiency and compresses storage space. By balancing the advantages and disadvantages of relational and key-value storage methods, this application achieves efficient storage and management of large-scale knowledge graphs while maintaining data flexibility.

[0165] Example 2, see reference Figure 6 , Figure 6 This illustration shows another process diagram of the storage method provided in an embodiment of this application.

[0166] like Figure 6 As shown in (a) in the figure, Figure 6 In Figure 'a', a partial network structure diagram of the knowledge graph to be stored (denoted as Knowledge Graph 60) is shown, including the RDF framework diagram and the attribute diagram extracted from the RDF framework, as detailed below. Figure 6 As shown in (a) in the figure.

[0167] like Figure 6As shown in (b), when a unified storage structure is used to store the knowledge graph 60, each type of entity and edge is stored in a separate table. Taking the storage of the knowledge graph 60 using a horizontal table as an example, the number of columns in the table is the same as the number of attributes contained in the entity / relationship. When the entity / relationship contains a large number of attributes, the number of columns in the table may exceed the upper limit, and a large number of null values ​​will be generated, resulting in a waste of storage space.

[0168] like Figure 6 In (c) of this application, to improve storage efficiency and save storage space, the entity clustering algorithm is based on the attribute differences of entities of the same type in the entity set to divide entity clusters. For example... Figure 6 In (c), each circle represents a unit cluster. After clustering by the entity clustering algorithm provided in this application embodiment, unit clusters S1 (represented by the circle with diagonal shading) and S2 (represented by the black circle) are clustered into one entity cluster, unit clusters S4 (represented by the circle with horizontal shading) and S5 (represented by the circle with vertical shading) are clustered into one entity cluster, and unit cluster S3 (represented by the circle with square shading) is clustered into one entity cluster. Subsequently, this application embodiment employs a strong hybrid storage scheme where the attributes of entities within a single entity cluster are stored using different storage methods according to the frequency of the attributes. For detailed explanation, please refer to the relevant description in Example 1 above, which will not be repeated here. Furthermore, regarding... Figure 6 Example of multi-level hybrid storage of the entity "person" in the knowledge graph shown in (a) is as follows: Figure 6 As shown in (d) in the figure.

[0169] This method enables efficient storage of large-scale knowledge graphs, improves data import efficiency, and reduces storage space. This application's embodiments balance the advantages and disadvantages of relational and key-value storage methods, achieving efficient storage and management of large-scale knowledge graphs while maintaining data flexibility.

[0170] The above mainly describes the solution provided by the embodiments of this application from a methodological perspective.

[0171] To achieve the above functions, refer to Figure 7 , Figure 7 A schematic diagram of the structure of a storage device provided in an embodiment of this application is shown. Figure 7 As shown, the storage device 700 is used to execute the storage method described above, for example, to execute... Figures 2 to 5 The method illustrated in any of the figures. The storage device 700 may include an acquisition unit 701 and a storage unit 702.

[0172] Acquisition unit 701 is used to acquire an entity set, which includes multiple entities. The entities in the entity set are entities represented by nodes in a knowledge graph, and each entity in the entity set contains at least one attribute. Storage unit 702 is used to store the attributes of the entities in the entity set based on the frequency of each attribute contained in the entities in the entity set. Specifically, each entity contains a first attribute, and the frequency of the first attribute indicates the number of entities in the entity set that contain the first attribute.

[0173] As an example, combined Figure 2 The acquisition unit 701 can be used to execute step 101, and the storage unit 702 can be used to execute step 102.

[0174] Optionally, storage unit 702 is specifically used to store high-frequency attributes contained in entities in the entity set using a relational storage method. The relational table used to store high-frequency attributes includes an ID column and at least one high-frequency attribute column. The ID column stores the entity's ID, and each high-frequency attribute column stores one high-frequency attribute. When the number or proportion of entities in the entity set containing a first attribute exceeds a first threshold, the first attribute is considered a high-frequency attribute.

[0175] As an example, combined Figure 3 The storage unit 702 can be used to execute step 1021.

[0176] Optionally, when the number or proportion of entities in the entity set containing the first attribute is lower than a first threshold, the first attribute is a low-frequency attribute, and the relation table also includes a rare attribute column. Storage unit 702 is further specifically used to store the low-frequency attributes contained in the entities in the entity set in an unstructured storage manner within the rare attribute column.

[0177] As an example, combined Figure 3 The storage unit 702 can be used to execute step 1022.

[0178] Optionally, the unstructured storage method is KV storage.

[0179] Optionally, the storage device 700 further includes: a determining unit 703, configured to determine multiple entity clusters based on the types of entities in the entity set, wherein an entity cluster includes at least one entity in the entity set, and the at least one entity has the same type. For a first entity cluster among the multiple entity clusters, the storage unit 702 is specifically configured to store high-frequency attributes contained in entities in the first entity cluster using a high-frequency attribute column in a first relation table, and to store low-frequency attributes contained in entities in the first entity cluster in an unstructured storage manner in a rare attribute column included in the first relation table. The first entity cluster is any entity cluster among the multiple entity clusters. When the number of entities in the first entity cluster containing a second attribute exceeds a second threshold, the second attribute is a high-frequency attribute. When the number of entities in the first entity cluster containing a second attribute is less than the second threshold, the second attribute is a low-frequency attribute. The first relation table is a relation table used to store the attributes contained in entities in the first entity cluster.

[0180] As an example, combined Figure 4 The determining unit 703 can be used to execute step 102a, and the storage unit 702 can be used to execute step 102b.

[0181] Optionally, the determining unit 703 is specifically used to: group entities of the same type in the entity set into one entity cluster to obtain multiple entity clusters; or, based on the type of entities in the entity set and the attributes contained in the entities, determine multiple entity clusters, the multiple entity clusters including a first entity cluster, the first entity cluster being any one of the multiple entity clusters, and each entity in the first entity cluster containing common attributes.

[0182] Optionally, the determining unit 703 is specifically used for: grouping entities of the same type in the entity set into one entity cluster to obtain multiple entity clusters; for a first entity cluster among the multiple entity clusters, dividing the first entity cluster into multiple unit clusters, each unit cluster containing one or more entities with the same attribute in the first entity cluster; determining a first unit cluster and a second unit cluster among the multiple unit clusters, wherein the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the second unit cluster is greater than a third threshold; for a third unit cluster among the multiple unit clusters, if the first dissimilarity is less than the second dissimilarity, grouping the first unit cluster and the third unit cluster into one entity cluster, and if the second dissimilarity is less than the first dissimilarity, grouping the second unit cluster and the third unit cluster into one entity cluster. Wherein, the first dissimilarity is the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the third unit cluster. The second dissimilarity is the dissimilarity between the attributes contained in the entities in the second unit cluster and the attributes contained in the entities in the third unit cluster.

[0183] As an example, combined Figure 5 The determination unit 703 can be used to execute steps s1 to s4.

[0184] For a detailed description of the above-mentioned optional methods, please refer to the foregoing method embodiments, which will not be repeated here. Furthermore, the explanation of any of the storage devices 700 provided above and the description of their beneficial effects can be found in the corresponding method embodiments described above, which will not be repeated here.

[0185] Those skilled in the art will readily recognize that, based on the units and algorithm steps described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is implemented in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0186] It should be noted that, Figure 7 The module / unit division shown is illustrative and represents only one logical functional division; in actual implementation, other division methods are possible. For example, two or more functions can be integrated into a single processing module. The functions implemented by the integrated modules described above can be implemented either in hardware or as software functional modules.

[0187] This application provides a computing device for implementing some or all of the functions of the methods provided in this application. (Reference) Figure 8 , Figure 8 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Figure 8 As shown, the computing device 800 includes a processor 801, a memory 802, a communication interface 803, and a bus 804. The processor 801, memory 802, and communication interface 803 are interconnected via the bus 804.

[0188] Processor 801 may include a general-purpose processor and / or a dedicated hardware chip. A general-purpose processor may include a central processing unit (CPU), a microprocessor, or a graphics processing unit (GPU). The CPU may be a single-core processor or a multi-core processor. A dedicated hardware chip is a high-performance processing hardware module. Dedicated hardware chips include at least one of the following: digital signal processor (DSP), data processing unit (DPU), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, neural processing unit (NPU), tensor processing unit (TPU), artificial intelligence (AI) chip, or network processor (NP). Processor 801 may also be an integrated circuit chip with signal processing capabilities. In implementation, some or all of the functions of the methods provided in this application embodiment may be implemented through the integrated logic circuitry of the hardware in processor 801 or through software instructions.

[0189] Memory 802 is used to store computer programs, including an operating system 802a and executable code (i.e., program instructions) 802b. Memory 802 can be, for example, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other types of static storage devices capable of storing static information and instructions. Other examples include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), and synchronous linked dynamic random access memory (SDRAM). DRAM (SLDRAM) or other types of dynamic storage devices capable of storing information and instructions, such as read-only optical discs or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired executable code in the form of instructions or data structures and accessible by a computer, but not limited thereto. For example, memory 802 is used to store relational tables, etc. Memory 802 may exist independently and be connected to processor 801 via bus 804. Alternatively, memory 802 and processor 801 may be integrated together. Memory 802 can store executable code. When the executable code stored in memory 802 is executed by processor 801, processor 801 performs some or all of the functions of the method provided in the embodiments of this application. Please refer to the relevant descriptions in the foregoing embodiments for the implementation of the processor 801 executing this process. Memory 802 may also include software modules and data required by other running processes, such as operating systems.

[0190] The communication interface 803 uses a transceiver module, such as, but not limited to, a transceiver, to enable communication with other devices or communication networks. For example, the communication interface 803 can be any one or any combination of the following devices: a network interface (such as an Ethernet interface), a wireless network card, or other devices with network access capabilities. The communication interface 803 includes a receiving unit for receiving data / messages and a sending unit for sending data / messages.

[0191] Bus 804 is any type of communication bus used to interconnect internal devices (e.g., memory 802, processor 801, communication interface 803) of computing device 800. For example, a system bus. This embodiment illustrates the interconnection of the aforementioned devices within computing device 800 via bus 804. Optionally, the aforementioned devices within computing device 800 can also communicate with each other using other connection methods besides bus 804; for example, the aforementioned devices within computing device 800 can be interconnected via internal logic interfaces.

[0192] It should be noted that the aforementioned devices can be disposed on separate chips, or at least partially or entirely on the same chip. Whether to dispose of the devices independently on different chips or integrate them on one or more chips often depends on the needs of the product design. This application does not limit the specific implementation of the aforementioned devices. Furthermore, the descriptions of the processes corresponding to the various figures above each have their own emphasis; for parts of a process not described in detail in one figure, please refer to the relevant descriptions of other processes.

[0193] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product providing the program development platform includes one or more computer instructions, which, when loaded and executed on the computing device 800, implement some or all of the functions of the methods provided in the embodiments of this application.

[0194] Furthermore, computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium stores computer program instructions that provide a program development platform.

[0195] As an example, combined Figure 7 The functions implemented by the acquisition unit 701 and the determination unit 703 in the storage device 700 can be achieved through... Figure 8 Processor 801 in the middle executes Figure 8 The program code in memory 802 is used for implementation. The functions implemented by the storage units in storage device 700 can be achieved through... Figure 8 The processor 801 and memory 802 shown are implemented.

[0196] This application also provides a computer-readable storage medium, which is a non-volatile computer-readable storage medium. The computer-readable storage medium includes computer program instructions. When the computer program instructions are executed by a processor, a computing device including the processor, or a computer system, the processor, the computing device including the processor, or the computer system performs the storage method provided in this application.

[0197] This application also provides a computer program product containing instructions that, when executed by a processor, a computing device including a processor, or a computer system, cause the processor, the computing device including a processor, or the computer system to implement the storage method provided in this application.

[0198] A computer system is a system with computational processing capabilities. A computer system generally includes a processor and memory. The processor retrieves and executes instructions stored in memory to enable the computer system to implement the storage method described above. Optionally, a computer system may also include at least one of an input interface or an output interface. The processor, memory, input interface, and output interface of the computer system are interconnected through internal connection paths.

[0199] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing the relevant hardware to implement them. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0200] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0201] This application also provides a chip that includes a processor for running program instructions or code. The chip or a device containing the chip can be used to execute the storage method provided in this application. Exemplarily, the chip further includes an input interface, an output interface, and a memory. The chip's input interface, output interface, processor, and memory are connected via internal interconnection paths. The memory in the chip stores program instructions or code executed by the processor, and the input and output interfaces are used for communication between the chip and other chips or devices.

[0202] In the embodiments of this application, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The term "at least one" refers to one or more, and the term "multiple" refers to at least two, unless otherwise expressly defined.

[0203] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0204] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0205] It should be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.

[0206] It should be understood that the term "comprising" (also referred to as "includes", "including", "comprises" and / or "comprising") as used in this specification specifies the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0207] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0208] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the concept and principles of this application should be included within the protection scope of this application.

[0209] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A storage method, characterized in that, include: Obtain an entity set, which includes multiple entities, wherein the entities are entities represented by nodes in a knowledge graph, and each entity contains at least one attribute; The attributes of the entities in the entity set are stored based on the frequency of each attribute contained in the entities in the entity set; wherein, the entity contains a first attribute, and the frequency of the first attribute is used to indicate the number of entities in the entity set that contain the first attribute.

2. The method according to claim 1, characterized in that, The storage of attributes of entities in the entity set based on the frequency of each attribute contained in the entity set includes: The high-frequency attributes contained in the entities in the entity set are stored using a relational storage method. The relational table used to store the high-frequency attributes includes an identifier (ID) column and at least one high-frequency attribute column. The ID column is used to store the ID of the entity, and each high-frequency attribute column is used to store a high-frequency attribute. When the number or proportion of entities in the entity set containing the first attribute exceeds a first threshold, the first attribute is considered a high-frequency attribute.

3. The method according to claim 2, characterized in that, When the number or proportion of entities in the entity set containing the first attribute is lower than the first threshold, the first attribute is a low-frequency attribute. Therefore, the relation table further includes a rare attribute column. The storage of attributes of entities in the entity set based on the frequency of each attribute contained in the entities in the entity set includes: The low-frequency attributes contained in the entities in the entity set are stored in the rare attribute column in an unstructured storage manner.

4. The method according to claim 3, characterized in that, The unstructured storage method is a key-value (KV) storage method.

5. The method according to any one of claims 1 to 4, characterized in that, The storage of attributes of entities in the entity set based on the frequency of each attribute contained in the entity set includes: Multiple entity clusters are determined based on the types of entities in the entity set. Each entity cluster includes at least one entity in the entity set, and the at least one entity has the same type. For the first entity cluster among the plurality of entity clusters, the high-frequency attributes contained in the entities in the first entity cluster are stored in the high-frequency attribute column of the first relation table, and the low-frequency attributes contained in the entities in the first entity cluster are stored in the rare attribute column of the first relation table in an unstructured storage manner. Wherein, the first entity cluster is any one of the plurality of entity clusters; when the number of entities containing the second attribute in the first entity cluster exceeds the second threshold, the second attribute is a high-frequency attribute, and when the number of entities containing the second attribute in the first entity cluster is less than the second threshold, the second attribute is a low-frequency attribute; the first relation table is a relation table used to store the attributes contained in the entities in the first entity cluster.

6. The method according to claim 5, characterized in that, The determination of multiple entity clusters based on the types of entities in the entity set includes: Entities of the same type in the entity set are grouped into one entity cluster to obtain the multiple entity clusters; or, Based on the types of entities in the entity set and the attributes contained in the entities, a plurality of entity clusters are determined, the plurality of entity clusters including a first entity cluster, the first entity cluster being any entity cluster among the plurality of entity clusters, and each entity in the first entity cluster containing common attributes.

7. The method according to claim 6, characterized in that, The step of determining the plurality of entity clusters based on the types of entities in the entity set and the attributes contained in the entities includes: Entities of the same type in the entity set are grouped into one entity cluster to obtain multiple entity clusters; For the first entity cluster among the plurality of entity clusters, the first entity cluster is divided into a plurality of unit clusters, and each unit cluster contains one or more entities with the same attributes in the first entity cluster; A first unit cluster and a second unit cluster are determined among the plurality of unit clusters, wherein the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the second unit cluster is greater than a third threshold. For the third unit cluster among the plurality of unit clusters, if the first dissimilarity is less than the second dissimilarity, the first unit cluster and the third unit cluster are grouped into one entity cluster; if the second dissimilarity is less than the first dissimilarity, the second unit cluster and the third unit cluster are grouped into one entity cluster. Here, the first dissimilarity is the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the third unit cluster, and the second dissimilarity is the dissimilarity between the attributes contained in the entities in the second unit cluster and the attributes contained in the entities in the third unit cluster.

8. A storage device, characterized in that, include: An acquisition unit is used to acquire an entity set, the entity set including multiple entities, the entities being entities represented by nodes of a knowledge graph, and the entities containing at least one attribute; A storage unit is configured to store the attributes of entities in the entity set based on the frequency of each attribute contained in the entities in the entity set; wherein the entity contains a first attribute, and the frequency of the first attribute is used to indicate the number of entities in the entity set that contain the first attribute.

9. The apparatus according to claim 8, characterized in that, The storage unit is specifically used to store the high-frequency attributes contained in the entities in the entity set using a relational storage method; wherein, the relation table used when storing the high-frequency attributes using the relational storage method includes an identifier ID column and at least one high-frequency attribute column, the ID column is used to store the ID of the entity, and one high-frequency attribute column is used to store one high-frequency attribute; when the number or proportion of entities in the entity set containing the first attribute exceeds a first threshold, the first attribute is a high-frequency attribute.

10. The apparatus according to claim 9, characterized in that, When the number or proportion of entities in the entity set containing the first attribute is lower than the first threshold, the first attribute is a low-frequency attribute, and the relationship table further includes a rare attribute column. The storage unit is also specifically used to store the low-frequency attributes contained in the entities in the entity set in an unstructured storage manner in the rare attribute column.

11. The apparatus according to claim 10, characterized in that, The unstructured storage method is a key-value (KV) storage method.

12. The apparatus according to any one of claims 8 to 11, characterized in that, The device further includes: A determining unit is configured to determine multiple entity clusters based on the types of entities in the entity set, wherein an entity cluster includes at least one entity in the entity set, and the at least one entity has the same type; For the first entity cluster among the plurality of entity clusters, the storage unit is specifically used to store the high-frequency attributes contained in the entities in the first entity cluster using the high-frequency attribute column of the first relation table, and to store the low-frequency attributes contained in the entities in the first entity cluster in an unstructured storage manner in the rare attribute column included in the first relation table. Wherein, the first entity cluster is any one of the plurality of entity clusters; when the number of entities containing the second attribute in the first entity cluster exceeds the second threshold, the second attribute is a high-frequency attribute, and when the number of entities containing the second attribute in the first entity cluster is less than the second threshold, the second attribute is a low-frequency attribute; the first relation table is a relation table used to store the attributes contained in the entities in the first entity cluster.

13. The apparatus according to claim 12, characterized in that, The determining unit is specifically used for: Entities of the same type in the entity set are grouped into one entity cluster to obtain the multiple entity clusters; or, Based on the types of entities in the entity set and the attributes contained in the entities, a plurality of entity clusters are determined, the plurality of entity clusters including a first entity cluster, the first entity cluster being any entity cluster among the plurality of entity clusters, and each entity in the first entity cluster containing common attributes.

14. The apparatus according to claim 13, characterized in that, The determining unit is specifically used for: Entities of the same type in the entity set are grouped into one entity cluster to obtain multiple entity clusters; For the first entity cluster among the plurality of entity clusters, the first entity cluster is divided into a plurality of unit clusters, and each unit cluster contains one or more entities with the same attributes in the first entity cluster; A first unit cluster and a second unit cluster are determined among the plurality of unit clusters, wherein the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the second unit cluster is greater than a third threshold. For the third unit cluster among the plurality of unit clusters, if the first dissimilarity is less than the second dissimilarity, the first unit cluster and the third unit cluster are grouped into one entity cluster; if the second dissimilarity is less than the first dissimilarity, the second unit cluster and the third unit cluster are grouped into one entity cluster. Here, the first dissimilarity is the dissimilarity between the attributes contained in the entities in the first unit cluster and the attributes contained in the entities in the third unit cluster, and the second dissimilarity is the dissimilarity between the attributes contained in the entities in the second unit cluster and the attributes contained in the entities in the third unit cluster.

15. A computing device, characterized in that, include: The device includes a memory, a communication interface, and one or more processors, the one or more processors receiving or transmitting data through the communication interface, the one or more processors being configured to read program instructions stored in the memory to perform the method as described in any one of claims 1 to 7.

16. A computer program product containing instructions, characterized in that, When the instructions are executed by the processor, the processor or a device including the processor performs the method as described in any one of claims 1 to 7.

17. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a processor, cause the processor or a device including the processor to perform the method as described in any one of claims 1 to 7.