Optimization control method and apparatus for graph cleaning rule matching, device, and medium

By initializing the memory pool and uniformly dividing the memory slots during the graph cleaning rule matching process, the problem of frequent memory allocation and release is solved, achieving efficient memory reuse and improving system performance.

WO2026232627A1PCT designated stage Publication Date: 2026-11-12SHENZHEN INST OF COMPUTING SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/094532
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-09
Filing Date
2025-05-13
Publication Date
2026-11-12

AI Technical Summary

Technical Problem

Existing graph cleaning rule matching techniques involve frequent memory allocation and deallocation operations, resulting in high memory management overhead and impacting system performance.

Method used

By initializing a contiguous memory region as a memory pool, when the graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool and evenly divided according to the instance bucketer to form memory slots. After the slots are full, the data is appended to the disk and the write pointer is updated, thus avoiding frequent memory allocation and deallocation.

Benefits of technology

It achieves efficient memory reuse, significantly reduces memory management overhead, and improves the overall performance and system acceleration of graph cleaning rule matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025094532_12112026_PF_FP_ABST
    Figure CN2025094532_12112026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a optimization control method and apparatus for graph cleaning rule matching, a device, and a medium. The method comprises: initializing a continuous memory area as a memory pool, and, when a graph cleaning rule matching task is submitted, directly selecting a memory segment from the memory pool; on the basis of the number of buckets of bucketing performed by an instance bucketing device, evenly dividing the memory segment into a corresponding number of memory slots; after instance data is acquired by a bucket, writing the instance data into the memory slot corresponding to the bucket; after a memory slot is full, appending data in the memory slot to a disk file, and, after the appending is completed, updating a write pointer of the memory slot; and, after all the data is bucketed, writing all the remaining data in each of the memory slots into the disk file. The memory buffer pool and the memory slot mechanism are introduced to achieve efficient reuse of the memory, thus avoiding frequent memory application and release operations, significantly reducing the memory management overhead, and thereby effectively improving the overall performance of graph cleaning rule matching.
Need to check novelty before this filing date? Find Prior Art

Description

Optimized control methods, devices, equipment, and media for graph cleaning rule matching

[0001] This application is based on and claims priority to Chinese Invention Application No. 202510596652.4, filed on May 9, 2025, entitled "Optimization Control Method, Apparatus, Device and Medium for Graph Cleaning Rule Matching". Technical Field

[0002] This application relates to the field of storage technology, and in particular to an optimized control method, apparatus, device and medium for graph cleaning rule matching. Background Technology

[0003] Graph cleaning rules are an important tool for cleaning graph data. Their mathematical form can be expressed as: φ = Q[x0, y0](X→p0), where Q is a binary star graph pattern used to identify related entities in the graph; X is a conjunction of a set of predicates defined in a leaf node or a central node; p0 is a predicate defined in a leaf node or a central node; X→p0 can represent the association and dependency relationships between entities in the graph.

[0004] The graph data cleaning workflow based on graph cleaning rules is as follows: (1) In the rule discovery phase, graph cleaning rules are enumerated according to user configuration, and the enumerated rules are matched in the data graph samples input by the user. Rules with support and confidence scores higher than the user-set thresholds are added to the rule set and output; (2) In the error detection phase, graph G and rule set Σ are accepted as input, and these rules are matched in the data graph. Entities that do not satisfy the rule dependencies are output as conflicts; (3) In the error repair phase, graph G, rule set Σ, and conflict data are accepted as input, errors in the graph data are repaired, and the error detection is performed again in the second phase. The process terminates when there is no conflict data output in the second phase.

[0005] In the workflow described above, matching graph cleaning rules is crucial throughout the graph data cleaning process. Therefore, optimizing the matching of graph cleaning rules is essential for improving the overall performance of the graph data cleaning system.

[0006] Existing optimization techniques for matching graph cleaning rules can be categorized into the following two types:

[0007] (1) Graph cleaning rule combination matching technology. This type of technology first decomposes each graph cleaning rule into two single-star components, then combines the single-star components with shared substructures into a single-star bundle, and finally matches the single-star bundle as a whole.

[0008] (2) Matching and Bucketing Technique: This technique aims to avoid the O(N²) complexity (N is the number of matches for a single-star component) of pairwise enumeration in the double-star matching enumeration phase. The main idea is to divide the matched single-star component instances into K buckets based on the predicate of the graph cleaning rule. Thus, two single-star component instances can only be combined into a single graph cleaning rule instance if and only if they are in the same bucket. The matching and bucketing strategy reduces the complexity of double-star matching enumeration from O(N²) to... in This greatly reduces the computational overhead required for enumeration.

[0009] To cope with the huge memory pressure brought about by graph cleaning rule matching, existing systems have to frequently request and release memory. In particular, the matching bucketing technology requires the system to allocate and release memory on a bucket-by-bucket basis in order to achieve fine-grained memory management. This undoubtedly increases the system overhead in terms of memory management.

