Data operation statement execution method and equipment based on graph database and storage medium

By generating connection relationship data in a graph database and using edge vectors to represent edge sets, large-scale data duplication and rearrangement are avoided, thus solving the performance problems caused by multi-relation joint analysis and improving query performance.

CN121277985APending Publication Date: 2026-01-06ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511312667.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

In graph databases, large-scale data copying and rearrangement caused by multi-relation joint analysis operations can lead to cache invalidation, memory fragmentation, and high-latency access issues, resulting in decreased query performance.

Method used

By generating connection relationship data and using edge vectors to represent edge sets under different types of labels, the actual data copying and rearrangement are avoided, and data is directly read from the original storage location for processing.

Benefits of technology

It improves the query performance of graph databases, reduces the probability of cache invalidation and memory fragmentation, and increases the execution efficiency of data manipulation statements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121277985A_ABST
    Figure CN121277985A_ABST
Patent Text Reader

Abstract

The invention provides a data operation statement execution method and device based on a graph database and a storage medium. The method comprises the steps of obtaining a to-be-executed data operation statement and a connection condition corresponding to the to-be-executed data operation statement, for each type label of a to-be-connected edge related to the connection condition, reading an edge vector under the type label from a graph database, and according to a value of each element in each edge vector, obtaining a to-be-executed data operation statement; when the to-be-executed data operation statement is executed, connection relation data used for representing the connection corresponding relation between the edges meeting the connection conditions and under the different types of labels is generated, and when the to-be-executed data operation statement is executed to perform data processing on the connection result of the to-be-connected edges, the to-be-executed data operation statement is executed; according to the position information of the group of elements meeting the connection condition contained in each relation unit of the connection relation data, reading attribute data of the to-be-connected edge from the graph database to serve as a connection result of the to-be-connected edge, and processing the read attribute data to obtain an execution result of the to-be-executed data operation statement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of graph databases, and more particularly to a method, device and storage medium for executing data manipulation statements based on a graph database. Background Technology

[0002] In graph databases and graph computing systems, multi-relational join is one of the core operations for implementing complex graph queries. Multi-relational join is often used to identify entities with multiple relationships, such as querying "people who are both a user's friend and colleague," or "products that have been both viewed and favorited." This type of analysis requires determining the Cartesian product of edges of different edge types originating from the same node, essentially constituting a cross-relational join query. Traditional relational databases achieve this data association through join operations between tables. While graph databases abstract data into nodes and edges for storage, their underlying implementation typically still requires a join mechanism similar to that of relational databases when executing cross-relational join queries involving different edge types (Edge Labels).

[0003] Specifically, in graph databases and graph computing systems, to perform multi-relation joint analysis operations, edge sets under different types of labels (such as label1 and label2, where label1 and label2 represent different types of edge labels) are typically expanded. For example, each edge in the left set is repeatedly expanded according to the number of edges in the right set (right). That is, each edge in the left set is continuously copied the number of edges in the right set (right times) to form an edge set with a length of left × right. Simultaneously, the right set is cyclically expanded according to the length (left) of the left set. That is, each edge in the right set is copied repeatedly across blocks to form an edge set with a length of left × right. Finally, edges in the same position from the two expanded edge sets with equal numbers are concatenated to form the connection result.

[0004] It is evident that this type of join operation in graph databases requires large-scale data copying and rearrangement of the original data, further exacerbating the pressure on memory bandwidth. In large-scale graph data scenarios, this join method that involves large-scale data copying is prone to problems such as cache invalidation, memory fragmentation, and high-latency access, which in turn leads to a decrease in query performance. Summary of the Invention

[0005] In view of the above, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a method for executing data manipulation statements based on a graph database is provided, the method comprising:

[0007] Obtain the data operation statement to be executed and determine the connection condition corresponding to the data operation statement to be executed. The connection condition includes the connection relationship constraints required to connect at least two types of edges in the graph database.

[0008] The data operation statement to be executed is parsed to determine the type label of the edge to be connected involved in the connection condition, and for each type label, the edge vector under that type label is obtained from the graph database; each element in the edge vector is used to represent each edge to be connected under that type label.

[0009] Based on each element in each edge vector, connection relationship data is generated; the connection relationship data includes multiple relationship units, each relationship unit contains position information of a set of elements that satisfy the connection conditions, wherein each element in the set of elements is taken from a different edge vector; the position information is used to characterize the position of the element in the edge vector;

[0010] Traverse each relation unit in the connection relation data, and read the attribute data of the edge to be connected from the graph database according to the position information contained in each relation unit, and process the read attribute data to obtain the execution result of the data operation statement to be executed.

[0011] According to a second aspect of one or more embodiments of this specification, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in the first aspect above by executing the executable instructions.

[0012] According to a third aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect above.

[0013] According to a fourth aspect of one or more embodiments of this specification, a computer program product is provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the method as described in the first aspect above.

[0014] In the above embodiments, edge vectors can be used to represent the sets of edges under different types of labels that need to be connected. Then, based on the value of each element in each edge vector, the connection logic for connecting edge sets under different types of labels can be analyzed to determine the corresponding connection relationship data. When the graph database system subsequently executes data operation statements involving the connection results of these edge sets, it can directly use the position information in each relational unit contained in the generated connection relationship data to read the attribute data of the corresponding edge from the original position of these attribute data, instead of reading the required attribute data from the data table obtained after actually connecting edge sets under different types of labels. This avoids the need to perform large-scale data copying and rearrangement operations on the original data when actually connecting edge sets under different types of labels, thereby reducing the probability of problems such as cache invalidation, memory fragmentation and high-latency access, and thus improving query performance. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of the architecture of a graph database system provided in an exemplary embodiment.

[0016] Figure 2 This is a schematic diagram of a connection method provided in an exemplary embodiment.

[0017] Figure 3 This is a schematic diagram of an extended set of two edges provided in an exemplary embodiment.

[0018] Figure 4 This is a flowchart of an exemplary embodiment of a method for executing data manipulation statements based on a graph database.

[0019] Figure 5 This is a schematic diagram of a complex edge vector provided in an exemplary embodiment.

[0020] Figure 6 This is a schematic diagram illustrating the process of determining extension method information provided in an exemplary embodiment.

[0021] Figure 7 This is a schematic diagram of a reading process provided in an exemplary embodiment.

[0022] Figure 8 This is a schematic diagram of the structure of a device provided in an exemplary embodiment.

[0023] Figure 9 This is a block diagram of a data manipulation statement execution device based on a graph database, provided in an exemplary embodiment. Detailed Implementation

[0024] All data involved in this manual (including but not limited to data used for analysis, stored data, and displayed data) are authorized by the user or fully authorized by all parties. The collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. Corresponding operation portals are provided for users to choose to authorize or refuse the data.

[0025] Graph databases are databases that use graph structures for semantic queries. They use "nodes" to represent entities and "edges" to represent relationships between entities, and are a type of NoSQL (non-relational database). The following section combines... Figure 1 First, the architecture of the graph database system is introduced. Among them, Figure 1 This is a schematic diagram of the architecture of a graph database system provided in an exemplary embodiment. For example... Figure 1 As shown, the system may include a front-end 11, a query server 12, and a storage terminal 13.

[0026] Front-end 11 can be deployed on various types of electronic devices, such as PCs (Personal Computers), mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smartwatches, etc.), etc., and one or more embodiments in this specification do not limit this. During operation, front-end 11 can receive user query requests and send them to query server 12, and receive query results returned by server 12 for user viewing. Front-end 11 can also provide users with other functions, such as configuring and adjusting query server 12, and managing data stored on storage terminal 13, etc., which will not be listed here. Specifically, front-end 11 can take the form of a client, which can be a native application installed on an electronic device, or the program on the client side can be a mini-program, quick app, or other similar forms. Front-end 11 can also take the form of a web page. For example, when using web technologies such as HTML5 or similar, the relevant functions can be implemented through a page displayed by a browser. Here, the browser can be a standalone browser application or a browser module embedded in some applications.

[0027] The query server 12 can be deployed on a physical server containing a standalone host, or on a virtual server hosted in a host cluster. During operation, the query server 12 can query the data stored in the storage terminal 13 based on query requests initiated by the front end 11, and return the query results to the front end 11. In some cases, based on pre-defined processing logic, the query server 12 can also manage the storage terminal 13 itself. The query server 12 can also respond to other requests initiated by the front end 11, such as adjusting its configuration.

[0028] Storage terminal 13 can be deployed on any type of storage device, such as a standalone host or a storage cluster consisting of several hosts, to store the data specifically maintained in the graph database. The query server 12 and storage terminal 13 can have various specific architectures. For example, in smaller deployments, they can use a direct-attached storage (DAS) architecture, where both are deployed on the same physical server. In more complex scenarios, storage terminal 13 can be deployed as network-attached storage (NAS) or a storage area network (SAN), connected to the device to which query server 12 belongs via a high-speed network (such as Fibre Channel or Ethernet). In larger deployments, storage terminal 13 can be deployed as a distributed file system or object storage, allowing data to be redundantly stored on multiple storage devices (such as storage servers), while query server 12 may need to remotely access this data via specific protocols. These are not all examples listed here.

[0029] At the query server level (point 12), a Database Management System (DBMS) is typically deployed. A DBMS is a software system that enables users to define, create, retrieve, and manage databases. As the core software, the DBMS provides the interface for interaction between users and the graph database, supporting data storage, organization, updating, retrieval, and management functions. Typically, a DBMS may include multiple components such as a query engine, graph computing engine, transaction manager, and storage manager, working together to efficiently process user-submitted query requests and ensure data consistency and efficient access.

[0030] The database management system may include a query engine but not a graph computing engine; it may include a graph computing engine but not a query engine; or it may include both a query engine and a graph computing engine. This specification does not limit this.

[0031] In one embodiment, the database management system includes both a query engine and a graph computing engine. The query engine is responsible for accessing graph data and supports efficient read and write operations. Examples include data retrieval, transaction management (ensuring the consistency and integrity of database operations and supporting ACID (Atomicity, Consistency, Isolation, Durability) properties), index support, and query plan optimization. The graph computing engine is used to execute graph algorithms and data analysis tasks. Examples include shortest path search, community detection, and distributed computing. Optionally, the graph computing engine can be the GeaFlow engine, Apache Giraph engine, GraphX ​​engine, etc. This specification is only an illustrative example of a graph computing engine and does not limit the scope of the specific engine used.

