Query disassembly test method and device for Gremlin-based graph database system
By disassembling the Gremlin query into an atomic graph traversal operation and comparing the results, the problem of the inability to detect Gremlin API assembly errors in the prior art is solved, and the logical error detection of the graph database system is realized.
Patent Information
- Application Number
- CN202410030905.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-09
- Publication Date
- 2025-07-11
AI Technical Summary
Existing testing methods cannot effectively detect logical errors caused by incorrect implementation and optimization of Gremlin API assembly in Gremlin-based graph database systems.
The complex graph traversal operations are broken down into a series of atomic graph traversal operations, and logical errors are detected by comparing the query results, including generating a graph database, randomly generating Gremlin query statements, disassemblying into an atomic graph traversal list, performing atomic graph traversal and comparing the results.
It can detect logical errors of Gremlin API assembly in a single target graph database system, cover more Gremlin query characteristics, and improve the coverage of detection logic errors.
Smart Images

Figure CN120295900A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a test method for a graph database system, and in particular to a query decomposition test method and device for a graph database system based on Gremlin, belonging to the field of software technology. Background Art
[0002] Graph database systems support the efficient storage and query of property graph data (composed of a set of vertices and edges), and their popularity has increased sharply, and they have played an important role in many applications, such as social networks, knowledge graphs, fraud detection, and medical health. According to the latest ranking of graph database systems (DB-Engines Ranking of Graph DBMS), there are currently 38 widely used graph database systems, such as Neo4j, OrientDB, Amazon Neptune, JanusGraph, TigerGraph, and NebulaGraph.
[0003] Different from relational database systems (such as MySQL, MariaDB, TiDB, and PostgreSQL) that use the declarative query language SQL (Structured Query Language) as the standard query language to access relational data, graph database systems do not have a standardized query method for accessing graph data and usually use their own query languages, such as the GSQL graph query language developed by TigerGraph and the nGQL graph query language developed by NebulaGraph. However, according to the graph database systems listed in the graph database system ranking, approximately half of the graph database systems (such as Neo4j, OrientDB, JanusGraph, HugeGraph, TinkerGraph, and ArcadeDB) support the Gremlin query language developed by Apache TinkerPop. We call these graph database systems that support the Gremlin query language Gremlin-based graph database systems.
[0004] The Gremlin query language provides a set of Gremlin APIs for creating, modifying, and querying graph data. The Gremlin APIs can form the smallest graph traversal (including one or more Gremlin APIs) for accessing graph data, that is, atomic graph traversal. Developers can further assemble sequences of Gremlin APIs to generate complex graph queries, thereby realizing complex graph data analysis.
[0005] To improve the performance of Gremlin queries, graph database systems usually adopt complex execution and optimization strategies. For example, reordering filtering operations to prioritize those with less time consumption, and merging filtering conditions to achieve efficient graph queries. The complexity of these execution and optimization strategies poses challenges to the correctness of graph database systems. Incorrect implementation and optimization of the Gremlin API assembly in graph database systems may lead to logical errors, causing the graph database system to return incorrect query results for a given Gremlin query, such as missing a vertex.
[0006] Such logical errors caused by incorrect implementation and optimization of the Gremlin API assembly are difficult to detect and are easily overlooked by developers. However, we lack effective test oracles to automatically test graph database systems and detect logical errors related to the Gremlin API assembly. Currently, Grand, GDsmith, and RD 2 adopt differential testing to reveal the differences in query results of multiple graph database systems for the same graph database and graph query. However, when all graph database systems return the same and incorrect query results, differential testing will miss such logical errors and can only be used to test the common features in the target graph database system. GDBMeter splits a graph query statement into three sub-queries according to whether the predicate condition is judged as true, false, or NULL, and compares the combined query results of the three split sub-queries with the query result of the original query statement. If the results are inconsistent, a logical error is found. However, this method cannot block the optimization strategy of Gremlin queries and thus cannot detect logical errors caused by incorrect optimization of the Gremlin API assembly. In addition, some testing methods propose new test oracles that can effectively discover logical errors in a single relational database system. However, these methods cannot be applied to Gremlin-based graph database systems because the functional Gremlin query language uses a syntax and query pattern completely different from declarative SQL.
[0007] In summary, the existing methods cannot detect logical errors caused by incorrect implementation and optimization of the Gremlin API assembly in graph database systems. Summary of the Invention
[0008] To address the above problems, the present invention provides a query disassembling test method and device for a Gremlin-based graph database system, which disassembles a complex graph traversal operation into a series of atomic graph traversal operations to discover logical errors caused by incorrect implementation and optimization of the Gremlin API assembly in the Gremlin-based graph database system.
[0009] The atomic graph traversal refers to implementing a one-step graph traversal operation in a graph database, which may include one or more Gremlin API calls. The output type of the query result set returned by it is a vertex or an edge, and any subsequence of its Gremlin API calls cannot return a result set with an output type of a vertex or an edge.
[0010] To achieve the above object, the technical solution of the present invention includes the following content.
[0011] A query decomposition test method for a graph database system based on Gremlin, the method includes:
[0012] Generate a graph database for the target graph database system;
[0013] Randomly generate a Gremlin query statement, which is assembled by multiple Gremlin APIs;
[0014] Query the target graph database based on the Gremlin query statement to obtain a query result RS Q ;
[0015] Decompose the Gremlin query statement into a list of atomic graph traversals, and execute the atomic graph traversal operations in the list of atomic graph traversals to obtain a query result RS TList ;
[0016] Compare the query result RS Q with the query result RS TList and obtain the test result of the target graph database system according to the comparison result.
[0017] Further, generating a graph database for the target graph database system includes:
[0018] Randomly generate a graph schema, which includes definitions of vertex types and edge types;
[0019] According to the definitions of vertex types and edge types, randomly generate a specified number of vertex instances and edge instances;
[0020] Write the vertex instances and the edge instances into the target graph database system to obtain the graph database under the target graph database system.
[0021] Further, the vertex type includes: a vertex label and one or more attribute types; the edge type includes: an edge label, one or more attribute types, an in-edge vertex type, and an out-edge vertex type; the attribute type includes: an attribute name and an attribute data type.
[0022] Further, disassemble the Gremlin query statement into a list of atomic graph traversals, including:
[0023] Obtain the Gremlin APIs included in the Gremlin query statement;
[0024] Analyze each Gremlin API in the order of Gremlin APIs in the Gremlin query statement to determine whether the Gremlin API is an atomic graph traversal;
[0025] Based on the analysis results of all Gremlin APIs, generate a list of atomic graph traversals for the Gremlin query statement.
[0026] Further, disassemble the Gremlin query statement into a list of atomic graph traversals, and analyze each Gremlin API to determine whether the Gremlin API is an atomic graph traversal, including:
[0027] Initialize the atomic graph traversal list TList as an empty list, and initialize an atomic graph traversal atomicT as an empty list;
[0028] Extract all Gremlin APIs from the Gremlin query statement in the order of Gremlin API calls, and store them in the list APISequence;
[0029] For each Gremlin API in the list APISequence, after adding the Gremlin API to the atomic graph traversal atomicT, check whether the output type of the Gremlin API is a vertex type or an edge type;
[0030] When the output type of the Gremlin API is a vertex type or an edge type, store the Gremlin API in the atomic graph traversal list TList from the atomic graph traversal atomicT, and set the atomic graph traversal atomicT to be empty to find a new atomic graph traversal.
[0031] Further, perform the atomic graph traversal operations in the atomic graph traversal list to obtain the query result RS TList , including:
[0032] Sequentially perform the atomic graph traversals in the atomic graph traversal list, and use the query result of the previous atomic graph traversal as the input parameter for the next atomic graph traversal;
[0033] Use the query result of the last atomic graph traversal as the query result RS TList。
[0034] Further, perform the atomic graph traversal operations in the atomic graph traversal list to obtain the query result RS TList ,including:
[0035] Sequentially perform the atomic graph traversals in the atomic graph traversal list and create a temporary ID table for each atomic graph traversal; wherein, the temporary ID table includes: the label of the atomic graph traversal and the query result of the atomic graph traversal;
[0036] When performing the next atomic graph traversal, obtain the query result of the previous atomic graph traversal from the temporary ID table based on the label of the previous atomic graph traversal, and use the query result of the previous atomic graph traversal as the input for the next atomic graph traversal;
[0037] Use the query result of the last atomic graph traversal as the query result RS TList ,and delete the temporary ID table.
[0038] Further, perform the atomic graph traversal operations in the atomic graph traversal list to obtain the query result RS TList ,including:
[0039] For the atomic graph traversals in the atomic graph traversal list, add a barrier operation barrier() after each atomic graph traversal except the last one to obtain the assembled query statement;
[0040] Execute the assembled query statement to obtain the query result RS TList 。
[0041] Further, compare the query result RS Q and the query result RS TList and obtain the test result of the target graph database system according to the comparison result, including:
[0042] Sort the elements in the query result RS Q and the query result RS TList ;
[0043] Sequentially compare each element in the query result RS Q and the query result RS TList ;
[0044] When each element corresponds, there is no logical error in the target graph database system;
[0045] When any element does not correspond, there is a logical error in the target graph database system.
[0046] A query decomposition test device for a graph database system based on Gremlin, the device comprising:
[0047] A database generation module for generating a graph database for a target graph database system;
[0048] A query statement generation module for randomly generating a Gremlin query statement assembled from multiple Gremlin APIs;
[0049] A first query module for querying the target graph database based on the Gremlin query statement to obtain a query result RS Q ;
[0050] A second query module for disassembling the Gremlin query statement into an atomic graph traversal list and performing atomic graph traversal operations in the atomic graph traversal list to obtain a query result RS TList ;
[0051] A result generation module for comparing the query result RS Q and the query result RS TList and obtaining a test result of the target graph database system according to the comparison result.
[0052] Compared with the prior art, the method of the present invention has the following advantages:
[0053] (1) The present invention proposes a new graph database system test oracle that can detect logical errors related to the correct assembly of graph traversals for a single target graph database system;
[0054] (2) The present invention proposes three atomic graph traversal execution strategies that can cover more Gremlin query features, thereby detecting more logical errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is the overall test flow chart of the method of the present invention.
[0056] Figure 2 is the generated graph data instance.
[0057] Figure 3 is an atomic graph traversal instance executed using the parameter passing strategy.
[0058] Figure 4 is an atomic graph traversal instance executed using the temporary ID table strategy.
[0059] Figure 5 is an atomic graph traversal instance executed using the fence strategy. DETAILED DESCRIPTION OF THE INVENTION
[0060] Next, in combination with the accompanying drawings and specific embodiments, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only specific embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0061] The query decomposition test method of the graph database system of the present invention is applicable to the test of the Gremlin query API (for example, atomic graph traversal operations such as has(), where(), out(), etc.). It disassembles a randomly generated Gremlin query Q into an atomic graph traversal sequence TList = <T1, T2,..., T n >, where T i represents the i-th atomic graph traversal in Q, and detects whether there is a logical error by comparing whether the query result of Q is consistent with the query result of TList.
[0062] Specifically, the query decomposition test method of the graph database system of the present invention, as Figure 1 shown, the specific implementation steps are as follows.
[0063] Step 1: Randomly generate a graph database.
[0064] The graph database generated by the present invention for the target graph database system includes a vertex set and an edge set, as Figure 2 shown. Among them, the vertex types include: vertex labels, one or more attribute types; the edge types include: edge labels, one or more attribute types, incoming vertex types, and outgoing vertex types; the attribute types include: attribute names and attribute data types; the number of vertex types, edge types, and attribute types in the generated graph schema can be manually configured. Specifically, the generation of the graph database includes the following steps:
[0065] a) Randomly generate a graph schema, including vertex type and edge type definitions. For example, in Figure 2 , generate two vertex types, and their vertex labels are 'person' and 'book' respectively. Among them, the vertex attributes of the 'person' type vertex are <name, String> and <age, Integer>. The vertex attributes of the 'book' type vertex are <title, String> and
[0066] <language, String>. The first parameter in the vertex attributes is the attribute name, and the second parameter is the attribute data type. Generate two edge types, with their edge labels being 'write' and'read' respectively. Among them, the edge attributes of the 'write' type are <since, Integer>, its in-edge vertex type is 'book', and its out-edge vertex type is 'person'. The edge attributes of the'read' edge type are <time, Integer>, its in-edge vertex type is 'book', and its out-edge vertex type is 'person'.
[0067] b) According to the generated graph pattern above, randomly generate a specified number of vertex and edge instances. For example, Figure 2 among them, randomly generate 3 vertices of the 'person' type, namely v:1, v:3, and v:4, and randomly generate the attribute values of their attributes 'name' and 'age'; for example, the 'name' value of vertex v:1 is 'Alice', and the 'age' value is 26. Generate a 'book'
[0068] type vertex v:2, and randomly generate the attribute values of its attributes 'title' and 'language', that is, the 'title' value is 'HelloWorld' and the 'language' value is 'English'. According to the generated vertex instances, generate specific edge instances. For example, generate an edge of the 'write' type, with its attribute'since' value being 2020, its in-edge vertex being the 'book' type vertex v:2, and its out-edge vertex being the 'person' type vertex v:1.
[0069] c) Call the Gremlin update API to write the above-generated vertex instances and edge instances into the target graph database system (such as ArcadeDB). For example, call g.addV() to write vertex v:1 into the target graph database system; call g.addE()
[0070] to write edge e:1 into the target graph database system.
[0071] In summary, for the target graph database system, the present invention randomly generates a graph database gdb according to the generated graph pattern, including a vertex instance set and an edge instance set, and writes them into the target graph database system according to the Gremlin update APIs (i.e., addV(), addE(), etc.). Among them, for the vertex instance, a vertex type is randomly selected, and then according to the data type of each vertex attribute, random vertex attribute values are generated for it; for the edge instance, an edge type is randomly selected, random edge attribute values are generated according to the data type of each edge attribute, and then a vertex instance is selected from the generated vertex instances as the in-edge vertex (out-edge vertex) of the edge instance according to the in-edge vertex type (out-edge vertex type); the number of generated vertex instances and edge instances can be manually configured.
[0072] Step 2: Randomly generate a Gremlin query statement.
[0073] Generate a Gremlin query statement for testing the target graph database system. This query statement is assembled by multiple Gremlin graph traversals (Gremlin APIs). For example, generate a Gremlin query statement g.V().has('person', 'age', lt(30)).hasLabel('person', 'book'). This statement contains a V() operation to obtain all vertices; a has() operation, including a label name 'person', an attribute name 'age', and a predicate lt(30); and a hasLabel() operation, including label names 'person' and 'book'.
[0074] Step 3: Execute the given Gremlin query statement and obtain the query result RS Q 。
[0075] As Figure 1 shown, execute the query statement g.V().has('person', 'age', lt(30)).hasLabel('person', 'book') generated in (2) in the ArcadeDB graph database system to obtain the query result RS Q = v:{1,2,3,4}.
[0076] Step 4: Decompose the given Gremlin query statement into a list of atomic graph traversals.
[0077] The present invention decomposes the generated Gremlin query statement Q into a list of atomic graph traversals TList = <T1, T2,..., T n>. Among them, the input of the i-th atomic graph traversal T stored in TList is the previous atomic graph traversal T i and the output result of (i > 1), that is, the query result of the TList is the output result of its last atomic graph traversal T i-1 . The specific steps are as follows: n
[0078] (1) Initialize the atomic graph traversal list TList as an empty list, and initialize an atomic graph traversal atomicT as an empty list;(1) Initialize the atomic graph traversal list TList as an empty list, and initialize an atomic graph traversal atomicT as an empty list;
[0079] (2) Extract all Gremlin APIs from the generated Gremlin query statement Q in the order of Gremlin API calls and store them in the list APISequence;
[0080] (3) For each Gremlin API call api in APISequence, first add it to atomicT, and then determine whether it needs to be disassembled after the API call api in the Gremlin query statement Q. Specifically, first check whether the output type of api is a vertex type or an edge type; if so, obtain an atomic graph traversal, store atomicT in TList, set atomicT to empty, and then continue to find a new atomic graph traversal.
[0081] Take Figure 1 as an example. The Gremlin query statement g.V().has('person', 'age', lt(30)).hasLabel('person', 'book') contains a total of four Gremlin APIs, namely V(), lt(), has(), and hasLabel(). Next, judge whether atomic graph traversal splitting is required in the order of APIs:
[0082] a) The output type of V() is a vertex type, so V() is an atomic graph traversal;
[0083] b) lt() is a predicate operation and exists as a parameter of has(), so lt() has no output type and needs to be stored in the atomic graph traversal list atomicT, that is, atomicT = {lt()};
[0084] c) has() is a filtering operation with an output type that is the same as its input type. Since the input type of has() is V(), the output type of has() is the vertex type. Store it in atomicT = {lt(), has()}, and an atomic graph traversal is obtained, namely has('person', 'age', lt(30));
[0085] d) hasLabel() is a filtering operation with an output type that is the same as its input type. Since its input type is the vertex type, its output type is also the vertex type. Therefore, hasLabel('person', 'book') is an atomic graph traversal;
[0086] e) Finally, a total of 3 atomic graph traversals are obtained, namely V(), has('person', 'age', lt(30)), and hasLabel('person',
[0087] ‘book’).
[0088] Step 5: Execute the atomic graph traversal operations in the atomic graph traversal list and obtain the final query result RS TList .
[0089] Execute the three atomic graph traversals obtained in (4) in sequence, and use the output result of the previous atomic graph traversal as the input of the next atomic graph traversal. According to the storage method of the atomic graph traversal output result, the present invention proposes the following three atomic graph traversal execution strategies: parameter passing strategy, temporary ID table strategy, and fence strategy.
[0090] 1) The parameter passing strategy stores the IDs of the output results (vertices or edges) of the atomic graph traversal T i-1 (i > 1) in the list idList. Specifically, to calculate the output result RS i of the atomic graph traversal T Ti , the following steps are included:
[0091] (1) When calculating the atomic graph traversal T i , take out the ID of the output result of its previous atomic graph traversal T i-1 (i > 1) from the idList; if the IDs stored in the idList are vertex IDs, then call g.V(idList),
[0092] otherwise call g.E(idList);
[0093] (2) Execute g.V(idList).T i or g.E(idList).T i , and obtain the atomic graph traversal Ti The output result RS Ti ;
[0094] (3) Iteratively execute the above operations until the final output result RS is obtained TList , that is, RS Tn ;
[0095] As Figure 3 shown, the execution process of the parameter passing strategy includes:
[0096] a) First, execute the first atomic graph traversal g.V() (line 1) obtained in (4) to get the query result
[0097] v:{1,2,3,4};
[0098] b) Then, take v:{1,2,3,4} as the input and execute the second atomic graph traversal (line 2) obtained in (4) to get the query result v:{1,4};
[0099] c) Finally, take v:{1,4} as the input and execute the third atomic graph traversal (line 3) obtained in (4) to get the final query result v:{1,4}.
[0100] 2) The temporary ID table strategy creates a temporary ID vertex for each output result (vertex or edge) of the atomic graph traversal T i-1 (i>1). Each temporary ID vertex has a vertex label 'IDs' and a vertex attribute 'id'. The attribute value of the vertex attribute 'id' is an output result ID of the stored atomic graph traversal T i-1 . Specifically, calculating the output result RS of the atomic graph traversal T i includes the following steps: Ti :
[0101] (1) Call the Gremlin query g.V().hasLabel('IDs').values('id').as('vList') to obtain all the above-created temporary ID vertices into the variable 'vList';
[0102] (2) On the basis of the above Gremlin query call, continue to call the Gremlin query V().as('V').id().as('V_ID').where('vList', P.eq('V_ID')).select('V'), and obtain the output result RS of T i-1 from the above-generated graph database gdb according to the vertex attribute 'id' in the temporary ID vertices stored in the above variable 'vList' Tn-1 ;
[0103] (3) Based on the above Gremlin query call, continue to call the atomic graph traversal T i to obtain the output result RS Ti ;
[0104] (4) Call the Gremlin query g.V().hasLabel('IDs').drop() to delete the temporary ID vertices stored in the above 'vList';
[0105] (5) Iteratively execute the above operations until the final output result RS TList is obtained, that is, RS Tn ;
[0106] As Figure 4 shown, taking the third atomic graph traversal obtained in (4) as an example, the use of the temporary ID table strategy includes the following:
[0107] a) First, create a temporary ID table for the query result of the second atomic graph traversal obtained in (4) (lines 2 - 3);
[0108] b) Then, obtain the vertices with the label 'IDs' (line 6), and based on its result, obtain the query result of the second atomic graph traversal obtained in (4) (lines 7 - 9), and finally execute the third atomic graph traversal obtained in (4) (line 10) to obtain the query result v:{1,4};
[0109] c) Finally, delete the created temporary ID table (line 13).
[0110] 3) The fence strategy is to add a fence barrier() operation after each atomic graph traversal. For example, T i- 1.barrier().T i . The barrier() operation can force the atomic graph traversal T i-1 to be executed first, and then the atomic graph traversal T i , so that the adjacent two atomic graph traversals can be disassembled by the barrier() operation.
[0111] As Figure 5 shown, the use of the fence strategy includes the following:
[0112] a) First, add a fence operation barrier() after each (except the last) atomic graph traversal, such as the barrier() operations added at the end of lines 1 and 2;
[0113] b) Then, execute the entire assembled query statement (i.e., lines 1 - 3) to obtain the final query result v:{1,4}.
[0114] Step 6: Compare the query results. Compare the query result RS Q = v:{1,2,3,4} obtained in (3) above with the query result RS TList = v:{1,4} obtained in (5) above.
[0115] a) First, sort the results of RS Q and RS TList , that is, RS Q = v:{1,2,3,4}, RS TList = v:{1,4};
[0116] b) Then, compare each element of RS Q and RS TList in turn. Since the second element 2 of RS Q is not equal to the second element 4 of RS TList , so RS Q ≠ RS TList , indicating that this query statement triggers a potential logical error in the ArcadeDB graph database and further manual analysis is required.
[0117] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. Those of ordinary skill in the art can understand that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. Therefore, the present invention should not be limited to the content disclosed in the embodiments of this specification, and the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A query decomposition testing method for a graph database system based on Gremlin, characterized in that, The method includes: Generating a graph database for a target graph database system; Randomly generating a Gremlin query statement, which is assembled by multiple Gremlin APIs; Query the target graph database based on the Gremlin query statement to obtain a query result RS Q ; Decompose the Gremlin query statement into a list of atomic graph traversals, and execute the atomic graph traversal operations in the list of atomic graph traversals to obtain the query result RS TList ; Compare the query result RS Q with the query result RS TList and obtain the test result of the target graph database system according to the comparison result.
2. The method according to claim 1, wherein The generating a graph database for a target graph database system includes: Randomly generating a graph schema, which includes definitions of vertex types and edge types; According to the definitions of vertex types and edge types, randomly generating a specified number of vertex instances and edge instances; Invoking writing the vertex instances and the edge instances into the target graph database system to obtain the graph database under the target graph database system.
3. The method according to claim 2, wherein The vertex type includes: a vertex label and one or more attribute types; the edge type includes: an edge label, one or more attribute types, an in-edge vertex type, and an out-edge vertex type; the attribute type includes: an attribute name and an attribute data type.
4. The method according to claim 1, characterized in that, Disassembling the Gremlin query statement into a list of atomic graph traversals, including: Obtaining the Gremlin APIs included in the Gremlin query statement; Analyzing each Gremlin API in the order of Gremlin APIs in the Gremlin query statement to determine whether the Gremlin API is an atomic graph traversal; Based on the analysis results of all Gremlin APIs, generating the list of atomic graph traversals of the Gremlin query statement.
5. The method according to claim 4, wherein Disassembling the Gremlin query statement into a list of atomic graph traversals and analyzing each Gremlin API to determine whether the Gremlin API is an atomic graph traversal, including: Initializing the list of atomic graph traversals TList as an empty list and initializing an atomic graph traversal atomicT as an empty list; Extracting all Gremlin APIs from the Gremlin query statement in the order of Gremlin API calls and storing them in the list APISequence; For each Gremlin API in the list APISequence, after adding the Gremlin API to the atomic graph traversal atomicT, checking whether the output type of the Gremlin API is a vertex type or an edge type; When the output type of the Gremlin API is a vertex type or an edge type, storing the Gremlin API in the atomic graph traversal atomicT into the list of atomic graph traversals TList and setting the atomic graph traversal atomicT to be empty to find a new atomic graph traversal.
6. The method according to claim 1, characterized in that Performing the atomic graph traversal operation in the atomic graph traversal list to obtain a query result RS TList , including: Sequentially executing the atomic graph traversals in the list of atomic graph traversals and using the query result of the previous atomic graph traversal as the input parameter of the next atomic graph traversal; Use the query result of traversing the last atomic graph as the query result RS TList .
7. The method according to claim 1, wherein Performing the atomic graph traversal operation in the execution atomic graph traversal list to obtain a query result RS TList , including: Sequentially executing the atomic graph traversals in the list of atomic graph traversals and creating a temporary ID table for each atomic graph traversal; wherein, the temporary ID table includes: the label of the atomic graph traversal and the query result of the atomic graph traversal. When performing the next atomic graph traversal, obtain the query result of the previous atomic graph traversal from the temporary ID table based on the label of the previous atomic graph traversal, and use the query result of the previous atomic graph traversal as the input for the next atomic graph traversal; Use the query result of traversing the last atomic graph as the query result RS TList , and delete the temporary ID table.
8. The method according to claim 1, characterized in that, Performing the atomic graph traversal operation in the atomic graph traversal list to obtain a query result RS TList , including: For each atomic graph traversal in the atomic graph traversal list, add a barrier operation barrier() after each atomic graph traversal except the last one to obtain the assembled query statement; Execute the assembled query statement to obtain the query result RS TList .
9. The method according to claim 1, characterized in that, The query result RS Q and the query result RS TList are compared, and the test result of the target graph database system is obtained according to the comparison result, including: For the query result RS Q and the elements in the query result RS TList are sorted; Compare each element in the query result RS in sequence Q and the query result RS TList ; When each element corresponds, there is no logical error in the target graph database system; When any element does not correspond, there is a logical error in the target graph database system.
10. A query disassembling test device for a graph database system based on Gremlin, characterized in that, The device includes: A database generation module for generating a graph database for the target graph database system; A query statement generation module for randomly generating a Gremlin query statement, which is assembled by multiple Gremlin APIs; The first query module is used to query the target graph database based on the Gremlin query statement to obtain a query result RS Q ; The second query module is configured to disassemble the Gremlin query statement into a list of atomic graph traversals, and execute the atomic graph traversal operations in the list of atomic graph traversals to obtain a query result RS TList ; A result generation module for generating the query result RS Q and the query result RS TList are compared, and the test result of the target graph database system is obtained according to the comparison result.