[0010] Therefore, how to improve memory operations during graph cleaning rule matching to increase memory operation efficiency has become an urgent problem to be solved. Summary of the Invention

[0011] In view of this, embodiments of this application provide an optimized control method, apparatus, device, and medium for graph cleaning rule matching, in order to solve the problem of how to improve memory operations during graph cleaning rule matching to improve memory operation efficiency.

[0012] In a first aspect, embodiments of this application provide an optimization control method for graph cleaning rule matching, comprising:

[0013] A contiguous memory region is initialized as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool.

[0014] Based on the number of buckets for matching instances obtained from the preset graph data by the instance bucketing device, the memory segment is evenly divided to obtain the memory slots with the corresponding number of buckets.

[0015] For any bucket, after the bucket obtains the instance data, the instance data is written to the memory slot of the corresponding bucket.

[0016] For any memory slot, after the memory slot is full, the data in the memory slot is appended to the corresponding file on the disk. After the appending is completed, the write pointer of the memory slot is updated. The write pointer is used to indicate that subsequent data is written directly.

[0017] After all data has been bucketed, all remaining data in all memory slots is written to the corresponding file on the disk.

[0018] Secondly, an optimization control device for graph cleaning rule matching according to an embodiment of this application includes:

[0019] An initialization module is used to initialize a contiguous memory region as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool.

[0020] The memory slot construction module is used to uniformly divide the memory segment according to the number of buckets for matching instances obtained from the preset graph data by the instance bucketer, and obtain memory slots with the corresponding number of buckets.

[0021] The data writing module is used to write the instance data to the memory slot of the corresponding bucket after the bucket has obtained the instance data for any bucket.

[0022] The repeatable persistence module is used to append the data in any memory slot to the corresponding file on the disk after the memory slot is full, and update the write pointer of the memory slot after the append is completed. The write pointer is used to indicate that subsequent data is written directly.

[0023] The full persistence module is used to write all remaining data in all memory slots to the corresponding file on the disk after all data has been bucketed.

[0024] Thirdly, embodiments of this application provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the optimization control method for graph cleaning rule matching as described in the first aspect.

[0025] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the optimization control method for graph cleaning rule matching as described in the first aspect.

[0026] The beneficial effects of the embodiments in this application compared with the prior art are:

[0027] This application initializes a contiguous memory region as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool. Based on the number of buckets for matching instances obtained from the preset graph data by the instance bucketing unit, the memory segment is evenly divided to obtain the corresponding number of memory slots. For any bucket, after instance data is obtained, the instance data is written to the corresponding memory slot. For any memory slot, after the memory slot is full, the data in the memory slot is appended to the corresponding file on the disk. After the append is completed, the write pointer of the memory slot is updated. The write pointer is used to indicate that subsequent data is written directly. After all data has been bucketed, all remaining data in all memory slots is written to the corresponding file on the disk. By introducing a memory buffer pool and memory slot mechanism, efficient memory reuse is achieved, frequent memory allocation and deallocation operations are avoided, memory management overhead is significantly reduced, and thus the overall performance of graph cleaning rule matching is effectively improved. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 is a schematic diagram of an application environment for an optimization control method for graph cleaning rule matching provided in Embodiment 1 of this application;

[0030] Figure 2 is a flowchart illustrating an optimized control method for graph cleaning rule matching provided in Embodiment 2 of this application;

[0031] Figure 3 is a data example diagram of a graph cleaning rule provided in Embodiment 2 of this application;

[0032] Figure 4 is a schematic diagram of a graph data cleaning workflow provided in Embodiment 2 of this application;

[0033] Figure 5 is a data example diagram of a graph cleaning rule combination provided in Embodiment 2 of this application;

[0034] Figure 6 is a schematic flowchart of a memory management and concurrency control method provided in Embodiment 2 of this application;

[0035] Figure 7 is a flowchart illustrating an optimized control method for graph cleaning rule matching provided in Embodiment 3 of this application;

[0036] Figure 8 is a flowchart illustrating an optimized control method for graph cleaning rule matching provided in Embodiment 4 of this application;

[0037] Figure 9 is a schematic diagram of the formation of a condition compact table provided in Embodiment 4 of this application;

[0038] Figure 10 is a schematic diagram of matching and reconstructing a conditional compact table according to Embodiment 4 of this application;

[0039] Figure 11 is a schematic diagram of an optimization control device for graph cleaning rule matching provided in Embodiment 5 of this application;

[0040] Figure 12 is a schematic diagram of the structure of a computer device provided in Embodiment Six of this application. Detailed Implementation

[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0042] To illustrate the technical solution of this application, specific embodiments are described below.

[0043] This application provides an optimized control method for graph cleaning rule matching, applicable to the environment shown in Figure 1. The client communicates with the server, the optimized control method is executed on the server, and the client initiates graph cleaning rule matching by sending a corresponding start command to the server. The server can store graph data, which can be directly accessed during graph cleaning rule matching. The server is configured with a storage disk, which provides memory support for graph cleaning rule matching and persistently stores instance data and other files.