[0032] Optionally, the query engine focuses on fast response and efficient data retrieval, while the graph computing engine focuses on deep analysis and the execution of complex algorithms. The query engine and graph computing engine can collaborate when processing graph data to provide comprehensive data processing capabilities. For example, based on the user's query, the query engine determines the data set to participate in the join operation. This data set represents the edges of the target node under different label types and provides this data set to the graph computing engine. The graph computing engine performs the join operation on this data set, generates the join result, and then feeds the join result back to the query engine. The query engine formats the join result and returns it to the user.

[0033] Similar to relational databases, graph databases also have their own graph query languages ​​to form the query statements required by the query engine. For example, Gremlin is a common graph query language; it's a functional dataflow language that allows users to concisely express the traversal or querying of complex property graphs. It can be written in an imperative (procedural), declarative (descriptive), or hybrid manner. Another common graph query language is GSQL, which supports conditional branching, loops, and stored variables; it is a Turing-complete declarative language. Similar to GSQL, Cypher is another common declarative language, characterized by its user-friendly design and concise syntax. It should be noted that this embodiment is merely an illustrative example of the language types applicable to the technical solutions described herein and does not limit them.

[0034] The following section provides an exemplary description of the graph databases involved:

[0035] The graph database primarily comprises two core elements: nodes and edges. A node represents an entity, such as a user, product, or location, and can be assigned one or more labels to identify its type or category. For example, a node representing a user can be labeled "User," and a node representing a product can be labeled "Product." Similarly, when a node represents a user who can be both a payee and a payer, it can be labeled with both "Payee" and "Payer." Nodes also contain properties that describe the specific characteristics of the entity they represent. For instance, when a node represents a user, the properties could include the user's identifier, name, age, gender, height, and weight.

[0036] Edges are used to represent relationships between nodes. Each edge connects two nodes, called the source node and the target node. To enhance the semantic expressiveness of edges, they are usually assigned a label (i.e., a type label) to define the type of relationship the edge represents, such as: friend relationship, follow relationship, block relationship, referral relationship, fund transfer relationship, etc. Edges can also contain attribute data to further describe the details of this relationship. Edge attribute data can be divided into two categories. The first category can be metadata attributes, such as: the source node identifier, the target node identifier, the creation time, the update time, and the identifier. The second category can be business attributes. For example, when an edge represents a friend relationship, this attribute data could be the number of mutual friends or the frequency of social interactions. Similarly, when an edge represents a resource transfer relationship, this attribute data could include the specific amount of funds transferred.

[0037] To facilitate understanding, the following uses graph data in a social network scenario as an example to explain the concepts of nodes and edges. Specifically, in a social network scenario, each registered user, each post, each location, and each topic can be considered a different node. For example, Mr. Zhang, Mr. Li, Mr. Wang, the post titled "The weather is so nice today," and the topic "Artificial Intelligence" can all be considered different nodes. The edges between two nodes are used to describe what happens between the two nodes, or in other words, the actions and connections between posts and topics, between registered users, and between registered users and posts represented by each node in the social network. For example, the follow relationship between registered users, the posting relationship between a registered user and a post, and the affiliation relationship between a post and a topic.

[0038] Furthermore, in traditional relational databases, a join operation connects data from two or more tables using a common key. For example, consider two tables as shown in Table 1 and Table 2 below:

[0039] Table 1:

[0040] student_id name age 1 Alice 20 2 Bob 22 3 Carol 21

[0041] The data table shown in Table 1 above is the student table. The student table contains three fields: student_id (student identifier), name (student name), and age (student age). Each row of data in the student table is a record, and each record is used to represent a specific object. For example, "1", "Alice", and "20" is a record. This record is used to represent an object with the identifier "1", the name "Alice", and the age "20" (which can be understood as a specific student). Among them, student_id is the primary key, which uniquely identifies each student.

[0042] Table 2:

[0043] course_id student_id course_name grade 101 1 math 85 102 1 English 90 103 2 math 78 104 3 physics 92 105 2 computer Science 88

[0044] The data table shown in Table 2 above is the course table, where `course_id` is the primary key and `student_id` is a foreign key, referencing `student_id` in the `students` table to indicate which student selected the course. For example, the course with course_id 101 was selected by student with identifier 1.

[0045] Based on this, when a user wants to know which courses each student has selected and what their grades are, looking only at the `students` table will not reveal which courses each student has selected. Looking only at the `courses` table will only reveal the student's identifier (`student_id`) but not the student's name. Therefore, in this situation, the database needs to use a `join` operation to connect Table 1 and Table 2 using the common key `student_id` to form a new table. From this new table, we can simultaneously retrieve which courses each student has selected and the student's name. The join result is shown in Table 3.

[0046] Table 3:

[0047] student_id name age course_id course_name grade 1 Alice 20 101 math 85 1 Alice 20 102 English 90 2 Bob 22 103 math 78 2 Bob 22 105 computer Science 88 3 Carol 21 104 physics 92

[0048] Furthermore, the database can materialize the above join results, that is, persistently store the join results as a physical table for use in subsequent complex analyses of the join results, such as sorting the join results by the age of the students who took the course. Another example is grouping the join results by student name and then sorting each group by grade.

[0049] In graph databases, the relationships between nodes and edges are not dynamically connected via foreign keys (such as primary and foreign keys), but rather by a built-in connection mechanism natively supported by the graph structure itself. Each edge explicitly contains two core attributes at the data model level: source ID and target ID, which naturally "point" to the two nodes it connects to. This means that the relationship between edges and nodes is physically direct and logically explicit.

[0050] For example, an edge representing a "course selection relationship" can directly connect the "student" node and the "course" node to form a complete triple (student-course selection-course). This connection relationship is already fixed when the data is stored, and there is no need to rebuild it by matching key values ​​during the query.

[0051] However, in graph databases, entities (nodes) in the graph may be interconnected through various types of edges. Therefore, executing graph queries often requires traversing multiple types of edges. For example, in supply chain management, tracking the complete logistics path from raw material suppliers to end consumers may require combining different types of relationships (i.e., edges) such as transportation, storage, and distribution. Only by connecting sets of edges can paths that meet certain conditions be effectively identified. In other words, although graph databases do not have traditional join operations, the logical connections between different types of edge sets remain a key operation supporting the advanced analytical capabilities of graph databases.

[0052] Specifically, in graph databases and graph computing systems, to perform multi-relation joint analysis operations, edge sets under different types of labels (such as label1 and label2, where label1 and label2 represent different types of edge labels) are typically expanded. For example, each edge in the left set is repeatedly expanded according to the number of edges in the right set (right). That is, each edge in the left set is continuously copied the number of edges in the right set (right times) to form an edge set with a length of left × right. Simultaneously, the right set is cyclically expanded according to the length (left) of the left set. That is, each edge in the right set is copied repeatedly across blocks to form an edge set with a length of left × right. Then, edges in the same position from the two expanded edge sets with equal numbers are concatenated to form new edges. Finally, the edge set composed of these new edges is used as the connection result. (Specific details follow...) Figure 2 As shown.

[0053] Figure 2 This is a schematic diagram of a connection method provided in an exemplary embodiment.

[0054] exist Figure 2 In this context, the `join` operation is used to query which users are both colleagues and friends of user A. The retrieved edge sets consist of a left set and a right set. The source node "0" in both sets represents user A. The edges in the left set are user A's "colleague edges," meaning the target nodes "1," "2," and "3" connected to each edge in the left set represent user A's colleagues. The edges in the right set are user A's "friend edges," meaning the target nodes "4," "5," "6," and "7" connected to each edge in the right set represent user A's friends. When joining the left and right sets, each edge in the left set needs to be concatenated with edges from the same source node in the right set. Connecting an edge from the left set to an edge from the right set creates a new edge.

[0055] like Figure 2 As shown, edge e1 in the left set needs to be concatenated once with edges e4, e5, e6, and e7 in the right set; edge e2 in the left set needs to be concatenated once with edges e4, e5, e6, and e7 in the right set; and edge e3 in the left set needs to be concatenated once with edges e4, e5, e6, and e7 in the right set. Therefore, it can be seen that... Figure 2 Connecting the left and right sets as shown results in 12 new edges. Connecting the left and right sets completes these 12 concatenations.

[0056] Based on this, the left and right sets in a graph database can be expanded so that the expanded left and right sets form a one-to-one matching relationship in the order of edges, covering all matching relationships between edges in the left and right sets. Thus, connecting the edge sets is achieved simply by concatenating two edges in the expanded left and right sets that are at the same position (or in the same order).

[0057] Specifically, for each edge in the left set, it can be repeatedly expanded according to the number of edges in the right set, while for each edge in the right set, it can be cyclically expanded according to the number of edges in the left set. For example... Figure 3 As shown.

[0058] Figure 3 This is a schematic diagram of an extended set of two edges provided in an exemplary embodiment.

[0059] Combination Figure 3 It can be seen that for the left set (containing e1, e2, and e3, a total of 3 edges), the set is expanded by repeating the number of edges in the right set (4 edges), that is, each edge is repeated 4 times, forming a set of edges with a quantity of 3 × 4 = 12, where e1 × 4, e2 × 4, and e3 × 4. Figure 3 The expanded left set shown is: [e1,e1,e1,e1,e2,e2,e2,e2,e3,e3,e3,e3].

[0060] For the right set (containing e4, e5, e6, and e7, a total of 4 edges), it is cyclically expanded according to the number of edges in the left set (3 edges). That is, the entire edge set is cyclically copied 3 times, resulting in an edge set of 12. Here, (e4, e5, e6, e7) × 3 yields... Figure 3 The expanded right set shown is: [e4,e5,e6,e7,e4,e5,e6,e7,e4,e5,e6,e7].