[0044] The client side includes, but is not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, and personal digital assistants (PDAs). The server side can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0045] Referring to Figure 2, which is a flowchart of an optimization control method for graph cleaning rule matching provided in Embodiment 2 of this application, the above-mentioned optimization control method for graph cleaning rule matching can be applied to the server in Figure 1. The server performs optimization control when performing graph cleaning rule matching, specifically targeting the optimization control of data storage during the graph cleaning rule matching process.

[0046] As shown in Figure 2, the optimization control method for graph cleaning rule matching may include the following steps:

[0047] Step S201: Initialize a contiguous memory region as a memory pool. When the graph cleaning rule matching task is submitted, directly select a memory segment from the memory pool.

[0048] In this embodiment, the memory storage area is characterized as the area contained in the server's memory. A continuous segment of memory is selected from the memory and initialized, that is, the memory area is cleared as a memory pool, so as to facilitate the storage of intermediate data in the subsequent graph cleaning rule matching process.

[0049] The process of matching the image cleaning rules in this application is as follows:

[0050] Figure 3 shows an example of a graph cleaning rule. First, a binary star pattern Q is matched in graph G. Then, it is asserted that in each instance of the binary star pattern, if the machine learning model Ms believes that the conference and author names of the two paper nodes match, and one paper is classified as CS, then the other paper should also be classified as CS. This mathematical form based on logical reasoning guarantees the correctness and interpretability of the graph data cleaning results. In addition, the graph cleaning rules are compatible with machine learning models in the form of predicates, thus the data cleaning results also have strong generalization ability. Due to its strong theoretical guarantee, more and more graph data cleaning systems are choosing graph cleaning rules as their theoretical foundation.

[0051] Figure 4 is a flowchart of the graph data cleaning workflow. (1) In the rule discovery phase, graph cleaning rules are enumerated according to the user configuration, and the enumerated rules are matched in the data graph samples input by the user. Rules with support and confidence scores higher than the user-set thresholds are added to the rule set and output. (2) In the error detection phase, graph G and rule set Σ are accepted as input, and these rules are matched in the data graph. Entities that do not satisfy the rule dependencies are output as conflicts. (3) In the error repair phase, graph G, rule set Σ, and conflict data are accepted as input, errors in the graph data are repaired, and error detection is performed again in the second phase. The process terminates when there is no conflict data output in the second phase.

[0052] In the workflow described above, matching graph cleaning rules is crucial throughout the graph data cleaning process. Therefore, optimizing the matching of graph cleaning rules is essential for improving the overall performance of the graph data cleaning system.

[0053] The matching of graph cleaning rules typically involves two stages: (1) Single-star pattern matching. In this stage, the binary star pattern of the graph cleaning rule is broken down into two single-star components for matching to avoid excessively large intermediate results caused by directly materializing the binary star pattern. (2) Binary star matching enumeration. This stage enumerates and checks whether the matching of the two single-star patterns corresponding to the graph cleaning rule satisfies the predicate dependency defined in the rule. Instance pairs that do not satisfy the dependency will be considered as data conflicts.

[0054] Each graph cleaning rule is broken down into two single-star components. Then, single-star components with shared substructures are combined into single-star bundles. Finally, these single-star bundles are matched as a whole. Figure 5 shows a data example of graph cleaning rule combination. In this example, the binary pattern of the rule can be broken down into... as well as Two single-star components share three nodes (x0, x1, x2) and two edges (x0→x1, x0→x2). By merging these two single-star components and unifying the matching, the system can eliminate duplicate matching of this common substructure.

[0055] When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool. This segment must be an unoccupied memory segment, allowing the corresponding sample data to be stored. For example, a memory segment with a starting address of p and a size of s can be pre-allocated from the memory pool. Since this memory is directly taken from the memory pool, the overhead of the traditional malloc() function is avoided, thus eliminating the time-consuming memory allocation.

[0056] Step S202: Based on the number of buckets for matching instances obtained from the preset graph data by the instance bucketer, the memory segment is evenly divided to obtain the corresponding number of memory slots.

[0057] In the process of matching graph cleaning rules, the preset graph data is divided into buckets, and the number of buckets determines the number of memory slots, that is, one bucket corresponds to one memory slot.

[0058] Figure 6 is a schematic diagram of a memory management and concurrency control process provided in Embodiment 2 of this application. For example, after the pattern matcher performs pattern matching on the graph, the matched instance enters the instance partitioning process for bucketing. If there are N buckets, in order to support the bucketing operation, the memory segment will be further divided into N memory slots of uniform size, that is, the i-th bucket corresponds to a memory slot with a starting address of (i-1)s / N and a size of s / N.

[0059] Step S203: For any bucket, after the bucket obtains the instance data, write the instance data into the memory slot of the corresponding bucket.