[0061] Then, the first edge e1 in the expanded left set can be concatenated with the first edge e4 in the expanded right set to obtain edge e1-e4. The second edge e1 in the expanded left set can be concatenated with the second edge e5 in the expanded right set to obtain edge e1-e5. And so on, to obtain the connection result of the two edge sets. The connection result can then be materialized to persistently store the connection result as a physical table, and used in subsequent complex analysis of the above connection result.

[0062] It should be noted that the above connection only includes connections without any matching conditions. Under this connection method, the connection result is the Cartesian product of the left and right sets. In practical applications, the connection conditions corresponding to the data operation statement to be executed include the connection relationship constraints required to connect at least two types of edges in the graph database. The connection conditions here can consist of three parts. The first part is the type label of the edge sets to be connected: this is the basic input of the connection operation, which specifies which edge sets need to be connected, such as "colleagues", "friends", etc.

[0063] The second part is the matching condition: This is the execution logic of the connection operation, which represents how edges in the left and right edge sets can be successfully "paired". It is usually based on the attributes of the edge or the node connected by the edge (such as source node ID, target node ID, etc.) to set a Boolean condition, such as: "connect edges with the same source node ID in each edge set", "connect edges with the same target node ID in each edge set", or "connect two edges in one edge set whose source node ID is the same as the target node ID of an edge in another edge set". Here, "same source node ID", "same target node ID", and "the source node ID of an edge in one edge set is the same as the target node ID of an edge in another edge set" are the matching conditions. Only edges that meet the matching conditions will continue to be connected.

[0064] The third part is the join type: This determines which data should be retained in the final result after filtering according to the matching conditions. In other words, it is used to handle the problem of "what to do when an edge in one set does not have an edge in the other set that satisfies the matching conditions".

[0065] Specifically, the join type for the edge sets mentioned above can be various, such as: inner join, full join, left join, and right join. When the join type is inner join, only edge pairs that have matching conditions in both the left and right edge sets are retained. For example, if the join condition is "same source node identifier," then a concatenation result is only generated if an edge exists in the left set and its source node identifier can be found in the right set. Edge pair combinations that do not meet the condition will be discarded.

[0066] When the join type is full join, all possible edge pair combinations are preserved, regardless of whether the matching condition is met. For edge pairs that do not meet the condition, the missing side's attributes are filled with null values, ensuring that the output contains all information from both edge sets. This is suitable for analysis scenarios that require complete preservation of multi-source relationships.

[0067] When the join type is left join, the left set is used as the reference, ensuring that each edge of the left set appears in at least one concatenation result. If an edge in the left set cannot find a matching edge on the right set, its right side is filled with null values. If multiple matches exist, multiple concatenation results are generated. This join type is suitable for analysis tasks that focus on a specific type of relationship, such as: "Analyze all behaviors of interest and add whether there is interaction."

[0068] When the join type is right join, the right set is used as the reference, ensuring that each edge of the right set appears in at least one concatenation result. If an edge of the right set cannot find a matching edge on the left set, its left part is filled with null values. If multiple matches exist, multiple concatenation results are generated respectively, and its semantics are the opposite of left join.

[0069] Therefore, it is evident that in graph databases, regardless of the type of join operation, large-scale data copying and rearrangement of the original data are required, which exacerbates the pressure on the memory bandwidth of the graph database. In large-scale graph data scenarios, this join method that involves large-scale data copying is prone to problems such as cache invalidation, memory fragmentation and high-latency access, which in turn leads to a decrease in query performance.

[0070] To address the aforementioned issues, this specification provides a method for executing data manipulation statements based on graph databases. This method encapsulates only connection relationship data without actually expanding the edge sets involved in the join operation. This connection relationship data represents the connection correspondence between each edge in the two expanded edge sets that satisfies the connection conditions. This allows for direct data retrieval and processing from the original storage location of the edge sets involved in the join operation, according to a specified access order, when complex analysis of the join results is required. This replaces the actual expansion of the edge sets involved in the join operation and the generation of the join results, which are then persistently stored as a physical table from which data is read sequentially. This avoids potential issues such as cache invalidation, memory fragmentation, and high-latency access caused by join operations in large-scale graph data scenarios, thereby improving the query performance of executing data manipulation statements in graph databases. Details are as follows:

[0071] Figure 4 This is a flowchart illustrating an exemplary embodiment of a method for executing data manipulation statements based on a graph database. The executing entity of this method can be a graph database system, such as... Figure 4 As shown, the method includes:

[0072] Step S400: Obtain the data operation statement to be executed and determine the connection conditions corresponding to the data operation statement to be executed. The connection conditions include the connection relationship constraints required to connect at least two types of edges in the graph database.

[0073] Step S402: Parse the data operation statement to be executed, determine the type label of the edge to be connected involved in the connection condition, and for each type label, obtain the edge vector under that type label from the graph database; each element in the edge vector is used to represent each edge to be connected under that type label.

[0074] In this manual, when a user needs to perform complex data analysis tasks through a graph database, they can use the graph query language described above to input a data operation statement in the front end and submit it. The graph database system can then obtain the data operation statement submitted by the user and use it as a data operation statement to be executed.

[0075] The data operation statements to be executed mentioned above contain connection conditions, which are as described above and will not be repeated here.

[0076] Graph database systems can parse received data operation statements to be executed, and based on the connection conditions in the statements, identify the type labels of at least two edge sets that need to participate in the connection operation. This type label determines the minimum two edge sets required for the connection operation. For example, an edge set with the type label "follow" and an edge set with the type label "interact". The system then determines the edge combination that meets the connection relationship constraints based on the matching conditions.

[0077] It should be noted that the above-mentioned join conditions can be automatically generated by the query optimizer of the graph database system during the process of generating the execution plan for the data operation statement to be executed, based on the query intent. For example, when a user submits a query with the intent of "find all users' colleagues and friends", the query optimizer, when parsing the query, will identify the edge set that needs to be jointly analyzed to represent the "colleague" relationship (assuming the type label is "colleague") and the edge set that represents the "friend" relationship (assuming the label is "friend"). It can then infer that a join operation should be performed between the edge sets representing the "colleague" relationship and the edge sets representing the "friend" relationship for the same user (i.e., the same source node), and automatically generate a matching condition: "the source node identifier of the 'colleague' edge is equal to the source node identifier of the 'friend' edge".

[0078] Furthermore, the query optimizer can select inner join as the join type based on the query intent (e.g., in a query to find people who are both colleagues and friends, it can determine to retain only edge pairs that have matching conditions in both the left and right edge sets). It can then read the edge sets under the "colleague" and "friend" labels and perform joins based on the join type and the matching conditions mentioned above.

[0079] In this specification, after determining the type labels of the edges to be connected based on the data operation statements to be executed, the graph database system can obtain the corresponding set of edges based on each type label, and then determine the connection relationship data based on these set of edges.

[0080] However, as can be seen from the connection process in the graph database above, the core of connecting the edge set is to verify whether "node A can be associated with other nodes through different types of edges". In the verification process, it is only necessary to rely on the attribute data specified by the matching condition in the connection condition to make a judgment, without having to read out the complete attribute data of the entire edge for connection.

[0081] For example, if the matching condition is "connect the edges with the same source node identifier in each edge set", then the source node identifier is the attribute data specified by the matching condition.

[0082] Based on this, in practical application scenarios, the graph database system can obtain an edge vector composed of the condition field values ​​of each edge in the edge set under that type label from the graph database for each type label, and then determine the connection relationship data based on the obtained edge vector.

[0083] For example, if there are three edges, with the source node identifier of the first edge being 0 and the target node identifier being 1, the source node identifier of the second edge being 0 and the target node identifier being 2, and the source node identifier of the third edge being 1 and the target node identifier being 2, then if we need to use the similarity of the source node identifiers in each edge set as a matching condition to connect the edge sets (i.e., the condition field is the source node identifier), then the edge vector of the edge set composed of these three edges will be (0,0,1). Similarly, if we need to use the similarity of the target node identifiers in each edge set as a matching condition to connect the edge sets (i.e., the condition field is the target node identifier), then the edge vector of the edge set composed of these three edges will be (1,2,2).

[0084] As can be seen from the above, for any set of edges under any type of label, each element in the edge vector corresponding to that set can be used to represent each edge in that set. Therefore, by reading only the edge vector composed of the values ​​of the condition field, instead of the set of edges to be connected under different type of labels, the connection relationship data can be determined. This avoids redundant reading of the complete edge record, reducing I / O overhead and memory usage, and also avoids the need for computational resources in subsequent calculations of the connection relationship data.

[0085] It's important to note that graph databases offer various storage methods, including row-based and column-based storage. Specifically, when using row-based storage, a graph database can create node tables and edge tables. The node table contains all node information. Each row represents a node in the graph, and each field in the row represents the node's attribute data. In other words, the graph database can store all attribute data for each node (e.g., user ID, name, age, gender, height, weight) as a single record or a complete row of data. Similarly, each row in the edge table represents an edge, and each field in the row represents the edge's attribute data. Therefore, the graph database can store all attribute data for each edge (e.g., source node ID, target node ID, creation time, update time, type, timestamp, and transaction amount) as a single, continuous data set.

[0086] For example, if there are three nodes, node A has the attribute data: id=1, name=Alice, age=30, node B has the attribute data: id=2, name=Bob, age=25, and node C has the attribute data: id=3, name=Cole, age=27, then these three nodes can be stored as three rows of data, each row being {id=1, name=Alice, age=30}, {id=2, name=Bob, age=25}, and {id=3, name=Cole, age=27}.

[0087] When a graph database is stored in columnar format, it can store all the attribute values ​​of all nodes corresponding to that attribute data, or all the attribute values ​​of all edges corresponding to that attribute data, as a first whole (i.e., a column vector) for each type of attribute data of a node or each type of attribute data of an edge.

[0088] For example, if there are three nodes, node A has the attribute data: id=1, name=Alice, age=30, node B has the attribute data: id=2, name=Bob, age=25, and node C has the attribute data: id=3, name=Cole, age=27, then these three nodes can be stored as three column vectors (or column files), where the column vector corresponding to id is {1, 2, 3}, the column vector corresponding to name is {Alice, Bob, Cole}, and the column vector corresponding to age is {30, 25, 27}.

[0089] Based on this, in this specification, if the graph database is stored in columnar format, the graph database system can, for each type label, read the attribute column vector corresponding to the condition field determined according to the connection condition from the attribute column vectors corresponding to the edge set of that type label stored in the graph database, and use it as the edge vector under that type label.

[0090] Furthermore, if the graph database is stored in row-based format, the graph database system can retrieve all records of edges to be connected under each type label from the graph database, combine all the read records into an edge table, and then read the data corresponding to the condition field (i.e., a column of data corresponding to the condition field) from the edge table as the edge vector under that type label.

[0091] Step S404: Generate connection relationship data based on the elements in each edge vector; the connection relationship data includes multiple relationship units, each relationship unit contains position information of a set of elements that satisfy the connection conditions, wherein each element in the set of elements is taken from a different edge vector; the position information is used to characterize the position of the element in the edge vector.

[0092] In this specification, a graph database system can generate connection relationship data based on the consistency between the values ​​of each element in each edge vector. This connection relationship data can include multiple relation units, each containing positional information of a set of elements that satisfy the connection conditions. Each element in this set of elements satisfying the connection conditions is taken from a different edge vector, and for each element, the positional information represents its position within the edge vector.

[0093] Specifically, the graph database system can determine the expansion method information corresponding to each edge vector based on the value of each element in each edge vector, and generate connection relationship data based on the expansion method information. The expansion method information represents the expansion rules for each edge vector during the connection process, ensuring that each expanded edge vector is dimensionally aligned, that is, ensuring a one-to-one correspondence between each element in each expanded edge vector and each element in other expanded edge vectors.

[0094] To facilitate understanding, the following explanation will use the example of two edge vectors for each of the above methods. Specifically, the two edge vectors to be connected are the left input edge vector and the right input edge vector. The left and right input edge vectors can be used to represent the edge sets under different label types.

[0095] The aforementioned expansion method information may include: left expansion multiple vector, right expansion multiple vector, and right offset value vector.

[0096] Based on this, there are two possibilities when a graph database system determines the expansion method information corresponding to each edge vector.

[0097] The first case is when all the edge vectors to be connected are simple vectors, that is, for each edge vector to be connected, the values ​​of each element in the edge vector are the same. For example, if the source node identifiers of all the edges to be connected under the type label corresponding to the left input edge vector are the same (assuming the source node identifier is 0), then the values ​​of each element in the obtained left input edge vector are all 0. If the number of all the edges to be connected under the type label corresponding to the left input edge vector is 3, then the left input edge vector is {0,0,0}.

[0098] In this case, since the values ​​of all elements in each edge vector are consistent, the graph database system can take each element in the left input edge vector as the first type of target element, and determine the number of elements in the right input edge vector whose values ​​are consistent with the first type of target element as the expansion factor corresponding to the first type of target element and store it in the left expansion factor vector.

[0099] For each element in the right input edge vector, this element can be considered as a second-type target element. The number of elements in the left input edge vector that have the same value as the second-type target element is determined as the expansion factor corresponding to the second-type target element and stored in the right expansion factor vector. Simultaneously, the number of elements in the right input edge vector that have the same value as the second-type target element is determined as the offset value corresponding to the second-type target element and stored in the right offset value vector.

[0100] For example: in Figure 2 In the two edge sets shown, the left input edge vector corresponding to the left set is [0, 0, 0], and the right input edge vector corresponding to the right set is [0, 0, 0, 0]. At this time, the first element 0 in the left input edge vector can be taken as the first type of target element. The number of elements in the right input edge vector that have the same value as the first type of target element (i.e., 4) is determined as the expansion factor corresponding to the first type of target element and stored as the first value of the left expansion factor vector. This process is repeated to obtain the left expansion factor vector as [4, 4, 4].

[0101] Similarly, for the first element 0 in the right input edge vector, this element can be used as the second type of target element. The number of elements in the left input edge vector that are consistent with the value of the second type of target element (i.e., 3) is determined as the expansion factor corresponding to the first type of target element, and is used as the first value of the right expansion factor vector and stored in the right expansion factor vector. By analogy, the obtained right expansion factor vector is [3, 3, 3, 3].

[0102] Furthermore, since the expansion method used when expanding the right input edge vector is cyclic expansion, in addition to the aforementioned right expansion multiple vector, a right offset value vector is also needed to mark the position of each expanded element in the expanded right input edge vector. Therefore, the graph database system can also take the first element 0 in the right input edge vector as the second type of target element, and determine the number of elements in the right input edge vector that have the same value as the second type of target element (i.e., 4) as the offset value corresponding to the second type of target element, and store it as the first value of the right offset value vector. This process is repeated, and the resulting right offset value vector is [4, 4, 4, 4].

[0103] The second scenario involves complex vectors that need to be connected, meaning that for at least one edge vector, the values ​​of each element are not entirely the same. Specifically, for example... Figure 5 As shown.

[0104] Figure 5This is a schematic diagram of a complex edge vector provided in an exemplary embodiment.

[0105] Combination Figure 5 It can be seen that the left input edge vector contains 7 elements, of which three elements have a value of 0, one element has a value of 1, two elements have a value of 2, and one element has a value of 3. The right input edge vector contains 8 elements, of which four elements have a value of 0, two elements have a value of 1, and two elements have a value of 2.

[0106] In this case, the expansion method information determined by the graph database system may only include: left expansion multiple vector, right expansion multiple vector, and right offset value vector.

[0107] Specifically, the graph database system can use two pointers to traverse each element in the left input edge vector and the right input edge vector respectively, and determine the expansion method information corresponding to the left input edge vector and the right input edge vector based on the traversal results.

[0108] The graph database system can determine the augmentation information for each edge vector by simultaneously traversing the elements of the left and right input edge vectors using a left pointer and a right pointer. Specifically, after each movement of the left or right pointer, the values ​​of the elements in the left and right input edge vectors currently pointed to by the left pointer and the right pointer are compared. Based on the comparison result, the augmentation information for the left and right input edge vectors is determined.

[0109] Furthermore, the graph database system can determine the expansion method information corresponding to the left input edge vector and the expansion method information corresponding to the right input edge vector based on the comparison results as follows: when it is determined from the comparison results that the value of the element currently pointed to by the left pointer is equal to the value of the element currently pointed to by the right pointer, the value of the element currently pointed to by the left pointer is used as the base value, and it is determined whether the value of the next element in the left input edge vector is the same as the base value. If so, the left pointer is moved to point to the next element.

[0110] Then, determine whether the value of the next element in the right input edge vector is the same as the base value. If so, move the right pointer to the next element.

[0111] When it is determined that the value of the next element in the left input edge vector is different from the base value, and the value of the next element in the right input edge vector is different from the base value, the number of times the left pointer points to the element with the value of the base value is stored in the right expansion multiple vector as the expansion multiple of each element with the value of the base value traversed by the right pointer.

[0112] The number of times the right pointer points to the element of the base value is stored as the expansion multiple of the elements of the base value traversed by the left pointer in the left expansion multiple vector. The number of times the right pointer points to the element of the base value is stored as the offset value of the elements of the base value traversed by the right pointer in the right offset value vector.