[0060] After obtaining instance data from the corresponding bucket, the instance data is written to the memory slot of the corresponding bucket. Of course, the memory slot can be initialized before this, and the instance data is written to the memory slot after initialization.

[0061] Step S204: For any memory slot, after the memory slot is full, append the data in the memory slot to the corresponding file on the disk, and update the write pointer of the memory slot after the appending is completed.

[0062] When a memory slot is full, the system does not immediately call the free() function to release the memory. Instead, it appends the data in the slot to the corresponding file on the disk and only updates the write pointer of the memory slot. Subsequent data can be written directly.

[0063] The write pointer is used to indicate that subsequent data should be written directly. As the amount of data stored increases or decreases during the storage process, the write pointer of the memory slot is continuously updated, enabling the data to be stored continuously. After the data in the memory slot is persisted to the corresponding file on the disk, the contents of the memory slot can be cleared. Therefore, the write pointer of the memory slot can be set to the initial position to guide the data to be written. This process is repeated until all data is bucketed.

[0064] Step S205: After all data has been bucketed, write all remaining data in all memory slots to the corresponding files on the disk.

[0065] Once all data has been bucketed, the system writes all remaining data in the memory slots to disk at once, ensuring all data is persisted. Therefore, by introducing a memory buffer pool and memory slot mechanism, efficient memory reuse is achieved, frequent memory allocation and deallocation operations are avoided, memory management overhead is significantly reduced, and the overall performance of graph cleaning rule matching is effectively improved.

[0066] This embodiment initializes a contiguous memory region as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool. Based on the number of buckets for matching instances obtained from the preset graph data by the instance bucketing unit, the memory segment is evenly divided to obtain the corresponding number of memory slots. For any bucket, after instance data is obtained, the instance data is written to the corresponding memory slot. For any memory slot, after it is full, the data in the memory slot is appended to the corresponding file on the disk. After appending, the write pointer of the memory slot is updated. The write pointer is used to indicate that subsequent data is written directly. After all data has been bucketed, all remaining data in all memory slots is written to the corresponding file on the disk. By introducing a memory buffer pool and memory slot mechanism, efficient memory reuse is achieved, frequent memory allocation and deallocation operations are avoided, memory management overhead is significantly reduced, and thus the overall performance of graph cleaning rule matching is effectively improved.

[0067] Referring to Figure 7, which is a flowchart illustrating an optimized control method for graph cleaning rule matching provided in Embodiment 3 of this application, as shown in Figure 7, the step S202 above, which involves uniformly dividing the memory segment based on the number of buckets for matching instances obtained from the preset graph data using an instance bucketing device, to obtain memory slots corresponding to the number of buckets, may include the following steps:

[0068] Step S701: Obtain the matching instance, calculate the bucket identifier to which the matching instance belongs, and trigger the instance data corresponding to the matching instance to be written to the bucket corresponding to the bucket identifier.

[0069] Step S702: Increase the memory usage count of the bucket and check whether the memory slots corresponding to the buckets are sufficient to accommodate the instance data corresponding to the matching instances.

[0070] Step S703: If it is detected that the memory slot corresponding to the bucket is large enough to hold the instance data corresponding to the matching instance, then the write offset is determined according to the memory usage count, and the instance data corresponding to the matching instance is written to the memory slot corresponding to the bucket according to the write offset.

[0071] In this embodiment, the corresponding bucket is determined by calculating the bucket identifier. By calculating the similarity of matching instances, the bucket to which similar instances belong is determined, thereby determining the bucket identifier.

[0072] The memory usage counter is used to record the memory usage of the corresponding bucket. It can be used to determine the write offset when writing data for the next time, so as to know when data is written. It can also be used to determine whether the current memory slot is full, so as to determine the actual write offset.

[0073] Optionally, after checking whether the memory slots corresponding to the buckets are sufficient to hold the instance data corresponding to the matching instances, the following steps are also included:

[0074] If it is detected that the memory slot corresponding to the bucket is not enough to hold the instance data corresponding to the matching instance, then it is determined that the memory slot is full, and the data in the memory slot is appended to the corresponding file on the disk.

[0075] After updating the write pointer of the memory slot after the append is complete, the following is also included:

[0076] Based on the write pointer, the instance data corresponding to the matching instance is written to the memory slot corresponding to the bucket.

[0077] If the memory slot is full, the step of appending the data in the memory slot to the file corresponding to the disk wipe needs to be performed, so that the instance data corresponding to the newly arrived matching instance is written to the memory slot through the updated write pointer.

[0078] Optionally, increase the memory usage count for each bucket, including:

[0079] Get the current occupancy count of the bucket and the instance size of the instance data corresponding to the matching instance;

[0080] Based on atomic variables, the current occupancy count is incremented using the instance size to obtain the updated occupancy count. Based on the updated occupancy count, it is performed to check whether the memory slots corresponding to the buckets are sufficient to accommodate the instance data corresponding to the matching instances, and the current occupancy count is returned.