[0113] For example: in Figure 5 In the algorithm, the left pointer initially points to the first element of the left input edge vector (i.e., the element whose source node is 0), while the right pointer points to the first element of the right input edge vector (i.e., the element whose source node is 0). Then, the values ​​of the elements in the left and right input edge vectors pointed to by the left and right pointers are compared. Based on the comparison, the value 0 of the element pointed to by the left pointer is equal to the value 0 of the element pointed to by the right pointer. This value is then used as the base value to check if the value of the next element in the left input edge vector (i.e., the second element, 0) is the same as the base value. If yes, the left pointer continues to move to the next element (i.e., the third element, 0). Simultaneously, the value of the next element in the right input edge vector (i.e., the second element, 0) is also checked against the base value. If yes, the right pointer continues to move to the next element (i.e., the third element, 0), and so on, until the value of the next element in the left input edge vector is determined (i.e., the value of the third element, 0). Figure 5 The value of the fifth element in the left input edge vector (1) is different from the basic value 0, and the value of the next element in the right input edge vector (i.e., Figure 5 If the value of the fourth element in the right input edge vector (1) is different from the base value 0, the number of times the left pointer points to the element with the base value (i.e., from the first element with a value of 0 in the left input edge vector to the last element with a value of 0, the left pointer points to the element with the base value 0 3 times during its movement) is stored in the right expansion multiple vector as the expansion multiple of the elements traversed by the right pointer. Figure 5 The right pointer starts from the first element with a value of 0 and ends at the last element with a value of 0. The expansion factor of the four elements with a value of 0 is 3. At this time, the right expansion factor vector is [3,3,3,3].

[0114] The number of times the right pointer points to the element with the value of the base value (i.e., from the first element with a value of 0 in the right input edge vector to the last element with a value of 0, the right pointer points to the element with the value of the base value 4 times during the movement) is stored in the left expansion multiple vector as the expansion multiple of each element with the value of the base value traversed by the left pointer. At this time, the left expansion multiple vector is [4,4,4]. The number of times the right pointer points to the element with the value of the base value is stored in the right offset value vector as the offset of each element with the value of the base value traversed by the right pointer. At this time, the right offset value vector is [4,4,4,4].

[0115] Furthermore, after updating the left expansion multiple vector, right expansion multiple vector, and right offset value vector, the graph database system can continue to point the left pointer to the next element, that is, Figure 5 The fourth element of the left input edge vector (i.e., the element whose source node is marked as 1), and the right pointer is moved to the next element, i.e. Figure 5 The fifth element of the right input edge vector (i.e., the element whose source node is identified as 1) is obtained, and the above steps are repeated to update the left expansion multiple vector, the right expansion multiple vector, and the right offset value vector until the left pointer traverses to the last element of the left input edge vector and the right pointer traverses to the last element of the right input edge vector.

[0116] In practical applications, when the comparison results indicate that the value of the element currently pointed to by the left pointer is not equal to the value of the element currently pointed to by the right pointer, it means that the value of the element currently pointed to by the left pointer does not exist in the right input edge vector, or the value of the element currently pointed to by the right pointer does not exist in the left input edge vector. In other words, the edge corresponding to the element currently pointed to by the left pointer or the edge corresponding to the element currently pointed to by the right pointer does not meet the matching condition. In order to ensure that the connection result contains all the information from the two edge sets, it is necessary to fill the missing side with null values, thereby using null values ​​to replace the connection.

[0117] For example: in Figure 5 In the left input edge vector, e15 is the edge corresponding to the element with source node identifier 3. However, there is no element with source node identifier 3 in the right input edge vector. In other words, there is no edge in the right input edge vector that satisfies the matching condition with e15. Therefore, in order to ensure that the connection result contains all the information from both edge sets, it is necessary to insert a null value in the right input edge vector to connect with e15. In other words, you can connect with e15 by inserting a null value in the right input edge vector to replace the edge that satisfies the matching condition with e15.

[0118] However, inserting null values ​​into the right input edge vector requires modifying the original memory structure of the edge vector. The purpose of the data manipulation statement execution method based on graph databases provided in this specification is precisely to avoid altering the edge vector's memory structure, thereby preventing issues such as cache invalidation, memory fragmentation, and high-latency access. Therefore, this specification uses a null flag added to the right null flag vector to indicate the insertion of null values ​​into the right input edge vector, thus replacing the actual insertion of null values ​​into the right input edge vector.

[0119] Therefore, in this specification, when it is determined, based on the comparison result, that the value of the element currently pointed to by the left pointer is not equal to the value of the element currently pointed to by the right pointer, the expansion method information determined by the graph database system shall include, in addition to the left expansion multiple vector, the right expansion multiple vector, and the right offset value vector, at least one of the following: the left empty value flag vector and the right empty value flag vector.

[0120] Specifically, the graph database system can determine the expansion method information corresponding to each edge vector by simultaneously traversing the elements in the left input edge vector using the left pointer and the elements in the right input edge vector using the right pointer. After each movement of the left or right pointer, the value of the element in the left input edge vector currently pointed to by the left pointer is compared with the value of the element in the right input edge vector currently pointed to by the right pointer. If, based on the comparison result, the value of the element in the left input edge vector currently pointed to by the left pointer is the same as the value of the element in the right input edge vector currently pointed to by the right pointer, then the graph database system determines the expansion method information based on the comparison result in the same way as described above. This specification will not elaborate further here.

[0121] It should be noted that in the above process, after the left pointer traverses an element in the left input edge vector, a flag value can be added to the left null value flag vector to indicate that the element currently pointed to by the left pointer is a valid element (which can be understood as marking that the element currently pointed to by the right pointer is not null). Similarly, after the right pointer traverses an element in the right input edge vector, a flag value can also be added to the right null value flag vector to indicate that the element currently pointed to by the right pointer is a valid element.

[0122] If, based on the comparison results, it is determined that the value of an element in the left input edge vector currently pointed to by the left pointer is less than the value of an element in the right input edge vector currently pointed to by the right pointer, then it means that the value of an element in the left input edge vector currently pointed to by the left pointer does not exist in the right input edge vector.

[0123] At this point, the value of the element currently pointed to by the left pointer can be used as the base value. Then, it is determined whether the value of the next element in the left input edge vector is less than the value of the element currently pointed to by the right pointer. If so, the left pointer is moved to the next element, and at least one flag value representing a null value is added to the right null value flag vector. The quantity 1 is used as the expansion multiple of each null value and stored in the right expansion multiple vector. The quantity 0 is used as the offset value of each null value and stored in the right offset value vector. In addition, the quantity 1 is used as the expansion multiple of each element traversed by the left pointer and stored in the right expansion multiple array.

[0124] The number of flags added to represent null values ​​is the same as the number of times the left pointer moves from the element whose base value is the first value.

[0125] For example: if the left pointer is currently pointing to the 7th element in the left input edge vector, and the right pointer is currently pointing to the 8th element in the right input edge vector, the comparison result determines that the value of the element in the left input edge vector currently pointed to by the left pointer is less than the value of the element in the right input edge vector currently pointed to by the right pointer. At this time, we can check whether the value of the next element in the left input edge vector is also less than the value of the element currently pointed to by the right pointer. If so, we move the left pointer to the next element until we determine that the value of the next element is not less than the value of the element currently pointed to by the right pointer. Then, based on the number of times the left pointer moves from the 7th element in the left input edge vector to the currently executed element, we add a corresponding number of null value flags to the right null value flag vector, and add corresponding placeholder elements to the right expansion multiple vector and the right offset value vector. Then, the quantity 1 is used as the expansion factor for each null value and stored in the right expansion factor vector, 0 is used as the offset value for each null value and stored in the right offset value vector, and the quantity 1 is used as the expansion factor for each element traversed by the left pointer and stored in the right expansion factor array.

[0126] If, based on the comparison results, it is determined that the value of an element in the left input edge vector currently pointed to by the left pointer is greater than the value of an element in the right input edge vector currently pointed to by the right pointer, then it means that the value of an element in the right input edge vector currently pointed to by the right pointer does not exist in the left input edge vector.

[0127] At this point, we can use the value of the element currently pointed to by the right pointer as the base value, and then determine whether the value of the next element in the right input edge vector is less than the value of the element currently pointed to by the left pointer. If so, we move the right pointer to the next element.

[0128] If not, add at least one element representing a null value to the left null value flag vector, where the number of elements added to represent null values ​​is the same as the number of times the right pointer moves from the element pointing to the first value as the base value.

[0129] The number of flags added to represent null values ​​is the same as the number of times the right pointer moves from the element whose first value is the base value.

[0130] For ease of understanding, the following is combined with Figure 6 The process of determining the above-mentioned expansion method information is explained in detail.

[0131] Figure 6 This is a schematic diagram illustrating the process of determining extension method information provided in an exemplary embodiment.

[0132] like Figure 6 As shown, in the left input edge vector, the number of elements with source node identifier 0 is 3, the number of elements with source node identifier 1 is 1, the number of elements with source node identifier 2 is 2, and the number of elements with source node identifier 3 is 1. In the right input edge vector, the number of elements with source node identifier 0 is 4, the number of elements with source node identifier 1 is 2, and the number of elements with source node identifier 2 is 2. null represents the edge e15 corresponding to the element with source node identifier 3 in the left input edge vector. This element is added to the right input edge vector. However, this element is not actually added to the right input edge vector. Instead, when determining the expansion method information of the left and right input edge vectors, it is considered that there is still an element at this position in the right input edge vector. This element is a null value. This null value is used to connect with the edge e15 corresponding to the element with source node identifier 3 in the left input edge vector. The position of this element in the right input edge vector is represented by the right null value flag vector.

[0133] In this context, e1, e2, and e3 are edges corresponding to elements in the left input edge vector whose source node identifier is 0. Their expansion factor is 4, which is the same as the number of edges in the right input edge vector whose source node identifier is 0. That is, the expansion factor for e1, e2, and e3 is 4. e8 is an edge corresponding to an element in the left input edge vector whose source node identifier is 1. Its expansion factor is 2, which is the same as the number of edges in the right input edge vector whose source node identifier is 1. e11 and e12 are edges corresponding to elements in the left input edge vector whose source node identifier is 2. Their expansion factor is the same as the number of edges in the right input edge vector whose source node identifier is 2. That is, the expansion factor for e11 and e12 is 2.

[0134] e15 is the edge corresponding to the element with source node identifier 3 in the left input edge vector. Since there is no element with source node identifier 3 in the right input edge vector, this specification adds a null value to the right null value flag vector to indicate that a null value is inserted into the right input edge vector, thus replacing the actual insertion of a null value. At this time, the edge corresponding to e15 is this null value, therefore, the expansion factor for e15 is 1. Since e16 is the edge corresponding to the element with source node identifier 4 in the right input edge vector, and there is no element with source node identifier 4 in the left input edge vector, this specification adds a null value to the left null value flag vector to indicate that a null value is inserted into the right input edge vector, thus replacing the actual insertion of a null value into the left input edge vector. Furthermore, since this null value is used in the left input edge vector to replace the edge corresponding to e16, its corresponding expansion factor is 1, which is the number of e16. Finally, the left expansion factor vector is: [4, 4, 4, 2, 2, 2, 1, 1].

[0135] e4, e5, e6, and e7 are edges in the right input edge vector corresponding to elements with a source node identifier of 0. Their expansion factor is 3, the same as the number of edges with a source node identifier of 0 in the left input edge vector. That is, the expansion factor for e4, e5, e6, and e7 is 3. e9 and e10 are edges in the right input edge vector corresponding to elements with a source node identifier of 1. Their expansion factor is 1, the same as the number of edges with a source node identifier of 3 in the left input edge vector. That is, the expansion factor for e9 and e10 is 1. e13 and e14 are edges in the right input edge vector corresponding to elements with a source node identifier of 2. Their expansion factor is 2, the same as the number of edges with a source node identifier of 2 in the left input edge vector. That is, the expansion factor for e13 and e14 is 2. The null value is used in the right input edge vector to replace the edge corresponding to e15, and its expansion factor is 1, the same as the number of edges with a source node identifier of e15. e16 is the edge corresponding to the element with source node identifier 4 in the right input edge vector. Since there is no element with source node identifier 4 in the left input edge vector, this specification adds a null value to the left null value flag vector to indicate that a null value is inserted into the right input edge vector, thus replacing the actual insertion of a null value into the left input edge vector. At this point, the edge corresponding to e16 is this null value, therefore, the expansion factor corresponding to e16 is 1. Finally, the right expansion factor vector is: [3, 3, 3, 3, 1, 1, 2, 2, 1, 1].

[0136] For the four edges e4, e5, e6, and e7 mentioned above, their corresponding offset value is the number of edges corresponding to the element with source node identifier 0 in the right input edge vector, which is 4. For the two edges e9 and e10 mentioned above, their corresponding offset value is the number of edges corresponding to the element with source node identifier 1 in the right input edge vector, which is 2. For the two edges e13 and e14 mentioned above, their corresponding offset value is the number of edges corresponding to the element with source node identifier 2 in the right input edge vector, which is 2. For the null value in the right input edge vector, it directly corresponds to e15 in the left input edge vector, so its corresponding offset value is 0. Finally, the right offset value vector is: [4, 4, 4, 4, 2, 2, 2, 2, 0].

[0137] In the above process, after the left pointer traverses an element in the left input edge vector, a flag value is added to the left null value flag vector to indicate that the element currently pointed to by the left pointer is a valid element. Similarly, after the right pointer traverses an element in the right input edge vector, a flag value is added to the right null value flag vector to indicate that the element currently pointed to by the right pointer is a valid element. When the left pointer traverses to the element corresponding to edge e15, in addition to adding a flag value to the left null value flag vector to indicate that the element currently pointed to by the left pointer is a valid element, a flag value also needs to be added to the right null value flag vector to indicate that a null value is inserted into the right input edge vector.

[0138] Similarly, when the left pointer traverses to the element corresponding to edge e16, in addition to adding a flag value to the right null value flag vector to indicate that the element currently pointed to by the left pointer is a valid element, it is also necessary to add a flag value to the left null value flag vector to indicate that a null value is inserted into the left input edge vector. Therefore, the resulting left null value flag vector is: [0, 0, 0, 0, 0, 0, 0, 1], and the right null value flag vector is: [0, 0, 0, 0, 0, 0, 0, 1].

[0139] For example, the process of traversing edge vectors with pointers to generate augmentation information can be implemented using the following pseudocode:

[0140]

[0141]

[0142]

[0143]

[0144] Furthermore, after determining the expansion method information corresponding to each edge vector, the graph database system can generate connection relationship data based on the determined expansion method information.

[0145] In this context, each relational unit in the aforementioned connection relationship data represents the connection correspondence between edges under different label types that satisfy the connection conditions. Since the expansion method information represents the expansion rules of the edge vectors, ensuring a one-to-one matching relationship between the expanded left and right input edge vectors in terms of element arrangement, and covering all matching relationships between elements in the left and right input edge vectors, the expansion method information can determine which element in the left input edge vector is actually connected to which element in the right input edge vector when connecting the expanded left and right input edge vectors.

[0146] Therefore, by simply adding the position information of the element corresponding to each connected edge in the edge vector to the relational unit of the connection relation data in sequence, the connection relation data can be used to represent the connection correspondence between edges under different types of labels that satisfy the connection conditions.

[0147] Specifically, the aforementioned connection relationship data may include two arrays, namely, a first connection relationship array and a second connection relationship array. For each element in the first connection relationship array, the element and the element at the same position in the second connection relationship array together form a relationship unit of the connection relationship data.

[0148] For example, if the element ai representing the i-th edge with type label A in edge vector 1 has the same value as the element bi representing the i-th edge with type label B in edge vector 2, then it can be determined that when connecting the edge sets corresponding to edge vector 1 and edge sets corresponding to edge vector 2, the i-th edge with type label A needs to be connected to the i-th edge with type label B. Therefore, when the graph database system determines that the values ​​of element ai and element bi are the same, the index representing the position of element ai in edge vector 1 can be stored in the first connection relation array, and... The index representing the position of element bi in edge vector 2 is stored in the corresponding position of the second connection relation array (if the index of element ai is stored in the j-th position of the first connection relation array, then the j-th position of the second connection relation array can be determined as the corresponding position, and the index of element bi is stored in the corresponding position of the second connection relation array). At this time, the element in the first connection relation array used to store the index of element ai at the j-th position, and the element in the second connection relation array used to store the index of element bi at the j-th position, together form a relation unit.

[0149] For example, Figure 5The connection relationships between the left and right input edge vectors shown are represented in the code as shown in Table 4:

[0150] Table 4:

[0151] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 1 1 1 2 2 2 2 3 3 3 3 4 4 5 5 6 6 7 1 2 3 4 1 2 3 4 1 2 3 4 5 6 7 8 7 8 null

[0152] In Table 4, the first row represents the j-th relation unit in the connection relation data, the second row represents the first connection relation array, and the second row represents the second connection relation array.

[0153] by Figure 5 For example, the expansion information of the left input edge vector includes the left expansion multiple vector [4, 4, 4, 2, 2, 2, 1] and the left empty value flag vector [0, 0, 0, 0, 0, 0, 0]. The expansion information of the right input edge vector includes the right expansion multiple vector [3, 3, 3, 3, 1, 1, 2, 2, 1], the right offset value vector [4, 4, 4, 4, 2, 2, 2, 2, 0] and the right empty value flag vector [0, 0, 0, 0, 0, 0, 0, 1]. A value of 0 in the empty value flag array indicates valid data, and a value of 1 indicates an empty value.

[0154] According to the left empty value flag array, the first element in the left input edge vector is valid data. Based on the left expansion factor vector, the expansion factor corresponding to the first element in the left input edge vector is 4. Therefore, it is determined that the position information 1 of the first element in the left input edge vector needs to be continuously filled into the first connection relationship array four times. Similarly, according to the left empty value flag array, the second element in the left input edge vector is valid data. Again, based on the left expansion factor vector, the expansion factor corresponding to the second element in the left input edge vector is 4. Therefore, it is determined that the position information 2 of the second element in the left input edge vector needs to be continuously filled into the first connection relationship array four times. This process continues until the first connection relationship array is obtained.

[0155] According to the right empty value flag array, the first element in the right input edge vector is valid data. Based on the right expansion factor vector, the expansion factor corresponding to the first element in the right input edge vector is 3, and based on the right offset value vector, the offset value corresponding to the first element in the right input edge vector is 4. Therefore, it is determined that the position information '1' of the first element in the right input edge vector needs to be continuously filled into the second connection relationship array three times, with each filling requiring an offset of four positions. That is, the position information '1' of the first element in the right input edge vector needs to be filled into the first, fifth, and ninth positions of the second connection relationship array, respectively.

[0156] According to the right empty value flag array, the second element in the right input edge vector is valid data. Based on the right expansion factor vector, the expansion factor corresponding to the second element in the right input edge vector is 3, and based on the right offset value vector, the offset value corresponding to the second element in the right input edge vector is 4. Therefore, it is determined that the position information 2 of the second element in the right input edge vector needs to be continuously filled into the second connection relationship array three times, with each filling requiring an offset of four positions. That is, the position information 2 of the first element in the right input edge vector needs to be filled into the second, sixth, and tenth positions in the second connection relationship array, respectively.

[0157] According to the right null value flag array, the ninth element in the right input edge vector is null. At this point, according to the right expansion factor vector, the expansion factor corresponding to the ninth element in the right input edge vector is 1, and according to the right offset value vector, the offset value corresponding to the ninth element in the right input edge vector is 0. Therefore, it is determined that a null flag needs to be filled into the second connection array; that is, null should be filled into the nineteenth position of the second connection array. This process is repeated to obtain the second connection array.

[0158] Step S406: Traverse each relation unit in the connection relation data, and read the attribute data of the edge to be connected from the graph database according to the position information contained in each relation unit, and process the read attribute data to obtain the execution result of the data operation statement to be executed.

[0159] Furthermore, after determining the connection relationship data, the graph database system can use this connection relationship data to expand the left and right input edge vectors instead of the actual ones, and then concatenate the expanded edge vectors to obtain a connected data table, which is stored as the connection result. This can be understood as follows: in this specification, instead of actually creating a new table to store the connection result, the connection relationship data is used to store it.

[0160] In this scenario, when the graph database system needs to process the connection results of the edges to be connected during the execution of the data operation statement, it can traverse each relation cell in the connection relationship data, and read the attribute data of the edge to be connected from the graph database according to the position information contained in each relation cell. This attribute data serves as the connection result of the edge to be connected. The system then processes the read attribute data to obtain the execution result of the data operation statement. Specifically, as follows... Figure 7 As shown.

[0161] Figure 7 This is a schematic diagram of a reading process provided in an exemplary embodiment.

[0162] Combination Figure 7 As can be seen from Table 4, when the graph database system needs to process the connection results of the edges to be connected during the execution of the data operation statement to be executed, it can traverse each relation unit in the connection relation data and read the attribute data of the edges to be connected from the graph database according to the position information contained in each relation unit.

[0163] Specifically, based on the first value in the first connection array contained in the first connection unit of the connection data, it can be determined that the first element of the left input edge vector needs to be read first. Similarly, based on the first value in the second connection array contained in the first connection array of the first connection unit, it can be determined that the first element of the right input edge vector needs to be read first for connection. This results in the first row of data in the data table after actually connecting the left and right input edge vectors. Then, based on the second value in the first connection array contained in the second connection unit of the connection data, it can be determined that the first element of the left input edge vector needs to be read again. And again, based on the second value in the second connection array contained in the second connection unit of the connection data, it can be determined that the second element of the right input edge vector needs to be read first for connection. This results in the second row of data in the data table after actually connecting the left and right input edge vectors, and so on.

[0164] In practical applications, when a graph database system needs to process all attribute data of the edges to be connected while executing data operation statements, it can determine, based on the first value in the first connection array contained in the first relation unit of the connection data, that it needs to read the first element of the left input edge vector and the first element of the column vector composed of the other attribute data of each edge to be connected corresponding to the left input edge vector. At the same time, based on the first value in the second connection array contained in the first relation unit of the connection data, it can determine that it needs to read the first element of the right input edge vector and the first element of the column vector composed of the other attribute data of each edge to be connected corresponding to the right input edge vector. By connecting these elements, the first row of data in the data table after connecting all attribute data of each edge to be connected corresponding to the left input edge vector and all attribute data of each edge to be connected corresponding to the right input edge vector can be obtained.

[0165] It should be noted that, as can be seen from the above process of determining the connection relationship data, since each relational unit of the connection relationship data contains the position information of each group of elements that meet the connection conditions, and each row of data in the physical table corresponding to the actual connection result is also composed of each group of elements that meet the connection conditions, the attribute data of the edges to be connected is read sequentially from the graph database according to the position information of each group of elements that meet the connection conditions contained in each relational unit of the connection relationship data. This is the same as the data read directly from the data table obtained from the actual connection.

[0166] Based on this, the graph database system can perform data analysis and processing operations such as grouping, sorting, and aggregation calculations on the attribute data of the edges to be connected, so as to obtain the execution results of the data operation statements to be executed.

[0167] Of course, in practical applications, there may be more than two sets of edges that need to be connected (i.e., connecting edge sets under two or more types of labels). In this case, the graph database system can also determine two edge sets from the set of edges that need to be connected as target edge sets, and determine the connection relationship data corresponding to the target edge sets through the above method. Then, based on the connection relationship data corresponding to the two target edge sets, the system can sequentially read the attribute data of the edges to be connected from the graph database and the connection relationship data between the connection results of the two target edge sets and the third edge set determined through the above method, and so on.

[0168] As can be seen from the above, a graph database system can represent two sets of edges that need to be connected using left and right input edge vectors. Then, it can analyze the connection logic of connecting the two sets of edges based on these left and right input edge vectors to determine the corresponding connection relationship data. When the graph database system subsequently executes data operation statements involving the connection results of this connection operation, it can directly utilize the position information in each relational unit contained in the generated connection relationship data to read the attribute data of the corresponding edge from the original position of these attribute data for processing. This not only avoids problems such as cache invalidation, memory fragmentation, and high-latency access caused by large-scale data copying and rearrangement of the original data, but also avoids the occupation of storage resources when storing the data table after connecting two large-scale edge sets.

[0169] Figure 8 This is a schematic structural diagram of a device provided in an exemplary embodiment. For example... Figure 8 As shown, device 800 mainly consists of a communication interface 802, a user interface 804, a processor 806, and a data storage 808. These components are interconnected and communicate with each other via a system bus, network, or other connection mechanism 810. The communication interface 802 enables device 800 to communicate with other devices, access networks, and transmission networks via analog or digital modulation. For example, the communication interface 802 may include a chipset and antenna for wireless communication with a radio access network or access point. Furthermore, the communication interface 802 can be a wired interface such as Ethernet, Token Ring, or a USB port, or a wireless interface such as Wi-Fi, Bluetooth, Global Positioning System (GPS), or a wide-area wireless interface (e.g., WiMAX or LTE). Of course, the communication interface 802 can also support other forms of physical layer interfaces and standard or proprietary communication protocols. The communication interface 802 may also include multiple physical communication interfaces, such as Wi-Fi, Bluetooth, and wide-area wireless interfaces.

[0170] User interface 804 includes receiving user input and providing output to the user. Therefore, user interface 804 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, still camera, and video camera, and output components such as a display screen (which may be combined with a touch-sensitive panel), CRT, LCD, LED, display using DLP technology, printer, and other similar devices known or developed in the future. User interface 804 may also generate auditory output via speakers, speaker jacks, audio output ports, audio output devices, headphones, and other similar devices known or developed in the future. In some embodiments, user interface 804 may include software, circuitry, or other forms of logic capable of transmitting and receiving data to and from external user input / output devices. Additionally or alternatively, device 800 may support remote access from other devices via communication interface 802 or another physical interface (not shown). User interface 804 may be configured to receive user input, the position and movement of which may be indicated by indicators or cursors described herein. User interface 804 may also be configured as a display device for rendering or displaying text fragments.

[0171] The processor 806 may contain one or more general-purpose processors and / or special-purpose processors.

[0172] Data storage 808 may include one or more volatile and / or non-volatile storage components and may be integrated wholly or partially with processor 806. Data storage 808 may include removable and non-removable components.

[0173] Processor 806 is capable of executing program instructions 818 (e.g., compiled or uncompiled program logic and / or machine code) stored in data storage 808 to perform the various functions described herein. Data storage 808 may contain a non-transitory computer-readable medium on which program instructions are stored, which, when executed by device 800, enable device 800 to perform any methods, processes, or functions disclosed in this specification and / or the accompanying drawings. Execution of program instructions 818 by processor 806 may result in processor 806 using data 812.

[0174] For example, program instructions 818 may include an operating system 822 (e.g., an operating system kernel, device drivers, and / or other modules) installed on device 800 and one or more application programs 820 (e.g., a browser, social application, or game application). Similarly, data 812 may include operating system data 816 and application data 814. Operating system data 816 is primarily accessible to the operating system 822, while application data 814 is primarily accessible to one or more application programs 820. Application data 814 may reside in a file system visible or hidden from the user of device 800.

[0175] Application 820 can communicate with operating system 822 through one or more application programming interfaces (APIs). These APIs help application 820 read and / or write application data 814, transmit or receive information via communication interface 802, receive or display information on user interface 804, etc.

[0176] In some terminology, application 820 may be simply referred to as "app". Furthermore, application 820 can be downloaded to device 800 through one or more online app stores or app markets. However, applications can also be installed on device 800 in other ways, such as through a web browser or a physical interface on device 800 (e.g., a USB port).

[0177] Please refer to Figure 9 Business execution devices can be applied to, for example Figure 8 The device shown is used to implement the technical solution described in this specification. The service execution device may include:

[0178] The acquisition module 901 is used to acquire the data operation statement to be executed and determine the connection conditions corresponding to the data operation statement to be executed. The connection conditions include the connection relationship constraints required to connect at least two types of edges in the graph database.

[0179] The parsing module 902 is used to parse the data operation statement to be executed, determine the type label of the edge to be connected involved in the connection condition, and for each type label, obtain the edge vector under that type label from the graph database; each element in the edge vector is used to represent each edge to be connected under that type label;

[0180] The connection module 903 is used to generate connection relationship data based on the elements in each edge vector; the connection relationship data includes multiple relationship units, each relationship unit contains position information of a set of elements that satisfy the connection conditions, wherein each element in the set of elements is taken from a different edge vector; the position information is used to characterize the position of the element in the edge vector;

[0181] The processing module 904 is used to traverse each relation unit in the connection relation data, and read the attribute data of the edge to be connected from the graph database according to the position information contained in each relation unit, and process the read attribute data to obtain the execution result of the data operation statement to be executed.

[0182] Optionally, the graph database is stored in a columnar format;

[0183] The parsing module 902 is specifically used to, for each type label, read the attribute column vector used to store the source node identifier or target node identifier from the attribute column vectors corresponding to the edge set of the type label stored in the graph database, and use it as the edge vector under the type label.

[0184] Optionally, the graph database is stored in row-oriented format;

[0185] The parsing module 902 is specifically used to: for each type label, retrieve records of all edges to be connected under that type label from the graph database, and combine the records into an edge table; read the data corresponding to the source node identifier field in the edge table as the edge vector under that type label.

[0186] Optionally, the parsing module 902 is specifically used to determine the expansion method information corresponding to each edge vector based on the value of each element in each edge vector; the expansion method information is used to represent the expansion rule of each edge vector so that each element in each expanded edge vector and each element in other expanded edge vectors form a one-to-one matching relationship; and generate connection relationship data based on the expansion method information.

[0187] Optionally, each edge vector includes: a left input edge vector and a right input edge vector.

[0188] Optionally, the expansion method information includes: a left expansion factor vector, a right expansion factor vector, and a right offset value vector;

[0189] The connection module 903 is specifically configured to: for each element in the left input edge vector, treat that element as a first type of target element, and determine the number of elements in the right input edge vector whose values ​​are consistent with those of the first type of target element as the expansion factor corresponding to the first type of target element and store it in the left expansion factor vector; for each element in the right input edge vector, treat that element as a second type of target element, and determine the number of elements in the left input edge vector whose values ​​are consistent with those of the second type of target element as the expansion factor corresponding to the second type of target element and store it in the right expansion factor vector; and determine the number of elements in the right input edge vector whose values ​​are consistent with those of the second type of target element as the offset value corresponding to the second type of target element and store it in the right offset value vector.

[0190] Optionally, the connection module 903 is specifically used to determine the expansion method information corresponding to each edge vector by simultaneously traversing the elements in the left input edge vector using the left pointer and the elements in the right input edge vector using the right pointer; wherein: after each movement of the left pointer or the right pointer, the value of the element in the left input edge vector currently pointed to by the left pointer is compared with the value of the element in the right input edge vector currently pointed to by the right pointer; and based on the comparison result, the expansion method information corresponding to the left input edge vector and the expansion method information corresponding to the right input edge vector are determined.

[0191] Optionally, the expansion method information further includes: a left expansion factor vector, a right expansion factor vector, and a right offset value vector;

[0192] The connection module 903 is specifically used to: when, based on the comparison result, it is determined that the value of the element currently pointed to by the left pointer is equal to the value of the element currently pointed to by the right pointer, use the value of the element currently pointed to by the left pointer as the base value; determine whether the value of the next element in the left input edge vector is the same as the base value, and if so, move the left pointer to the next element; determine whether the value of the next element in the right input edge vector is the same as the base value, and if so, move the right pointer to the next element; when it is determined that the value of the next element in the left input edge vector is equal to the base value, use the value of the element currently pointed to by the left pointer as the base value ... left input edge vector is equal to the base value, and if so, move the right pointer to the next element; when it is determined that the value of the next element in the left input edge vector is equal to the base value, use the value of the element currently pointed to by the left pointer as the base value; determine whether the value of the next element in the left input edge vector is equal to the base value, and if so, move the right pointer to the next element; when it is determined that the value of the next element in the left input edge vector is equal to the base value, use the value of the element currently pointed to by the left pointer as the base value, and if so, move the right pointer to the next element; when it is determined that the value of the next element in the left input edge vector is equal to the base value, use the value of the element currently pointed to by the left pointer as the base value, and if so, move the right pointer to the next element; when it is determined that the value of the next element in the left input edge vector is equal to the base value, use the value of the element currently pointed If the base values ​​are different, and the value of the next element in the right input edge vector is different from the base value, then the number of times the left pointer points to the element with the value of the base value is stored in the right expansion multiple vector as the expansion multiple of each element with the value of the base value traversed by the right pointer; the number of times the right pointer points to the element with the value of the base value is stored in the left expansion multiple vector as the expansion multiple of each element with the value of the base value traversed by the left pointer; and the offset value of each element with the value of the base value traversed by the right pointer is stored in the right offset value vector.

[0193] Optionally, the expansion method information further includes: a right null bit flag vector;

[0194] The connection module 903 is specifically used to: when, based on the comparison result, it is determined that the value of the element currently pointed to by the left pointer is less than the value of the element currently pointed to by the right pointer, use the value of the element currently pointed to by the left pointer as the base value; determine whether the value of the next element in the left input edge vector is less than the value of the element currently pointed to by the right pointer; if so, move the left pointer to the next element; if not, add at least one flag value representing a null value to the right null value flag vector; wherein, the number of flag values ​​added to represent null values ​​is the same as the number of times the left pointer moves from pointing to the first element with the value of the base value.

[0195] Optionally, the expansion method information further includes: a left empty value flag vector;

[0196] The connection module 903 is specifically used to: when, based on the comparison result, it is determined that the value of the element currently pointed to by the left pointer is greater than the value of the element currently pointed to by the right pointer, use the value of the element currently pointed to by the right pointer as the base value; determine whether the value of the next element in the right input edge vector is less than the value of the element currently pointed to by the left pointer; if so, move the right pointer to the next element; if not, add at least one element representing a null value to the left null value flag vector; wherein, the number of elements added to represent null values ​​is the same as the number of times the right pointer has moved since pointing to the first element with the value of the base value.

[0197] For ease of description, the above devices are described by dividing them into various modules or units based on their functions. Of course, when implementing one or more of these specifications, the functions of each module or unit can be implemented in the same or different software and / or hardware, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0198] Based on the same concept as the methods described above, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor performs the steps of the method as described in any of the above embodiments by executing the executable instructions.