[0081] The write offset is determined based on the memory usage count, including:

[0082] Determine the write offset based on the returned current occupancy count.

[0083] As shown in Figure 6, updating the occupancy technique through atomic variables essentially involves accumulating the instance size. This atomic variable approach can improve the efficiency of writing offset calculation, thereby improving storage efficiency.

[0084] Optionally, after appending the data from the memory slot to the corresponding file on the disk, the process also includes:

[0085] Reset the current occupancy count formed by the atomic variable to 0, and restart the write thread that was blocked by the condition variable;

[0086] After updating the write pointer of the memory slot after the append is complete, the following is also included:

[0087] Based on the write thread and the write pointer, the bucket write operation is restarted.

[0088] The specific implementation steps are as follows: (1) The system first completes the initialization of the memory pool and memory slots to prepare for subsequent data storage; (2) The instance bucketer first calculates the bucket ID to which the matching instance belongs and triggers the instance to be put into the bucket; (3) When the instance tries to be put into the bucket, the memory usage count of the corresponding bucket will be atomically increased (implemented through atomic variables, which is essentially accumulating the instance size). This atomic operation will return the count value before the update, which is the write offset of the current instance in the memory slot; (4) Subsequently, the condition variable associated with the bucket will check whether the current memory slot has enough remaining space to accommodate the instance. If there is sufficient space (i.e., whether the memory slot occupancy is less than or equal to the memory slot size s / N), the instance is written to the memory slot according to the calculated offset; otherwise, if the memory slot is full (as shown in memory slot 1 (full memory) in Figure 6), the system will immediately trigger an I / O operation to persist the data in the slot to the corresponding file on the disk. At this time, the atomic variable of the bucket will be reset to 0, and all threads blocked by the condition variable will be woken up to retry the bucket operation (back to (3)); (5) After all the data has been bucketed, the system will uniformly write the remaining data in all memory slots to the disk to ensure data integrity. As mentioned above, this concurrency control algorithm uses atomic operations to reduce the use of mutex locks, significantly reducing the performance overhead caused by lock contention, thereby effectively improving the system's concurrent processing capability.

[0089] In parallel rule matching, multiple threads simultaneously perform memory read and write activities. To ensure the consistency of content in critical memory sections within a concurrent environment, mutexes are typically used for concurrency control. However, the extensive use of mutexes significantly degrades the performance of parallel systems. In this embodiment, an efficient concurrent bucketing mechanism is implemented by combining atomic variables and condition variables. Atomic variables are used to track the memory usage of each bucket and atomically obtain the write offset, avoiding lock contention. Condition variables are used to monitor the remaining space in memory slots. When a slot is full, data is written to disk, waking up blocked threads and prompting them to retry bucketing. This design reduces the use of traditional mutexes, significantly lowers the overhead of concurrency control, and improves the system's concurrent processing performance.

[0090] Referring to Figure 8, which is a flowchart illustrating an optimized control method for graph cleaning rule matching provided in Embodiment 5 of this application, if all matching instances are single-beam structure tables, each single-beam structure table includes a center node and at least one leaf node. Each center node and each leaf node corresponds to an attribute, and each attribute corresponds to a data value under any instance data. After writing the instance data to the corresponding bucket's memory slot in step S203, the following steps may be included:

[0091] Step S801 involves compressing the data of the matching instances in the bucketed memory slots and using the union of the attributes that make up all the single-star beam structure tables in all matching instances as the header of the conditional compact table.

[0092] By compressing data, a compact data structure can be formed, which can reduce memory pressure and frequent disk I / O within a certain length.

[0093] At this point, the instance data in the memory slot corresponding to the bucket needs to be compressed before storage. This instance data is structured data and is stored in the form of a table, as shown in Figure 9, which is a schematic diagram of the formation of a conditional compact table provided in Embodiment 4 of this application. The two tables in the dashed line are two single-star beam structure tables, respectively. The conditional compact table extracts the union of the attributes of all single-star components that make up the single-star beam as the table header.

[0094] Step S802: Store all matching instances with the same central node as the root in the same row of the condition compact table to obtain the compressed condition compact table.

[0095] Since all leaf nodes of a single star beam share the same central node, the condition compact table stores all candidate matching results rooted at the same central node in the same row, while each column corresponds to the matching result of a leaf node.

[0096] The above structure avoids the redundancy of storing each candidate match separately in the traditional table structure, thus saving a significant amount of storage space.

[0097] As shown in Figure 9, the assumption table With table This represents the matching results of two single-star components. The conditional compact table is used to store the matching of single-star bundles formed by their combination. The header attribute of the conditional compact table is... With table The table uses the union of header attributes, thus effectively avoiding the storage of duplicate column data (i.e., x0.ID, x1.val, x2.val). Furthermore, for matching results with the same central node, the table... The four matching records in the condition compact table are compressed into two rows, which also reduces the storage of duplicate row data.

[0098] Optionally, after obtaining the compressed conditional compact table, the following may also be included:

[0099] Get the attributes of each matching instance and the predicate dependency conditions that satisfy the corresponding attributes, and form the condition annotation for the corresponding matching instance based on the attributes and predicate dependency conditions;

[0100] The conditional annotations of all matching instances are mapped to the compressed conditional compact table, so that the corresponding matching instances can be reconstructed based on the conditional annotations and the compressed conditional compact table.

[0101] The system maintains a set of condition annotations for each single-star component. These annotations define the materialized attributes that the single-star component needs to have and the predicate dependency conditions that those attributes must satisfy. When it is necessary to reconstruct the match of a specific single-star component, the system only needs to filter according to the corresponding condition annotations to efficiently extract candidate matches that meet the conditions. Figure 10 shows an example of match reconstruction. In this example, the system reconstructs a match for a single-star component. Conditional annotations are maintained, including the attributes that need to be materialized {x0.ID, x1.val, x2.val, x4.val} and the attribute-related predicate x2.val = CS. Based on these conditional annotations, the system can quickly filter out the two rows corresponding to μ1 and μ2 (which do not meet the predicate constraints) and the two columns corresponding to x0.title and x5.val (non-materialized attributes), thereby efficiently reconstructing the candidate matching results of the target single-star component.

[0102] The graph cleaning rule matching process generates a massive number of intermediate results, the size of which may far exceed the single-machine memory capacity. Therefore, the matching process frequently triggers disk reads and writes, resulting in significant I / O overhead. In this embodiment, the matching results of the same central node are compressed into a single row, and storage redundancy is further reduced through attribute intersection headers and conditional annotation mechanisms. During data reconstruction, conditional annotations guide the system to quickly filter and extract candidate matches for specific single-star components, avoiding full table scans. This invention effectively alleviates the memory and I / O bottlenecks faced by traditional data structures when storing single-star beam matching through structured compression and conditional reconstruction.

[0103] For the Internet Movie Database (IMDB) dataset in this application, which has 5.2 million nodes and 48.2 million edges, the proposed solution achieves a 13.06-fold system speedup and a 5.71-fold data compression compared to the latest graph cleaning rule matching system.

[0104] Corresponding to the optimization control method for graph cleaning rule matching in the above embodiments, Figure 11 shows a structural block diagram of the optimization control device for graph cleaning rule matching provided in Embodiment Six of this application. The above-mentioned optimization control device for graph cleaning rule matching can be applied to the server in Figure 1. The server performs optimization control when performing graph cleaning rule matching, specifically targeting the optimization control of data storage during the graph cleaning rule matching process. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0105] Referring to Figure 11, the optimization control device for graph cleaning rule matching includes:

[0106] Initialization module 1101 is used to initialize a contiguous memory region as a memory pool. When the graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool.

[0107] The memory slot construction module 1102 is used to evenly divide the memory segment according to the number of buckets for matching instances obtained from the preset graph data by the instance bucketer, and obtain the corresponding number of memory slots.

[0108] The data writing module 1103 is used to write the instance data to the memory slot of the corresponding bucket after the bucket has obtained the instance data for any bucket.

[0109] The repeatable persistence module 1104 is used to append the data in any memory slot to the corresponding file on the disk after the memory slot is full. After the append is completed, the write pointer of the memory slot is updated. The write pointer is used to indicate that subsequent data is written directly.

[0110] The full persistence module 1105 is used to write all remaining data in all memory slots to the corresponding files on the disk after all data has been bucketed.

[0111] Optionally, the optimization control device for graph cleaning rule matching also includes:

[0112] The bucket identifier module is used to obtain the number of buckets for the matching instances obtained from the preset graph data according to the instance bucketer, to evenly divide the memory segment and obtain the memory slots of the corresponding number of buckets, to obtain the matching instances, to calculate the bucket identifier to which the matching instances belong, and to trigger the instance data corresponding to the matching instances to be written to the bucket corresponding to the bucket identifier.

[0113] The bucket detection module is used to increase the memory usage count of the bucket and detect whether the memory slots corresponding to the buckets are sufficient to hold the instance data corresponding to the matching instances.

[0114] The first bucket write module is used to determine the write offset based on the memory usage count if it is detected that the memory slot corresponding to the bucket is large enough to hold the instance data corresponding to the matching instance, and write the instance data corresponding to the matching instance to the memory slot corresponding to the bucket according to the write offset.

[0115] Optionally, the optimization control device for graph cleaning rule matching also includes:

[0116] The disk write module is used to determine whether the memory slot corresponding to the bucket is sufficient to hold the instance data corresponding to the matching instance after detecting whether the memory slot corresponding to the bucket is sufficient to hold the instance data corresponding to the matching instance. If it is detected that the memory slot corresponding to the bucket is insufficient to hold the instance data corresponding to the matching instance, it determines that the memory slot is full and executes the appending of the data in the memory slot to the file corresponding to the disk.