[0199] Based on the same concept as the methods described above, this specification also provides a computer-readable storage medium having computer instructions stored thereon that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.

[0200] Based on the same concept as the methods described above, this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the methods as described in any of the above embodiments.

[0201] What those skilled in the art will understand is:

[0202] In this specification, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, product, or apparatus that includes said elements is not excluded.

[0203] In this specification, “a,” “an,” and “the” do not specifically refer to the singular, but may also include the plural.

[0204] In this specification, ordinal numbers such as "first," "second," etc., do not necessarily indicate order; they are often used to distinguish between objects. For example, "first server" and "second server" usually refer to two servers. To differentiate between these two servers, they are described as "first server" and "second server." Of course, sometimes these two servers may be the same server.

[0205] In this specification, unless explicitly stated otherwise, "receiving and sending data" does not necessarily mean direct receiving and sending; it can also mean indirect receiving and sending. For example, A receiving data sent by B can be understood as A directly receiving the data sent by B, or it can be understood as A indirectly receiving the data sent by B through other entities such as C. Similarly, B sending data to A can be understood as B sending the data directly to A, or it can be understood as B indirectly sending the data to A through other entities such as C. Here, C can be one entity, or it can be two or more entities.

[0206] In this specification, unless explicitly stated otherwise, the relationships between structures can be direct or indirect. For example, when describing "A is connected to B," unless it is explicitly stated that A and B are directly connected, it should be understood that A can be directly connected to B or indirectly connected to B. Similarly, when describing "A is on top of B," unless it is explicitly stated that A is directly above B (AB is adjacent and A is above B), it should be understood that A can be directly above B or indirectly above B (AB is separated by other elements, and A is above B). And so on.