[0117] The second bucket write module is used to update the write pointer of the memory slot after the append is completed, and then write the instance data corresponding to the matching instance to the memory slot corresponding to the bucket according to the write pointer.

[0118] Optionally, the bin detection module includes:

[0119] The instance size acquisition unit is used to obtain the current occupancy count of the bucket and the instance size of the instance data corresponding to the matching instance;

[0120] The bucketing detection unit is used to increment the current occupancy count based on an atomic variable and the instance size to obtain an updated occupancy count. Based on the updated occupancy count, it performs a check to see if the memory slots corresponding to the buckets are sufficient to accommodate the instance data corresponding to the matching instances, and returns the current occupancy count.

[0121] The first bucket write module includes:

[0122] The first write offset determination unit is used to determine the write offset based on the returned current occupancy count.

[0123] Optionally, the optimization control device for graph cleaning rule matching also includes:

[0124] The thread reset module is used to reset the current occupancy count formed by the atomic variable to 0 after appending the data in the memory slot to the corresponding file on the disk, and restart the write thread that was blocked by the condition variable.

[0125] The write restart module is used to restart the bucket write operation based on the write thread and the write pointer after updating the write pointer of the memory slot after the append is completed.

[0126] Optionally, if all matching instances are single-beam structure tables, each including a central node and at least one leaf node, with each central node and leaf node corresponding to an attribute, and each attribute corresponding to a data value under any instance data, the optimization control device for graph cleaning rule matching further includes:

[0127] The compressed header module is used to compress the matching instances in the memory slots of the corresponding buckets after the instance data is written to them. The union of the attributes that make up all the single-star beam structure tables in all the matching instances is used as the header of the condition compact table.

[0128] The compressed table row module is used to store all matching instances with the same central node as the root in the same row of the condition compact table, resulting in a compressed condition compact table.

[0129] Optionally, the optimization control device for graph cleaning rule matching also includes:

[0130] The condition annotation module is used to obtain the attributes of each matching instance and the predicate dependency conditions that satisfy the corresponding attributes after obtaining the compressed condition compact table, and to form the condition annotation of the corresponding matching instance based on the attributes and predicate dependency conditions.

[0131] The instance reconstruction module is used to map the condition annotations of all matching instances to the compressed condition compact table, so that the corresponding matching instances can be reconstructed based on the condition annotations and the compressed condition compact table.

[0132] It should be noted that the information interaction and execution process between the above modules, units, and sub-units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0133] In one embodiment, a computer device, which may be a server, is provided, and its internal structure diagram is shown in Figure 8. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, a readable storage medium, and the database. The internal memory provides an environment for the operation of the operating system and the readable storage medium. The database stores raw user data. The network interface communicates with external terminals via a network connection. When executed by the processor, the readable storage medium implements an optimized control method for graph cleaning rule matching.

[0134] In one embodiment, a computer device is provided, including a memory, a processor, and a readable storage medium stored on the memory and executable on the processor. When the processor executes the readable storage medium, it implements the steps of the optimized control method for graph cleaning rule matching in the above embodiments, such as steps S201-S205 shown in FIG2, or the steps shown in FIG3 to FIG10. To avoid repetition, these steps will not be described again here. Alternatively, when the processor executes the readable storage medium, it implements the functions of each module / unit in this embodiment of the user data processing device, such as the functions of the initialization module 1101, memory slot construction module 1102, data writing module 1103, repeated persistence module 1104, and full persistence module 1105 shown in FIG11. To avoid repetition, these functions will not be described again here.

[0135] In one embodiment, one or more readable storage media storing computer-readable instructions are provided. When executed by one or more processors, these computer-readable instructions cause the processors to perform the steps of the optimized control method for graph cleaning rule matching described in the above embodiments, such as steps S201-S205 shown in FIG2, or the steps shown in FIG3 to FIG10. To avoid repetition, these steps will not be described again here. Alternatively, when the processor executes the readable storage medium, it implements the functions of various modules / units in this embodiment of the user data processing device, such as the functions of the initialization module 1101, memory slot construction module 1102, data writing module 1103, repeated persistence module 1104, and full persistence module 1105 shown in FIG11. To avoid repetition, these functions will not be described again here. The readable storage medium in this embodiment includes non-volatile readable storage media and volatile readable storage media.

[0136] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by instructing related hardware through a readable storage medium. The readable storage medium can be stored in a non-volatile computer-readable storage medium, which, when executed, can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0137] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0138] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An optimization control method for graph cleaning rule matching, wherein, include: A contiguous memory region is initialized as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool. Based on the number of buckets for matching instances obtained from the preset graph data by the instance bucketing device, the memory segment is evenly divided to obtain the memory slots with the corresponding number of buckets. For any bucket, after the bucket obtains the instance data, the instance data is written to the memory slot of the corresponding bucket. For any memory slot, after the memory slot is full, the data in the memory slot is appended to the corresponding file on the disk. After the appending is completed, the write pointer of the memory slot is updated. The write pointer is used to indicate that subsequent data is written directly. After all data has been bucketed, all remaining data in all memory slots is written to the corresponding file on the disk.

2. The optimization control method for graph cleaning rule matching according to claim 1, wherein, After the step of uniformly dividing the memory segment to obtain the corresponding number of memory slots based on the number of buckets for matching instances obtained from the preset graph data according to the instance bucketing device, the method further includes: Obtain a matching instance, calculate the bucket identifier to which the matching instance belongs, and trigger the instance data corresponding to the matching instance to be written to the bucket corresponding to the bucket identifier; Increase the memory usage count of the bucket and check whether the memory slots corresponding to the buckets are sufficient to accommodate the instance data corresponding to the matching instance; If it is detected that the memory slot corresponding to the bucket is large enough to hold the instance data corresponding to the matching instance, then the write offset is determined based on the memory usage count, and the instance data corresponding to the matching instance is written to the memory slot corresponding to the bucket based on the write offset.

3. The optimization control method for graph cleaning rule matching according to claim 2, wherein, After detecting whether the memory slot corresponding to the bucket is sufficient to accommodate the instance data corresponding to the matching instance, the method further includes: If it is detected that the memory slot corresponding to the bucket is insufficient to hold the instance data corresponding to the matching instance, then it is determined that the memory slot is full, and the step of appending the data in the memory slot to the file corresponding to the disk is executed. After updating the write pointer of the memory slot upon completion of the append operation, the method further includes: Based on the write pointer, the instance data corresponding to the matching instance is written to the memory slot corresponding to the bucket.

4. The optimization control method for graph cleaning rule matching according to claim 2, wherein, The process of increasing the memory usage count of the buckets includes: Obtain the current occupancy count of the bucket and the instance size of the instance data corresponding to the matching instance; Based on atomic variables, the current occupancy count is incremented using the instance size to obtain an updated occupancy count. Based on the updated occupancy count, the process of checking whether the memory slot corresponding to the bucket is sufficient to accommodate the instance data corresponding to the matching instance is executed, and the current occupancy count is returned. Determining the write offset based on the memory usage count includes: The write offset is determined based on the returned current occupancy count.

5. The optimization control method for graph cleaning rule matching according to claim 4, wherein, After appending the data in the memory slot to the corresponding file on the disk, the method further includes: Reset the current occupancy count formed by the atomic variables to 0, and restart the write thread that was blocked by the condition variable; After updating the write pointer of the memory slot upon completion of the append operation, the method further includes: Based on the write thread and according to the write pointer, the bucket write operation is restarted.

6. The optimization control method for graph cleaning rule matching according to any one of claims 1 to 4, wherein, If all matching instances are single-beam structure tables, the single-beam structure table includes a center node and at least one leaf node, the center node and each leaf node respectively correspond to an attribute, and each attribute corresponds to a data value under any instance data, after writing the instance data into the memory slot corresponding to the bucket, the method further includes: The matching instances in the memory slots of the buckets will be compressed, and the union of the attributes that make up all the single-star beam structure tables in all matching instances will be used as the header of the condition compact table. All matching instances with the same central node as the root are stored in the same row of the condition compact table to obtain the compressed condition compact table.

7. The optimized control device for matching graph cleaning rules according to claim 6, wherein, Following the obtained compressed condition compact table, the following is also included: Obtain the attributes of each matching instance and the predicate dependency conditions that satisfy the corresponding attributes, and form the condition annotation for the corresponding matching instance based on the attributes and the predicate dependency conditions; The condition annotations of all matching instances are mapped to the compressed condition compact table so that the corresponding matching instances can be reconstructed based on the condition annotations and the compressed condition compact table.

8. An optimized control device for matching rules in graph cleaning, wherein, include: An initialization module is used to initialize a contiguous memory region as a memory pool. When a graph cleaning rule matching task is submitted, a memory segment is directly selected from the memory pool. The memory slot construction module is used to uniformly divide the memory segment according to the number of buckets for matching instances obtained from the preset graph data by the instance bucketer, and obtain memory slots with the corresponding number of buckets. The data writing module is used to write the instance data to the memory slot of the corresponding bucket after the bucket has obtained the instance data for any bucket. The repeatable persistence module is used to append the data in any memory slot to the corresponding file on the disk after the memory slot is full, and update the write pointer of the memory slot after the append is completed. The write pointer is used to indicate that subsequent data is written directly. The full persistence module is used to write all remaining data in all memory slots to the corresponding file on the disk after all data has been bucketed.

9. A computer device, wherein, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the optimized control method for graph cleaning rule matching as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by the processor, it implements the optimized control method for graph cleaning rule matching as described in any one of claims 1 to 7.