[0207] This specification uses specific terms to describe embodiments thereof. Terms such as "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Furthermore, those skilled in the art can combine and integrate the different embodiments or examples described herein, as well as the features of those different embodiments or examples, without contradiction.

[0208] Although one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is only one of many possible execution orders and does not represent the only execution order. Therefore, when the claims involve method steps, any changes or adjustments to the order of such steps, or the parallelism between steps, are also within the scope of protection of the claims.

Claims

1. A method for executing a data operation statement based on a graph database, the method comprising: obtaining a data operation statement to be executed, and determining a connection condition corresponding to the data operation statement to be executed, the connection condition comprising a connection relationship constraint required for connecting at least two types of edges in a graph database; parsing the data operation statement to be executed, determining type labels of edges to be connected involved in the connection condition, and for each type label, obtaining an edge vector under the type label from the graph database; each element in the edge vector is used to represent each edge to be connected under the type label; generating connection relationship data according to elements in each edge vector; the connection relationship data comprises a plurality of relationship units, each relationship unit comprises position information of a group of elements satisfying the connection condition, wherein each element in the group of elements is taken from different edge vectors respectively; the position information is used to represent the position of the element in the edge vector; traversing each relationship unit in the connection relationship data, and according to the position information contained in each relationship unit, reading attribute data of edges to be connected from the graph database, and processing the read attribute data to obtain an execution result of the data operation statement to be executed.

2. The method of claim 1, wherein the graph database is stored in a columnar manner; and wherein obtaining an edge vector under each type label from the graph database comprises: for each type label, reading an attribute column vector corresponding to a condition field from attribute column vectors corresponding to an edge set of the type label stored in the graph database, as the edge vector under the type label; the condition field is determined according to the connection condition.

3. The method of claim 1, wherein the graph database is stored in a row manner; and wherein obtaining an edge vector under each type label from the graph database comprises: for each type label, obtaining records of all edges to be connected under the type label from the graph database, and combining the records into an edge table; reading data corresponding to a condition field in the edge table as the edge vector under the type label; the condition field is determined according to the connection condition.

4. The method of claim 1, wherein the connection relationship data is generated according to values of each element in each edge vector, and the generating comprises: determining expansion mode information corresponding to each edge vector according to values of each element in each edge vector; the expansion mode information is used to represent an expansion rule of each edge vector, so that each element in each expanded edge vector and each element in other expanded edge vectors form a one-to-one matching relationship; and generating the connection relationship data according to the expansion mode information. left input edge vector, right input edge vector. left expansion multiple vector, right expansion multiple vector, right offset value vector; determining expansion mode information corresponding to each edge vector according to values of each element in each edge vector, and the determining comprises: ​ ​ ​ ​ 5. The method of claim 4, the respective edge vectors comprising: ​ 6. The method of claim 5, the augmentation mode information comprising: ​ ​ For each element in the left input edge vector, the element is taken as a first type of target element, and the number of elements in the right input edge vector that are identical to the value of the first type of target element is determined as the expansion multiple corresponding to the first type of target element and stored in the left expansion multiple vector; For each element in the right input edge vector, the element is taken as a second type of target element, and the number of elements in the left input edge vector that are identical to the value of the second type of target element is determined as the expansion multiple corresponding to the second type of target element and stored in the right expansion multiple vector, and the number of elements in the right input edge vector that are identical to the value of the second type of target element is determined as the offset value corresponding to the second type of target element and stored in the right offset value vector.

7. The method of claim 5, wherein the expansion mode information corresponding to each edge vector is determined according to the value of each element in the edge vector, and specifically comprises: traversing the elements in the right input edge vector by a right pointer while traversing the elements in the left input edge vector by a left pointer to determine the expansion mode information corresponding to each edge vector; wherein: after each movement of the left pointer or the right pointer, comparing the value of the element in the left input edge vector pointed to by the left pointer with the value of the element in the right input edge vector pointed to by the right pointer; determining the expansion mode information corresponding to the left input edge vector and the expansion mode information corresponding to the right input edge vector according to the comparison result.

8. The method of claim 7, the augmentation mode information further comprising: a left expansion multiple vector, a right expansion multiple vector, and a right offset value vector; determining the expansion mode information corresponding to the left input edge vector and the expansion mode information corresponding to the right input edge vector according to the comparison result, and specifically comprises: when it is determined according to the comparison result that the value of the element pointed to by the left pointer is equal to the value of the element pointed to by the right pointer, taking the value of the element pointed to by the left pointer as a base value; judging whether the value of the next element in the left input edge vector is the same as the base value, and if so, moving the left pointer to point to the next element; judging whether the value of the next element in the right input edge vector is the same as the base value, and if so, moving the right pointer to point to the next element; when it is determined that the value of the next element in the left input edge vector is not the same as the base value and the value of the next element in the right input edge vector is not the same as the base value, storing the number of times the left pointer points to the element with the base value in the right expansion multiple vector as the expansion multiple of each element with the base value traversed by the right pointer; storing the number of times the right pointer points to the element with the base value in the left expansion multiple vector as the expansion multiple of each element with the base value traversed by the left pointer, and in the right offset value vector as the offset value of each element with the base value traversed by the right pointer.

9. The method of claim 8, the augmentation mode information further comprising: a right null value bit flag vector; According to the comparison result, the left input edge vector corresponding to the expansion mode information and the right input edge vector corresponding to the expansion mode information are determined, and specifically comprising: When it is determined according to the comparison result that the value of the element currently pointed to by the left pointer is less than the value of the element currently pointed to by the right pointer, the value of the element currently pointed to by the left pointer is taken as a basic value; It is judged whether the value of the next element in the left input edge vector is less than the value of the element currently pointed to by the right pointer, and if so, the left pointer is moved to point to the next element; If not, at least one flag value representing a null value is added to the right null bit flag vector; wherein the number of added flag values representing a null value is the same as the number of times the left pointer is moved from pointing to the first element whose value is the basic value.

10. The method of claim 8, the augmentation mode information further comprising: The left null bit flag vector; According to the comparison result, the left input edge vector corresponding to the expansion mode information and the right input edge vector corresponding to the expansion mode information are determined, and specifically comprising: When it is determined according to the comparison result that the value of the element currently pointed to by the left pointer is greater than the value of the element currently pointed to by the right pointer, the value of the element currently pointed to by the right pointer is taken as a basic value; It is judged whether the value of the next element in the right input edge vector is less than the value of the element currently pointed to by the left pointer, and if so, the right pointer is moved to point to the next element; If not, at least one element representing a null value is added to the left null bit flag vector; wherein the number of added elements representing a null value is the same as the number of times the right pointer is moved from pointing to the first element whose value is the basic value.

11. An electronic device, comprising: Comprising: A processor; A memory for storing processor executable instructions; wherein the processor implements the steps of the method according to any one of claims 1-10 by running the executable instructions.

12. A computer-readable storage medium, characterized in that, A computer program / instructions stored thereon, which is executed by a processor to implement the steps of the method according to any one of claims 1-10.

13. A computer program product, characterised in that, A computer program / instructions stored thereon, which is executed by a processor to implement the steps of the method according to any one of claims 1-10.