Data query method and device, equipment and storage medium

By constructing the weight matrix and reordering triple mode, the SPARQL query path is optimized, the problem of low query efficiency of RDF data sets is solved, and efficient query results are achieved.

CN119003608APending Publication Date: 2024-11-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310582925.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-22
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

With the increase in the scale of RDF data sets and the increase in the complexity of SPARQL query, query efficiency gradually decreases, and it is difficult for the existing technology to conduct efficient query on massive RDF data sets.

Method used

By converting the triple pattern corresponding to the SPARQL query statement into the basic graph pattern, a fully directed graph is built, and a weight matrix is ​​constructed based on the connection cost between the triple patterns, and reordering the triple pattern to determine the target query path, thereby optimizing query paths.

Benefits of technology

It effectively improves the efficiency of SPARQL query, reduces query time, and improves the accuracy and efficiency of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003608A_ABST
    Figure CN119003608A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data query method and device, equipment and a storage medium, and the method relates to the technical field of computers, and comprises the following steps: determining a basic diagram mode according to a triple mode corresponding to a query statement, and determining a fully directed graph corresponding to the basic diagram mode, the node of the fully directed graph representing each triple mode; converting the complete directed graph into a weight matrix according to the connection cost between the triple modes; and reordering the triple pattern, determining a target query path based on the weight matrix and a reordering result, and querying a resource description framework (RDF) data set based on the target query path to determine a query result. According to the technical scheme, after the triple modes are reordered, the arrangement sequence of the triple modes with the highest connection cost is determined as the target query path, the execution time of the target query path at the moment is shortest, and the query result corresponding to the query statement is determined based on the query data set of the target query path, so that the query efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a data query method, device, equipment and storage medium. Background Art

[0002] Resource Description Framework (RDF) is a standard model for representing entities / resources. RDF can describe data by defining the relationship between data objects. Therefore, all data can be represented by RDF, which makes the interaction between data and information easier. RDF data sets are composed of a series of triples consisting of subject, predicate, and object. SPARQL (SPARQL Protocol and RDF Query Language, a query language and data acquisition protocol developed for RDF) queries can be used as query statements to query RDF data sets. SPARQL queries include multiple sets of triple patterns, and at least one of the subject, predicate, and object of the triple pattern can be a variable.

[0003] In the prior art, a query path is determined based on a SPARQL query, and a query is performed in an RDF dataset according to a plurality of sorted triple patterns in the query path to determine a query result corresponding to the SPARQL query.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following technical problems in the prior art:

[0005] As the size of RDF datasets grows and SPARQL queries become more complex, query efficiency gradually decreases. Summary of the invention

[0006] The present invention provides a data query method, device, equipment and storage medium to improve SPARQL query efficiency.

[0007] In a first aspect, an embodiment of the present invention provides a data query method, including:

[0008] Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns;

[0009] Converting the complete directed graph into a weight matrix according to the connection costs between the triplet patterns;

[0010] The triple patterns are reordered based on the weight matrix, a target query path is determined according to the reordering result, and a resource description framework (RDF) data set is queried based on the target query path to determine a query result.

[0011] In a second aspect, an embodiment of the present invention further provides a data query device, including:

[0012] A determination module, configured to determine a basic graph pattern according to a triple pattern corresponding to a query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein nodes of the complete directed graph represent each of the triple patterns;

[0013] A conversion module, used for converting the complete directed graph into a weight matrix according to the connection costs between the triple patterns;

[0014] The query module is used to reorder the triple patterns based on the weight matrix, determine a target query path according to the reordering result, and query a resource description framework RDF data set based on the target query path to determine a query result.

[0015] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a data query method as described in any one of the first aspects when executing the program.

[0016] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the data query method as described in any one of the first aspects.

[0017] The embodiments of the above invention have the following advantages or beneficial effects:

[0018] An embodiment of the present invention provides a data query method, which includes: determining a basic graph pattern according to a triple pattern corresponding to a query statement, determining a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns; converting the complete directed graph into a weight matrix according to the connection cost between each of the triple patterns; reordering the triple patterns, determining a target query path based on the weight matrix and the reordering result, and querying a resource description framework RDF data set based on the target query path to determine a query result. The above technical scheme, after obtaining the query statement, can determine the triple pattern corresponding to the query statement, and then determine the complete directed graph according to the basic graph pattern formed by the triple pattern corresponding to the query statement, and after determining the connection cost between the triple patterns, use the connection cost between the triple patterns as the weight of the edge of the complete directed graph corresponding to the basic graph pattern formed by the triple pattern, and then use the weight of each edge of the complete directed graph as a matrix element to construct a weight matrix, reorder the triple patterns to determine the arrangement order of multiple triple patterns, and determine the connection cost of multiple triple pattern arrangement orders according to the weight matrix, that is, the execution time of the query path corresponding to the multiple triple pattern arrangement orders. Therefore, the triple pattern arrangement order with the highest connection cost can be determined as the target query path, and the execution time of the target query path at this time is also the shortest. Then, based on the target query path, the query result corresponding to the query statement is determined by querying the data set, which effectively improves the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of a data query method provided by an embodiment of the present invention;

[0020] Figure 2 A flowchart of another data query method provided by an embodiment of the present invention;

[0021] Figure 3 A complete directed graph corresponding to a basic graph pattern consisting of a triple pattern corresponding to a query statement provided in the illustrated embodiment;

[0022] Figure 4 A flowchart of another data query method provided by an embodiment of the present invention;

[0023] Figure 5 A schematic diagram of the structure of a data query device provided by an embodiment of the present invention;

[0024] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0026] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.

[0027] RDF is a language used to describe information about network resources and to express data about network resources. RDF is a general method for describing data by defining the relationship between data objects. RDF is built around the existing network and is also a data model for the semantic web. Therefore, all data in semantic web technology can be represented by RDF. RDF makes the interaction between data and information easier. RDF provides a way to create, combine and share semantic information. Using RDF can more flexibly model complex interactions between multiple entities, attach attributes to relationships, and store metadata about triples, which can more accurately model the real world while improving the ability to understand and verify the source of data.

[0028] RDF data is represented in the form of triples. Triple data consists of subject, predicate, and object. RDF datasets are composed of a series of triples. SPARQL is a query language and data acquisition protocol for RDF datasets. SPARQL not only supports connections, but also supports a wider range of relational algebra transformations.

[0029] With the gradual development of semantic web technology, the size of RDF datasets has increased dramatically. RDF has become a popular format for knowledge graphs, including Bio2RDF, DBpedia, PubChemRDF, UniProt, and Wikidata, which contain billions of triples. As the size of RDF datasets grows and SPARQL queries become more complex, the efficiency of SPARQL queries gradually decreases. Therefore, how to perform efficient queries on massive RDF datasets has become a challenging problem.

[0030] Therefore, this application proposes a data query method to improve the efficiency of SPARQL query.

[0031] The data query method proposed in this application will be described in detail below with reference to diagrams and embodiments.

[0032] Figure 1 The flowchart of a data query method provided by an embodiment of the present invention is applicable to situations where the efficiency of SPARQL query needs to be improved. The method can be executed by a data query device, which can be implemented by software and / or hardware. Figure 1 Said method specifically comprises the following steps:

[0033] Step 110: Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern.

[0034] The query statement can be understood as a SPARQL query statement for querying RDF datasets. A triple is composed of a subject, a predicate, and an object. A triple pattern is similar to a triple, but allows the use of variables. Multiple sets of triple patterns can constitute a basic graph pattern, that is, a basic graph pattern can include multiple sets of triple patterns. The nodes of a completely directed graph represent each triple pattern.

[0035] In the prior art, after obtaining a SPARQL query statement, the query path corresponding to the query statement, i.e., the arrangement order of the triple pattern, can be determined, and then the RDF data set is queried based on the query path to determine the query result corresponding to the query statement on the RDF data set. When the Jena ARQ query engine executes a SPARQL query statement, the basic graph pattern can be converted into a completely directed graph to represent it, and the order of branches in the completely directed graph will affect the execution time of the SPARQL query statement. In order to improve query efficiency, the triple pattern needs to be reordered to determine the query path with the shortest query time.

[0036] Specifically, after obtaining the query statement, the triple pattern corresponding to the query statement can be determined, the set of triple modules corresponding to the query statement can be determined as the basic graph pattern, and each triple module contained in the basic graph pattern is used as a node to construct a complete directed graph corresponding to the basic graph pattern. In the complete directed graph, the nodes corresponding to each triple pattern are bilaterally connected.

[0037] In an embodiment of the present invention, after obtaining a query statement, the triple pattern corresponding to the query statement can be determined, and then the complete directed graph can be determined based on the basic graph pattern formed by the triple pattern corresponding to the query statement. Of course, the weight matrix corresponding to the complete directed graph can be used to reorder the triple pattern corresponding to the query statement. Therefore, the complete directed graph determined in this step provides a data basis for the reordering of the triple pattern.

[0038] Step 120: Convert the complete directed graph into a weight matrix according to the connection costs between the triple patterns.

[0039] The Jena ARQ query engine is internally a left-deep tree model, which is a query structure without a hash key. If a SPARQL query statement consists of four triple patterns, that is, TP1 is the first triple pattern in the SPARQL query, TP2 is the second triple pattern in the SPARQL query statement, and so on, the query path corresponding to the SPARQL query statement can be determined as TP1, TP2, TP3, and TP4. Each triple pattern is a query plan in the query path corresponding to the SPARQL query statement. The query path is represented in the form of a left-deep tree. From the properties of the left-deep tree, it can be seen that the cost of the left-deep tree depends on the selectivity (Join selectivity) and the cardinality estimate (Cardinality estimates).

[0040] The weights of the edges between nodes in the complete directed graph can be used to convert the complete directed graph into a weight matrix, and the nodes in the complete directed graph represent triple patterns. Therefore, the weights of the edges between nodes in the complete directed graph can be understood as the connection costs between the triple patterns corresponding to the nodes in the complete directed graph. From the above description, the connection costs between triple patterns can be determined by the selectivity (selectivity estimate) of the triple patterns and the cardinality estimate (estimated connection value) between the triple patterns.

[0041] Specifically, the selectivity estimation value of the triple pattern can be determined based on the internal startup mechanism of the Jena ARQ query engine, and the estimated connection value between the triple patterns can be determined based on the MVC method. Specifically, the selectivity estimation of the triple pattern can be performed based on the ARQ / GSH heuristic mechanism or the ARQ / PF heuristic mechanism in the Jena ARQ query engine to determine the selectivity estimation value of the triple pattern. When determining the estimated connection value between the triple patterns based on the MVC method, it is first necessary to define the constant value starting value of the rank, determine the connection influence factor between the triple patterns based on the constant value starting value of the rank and the connection mode between the triple patterns, and then, determine the estimated connection value between the triple patterns according to the arrangement order between the triple patterns in the query path corresponding to the query statement, the connection influence factor between the triple patterns and the selectivity estimation value of each triple pattern.

[0042] After determining the selectivity estimation value of each triple pattern and the estimated connection value between each triple pattern, the connection cost between each triple pattern can be further determined according to the selectivity estimation value of each triple pattern and the estimated connection value between each triple pattern. Then, the connection cost between each triple pattern is used as the weight of the edge between the nodes corresponding to each triple pattern in the complete directed graph, and the weight of each edge in the complete directed graph is used as a matrix element to construct a weight matrix.

[0043] Of course, for the diagonal elements of the weight matrix, they represent the cost of the triplet pattern, and the cost of each triplet pattern is 0.

[0044] In an embodiment of the present invention, after determining the connection cost between triple patterns, the connection cost between triple patterns can be used as the weight of the edge of the complete directed graph corresponding to the basic graph pattern composed of the triple patterns, and then the weight of each edge of the complete directed graph can be used as a matrix element to construct a weight matrix.

[0045] Step 130: reorder the triple patterns based on the weight matrix, determine a target query path according to the reordering result, and query a resource description framework (RDF) dataset based on the target query path to determine a query result.

[0046] Specifically, by reordering the triple patterns, a plurality of reordering results, i.e., a plurality of triple pattern arrangement orders, can be determined, and the matrix elements of the weight matrix represent the connection costs between the triple patterns. The connection costs between the triple patterns are related to the selectivity estimation values ​​of the triple patterns and the estimated connection values ​​between the triple patterns. Since the selectivity estimation values ​​of the triple patterns are determined, the connection costs between the triple patterns are only related to the estimated connection values ​​between the triple patterns. The higher the estimated connection values ​​between the triple patterns, the shorter the execution time of the query path corresponding to the triple patterns arranged in this order. Therefore, after the triple patterns are reordered to obtain a plurality of triple pattern arrangement orders, the connection costs of the various triple pattern arrangement orders can be determined according to the weight matrix, and the query path corresponding to the triple pattern arrangement order with the highest connection cost is determined as the target query path.

[0047] After determining the target query path, the RDF dataset is queried based on the target query path to determine the query result of the query statement on the RDF dataset, thereby reducing query time and improving query efficiency.

[0048] In an embodiment of the present invention, by reordering triple patterns, a plurality of triple pattern arrangement orders can be determined, and the connection costs of the plurality of triple pattern arrangement orders can be determined according to a weight matrix. The higher the connection cost of the triple pattern arrangement order, the shorter the execution time of the query path corresponding to the triple pattern arrangement order, and the higher the query efficiency. Therefore, the triple pattern arrangement order with the highest connection cost can be determined as the target query path, and the execution time of the target query path at this time is also the shortest. Furthermore, based on the target query path query data set, the query result corresponding to the query statement can be determined, which effectively improves the query efficiency.

[0049] The data query method provided by an embodiment of the present invention includes: determining a basic graph pattern according to a triple pattern corresponding to a query statement, determining a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns; converting the complete directed graph into a weight matrix according to the connection cost between each of the triple patterns; reordering the triple patterns, determining a target query path based on the weight matrix and the reordering results, and querying a resource description framework RDF data set based on the target query path to determine a query result. The above technical scheme, after obtaining the query statement, can determine the triple pattern corresponding to the query statement, and then determine the complete directed graph according to the basic graph pattern formed by the triple pattern corresponding to the query statement, and after determining the connection cost between the triple patterns, use the connection cost between the triple patterns as the weight of the edge of the complete directed graph corresponding to the basic graph pattern formed by the triple pattern, and then use the weight of each edge of the complete directed graph as a matrix element to construct a weight matrix, reorder the triple patterns to determine the arrangement order of multiple triple patterns, and determine the connection cost of multiple triple pattern arrangement orders according to the weight matrix, that is, the execution time of the query path corresponding to the multiple triple pattern arrangement orders. Therefore, the triple pattern arrangement order with the highest connection cost can be determined as the target query path, and the execution time of the target query path at this time is also the shortest. Then, based on the target query path, the query result corresponding to the query statement is determined by querying the data set, which effectively improves the query efficiency.

[0050] Figure 2 This is a flowchart of another data query method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to situations where the efficiency of SPARQL queries needs to be improved. The embodiment of the present invention is specific based on the above embodiment, and the explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 , the data query method provided by the embodiment of the present invention includes:

[0051] Step 210: Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern.

[0052] In one implementation, step 210 may specifically include:

[0053] Determine a basic graph pattern according to a triple pattern corresponding to a query statement; and convert the basic graph pattern into a complete directed graph corresponding to the basic graph pattern based on a Jena ARQ query engine.

[0054] The query statement is a basic SPARQL triple query statement with simple clauses, that is, the query statement may be a SPARQL query statement including a SELECT clause and a WHERE clause.

[0055] Specifically, after receiving the SPARQL query statement, the SPARQL query statement can be analyzed to determine the triple pattern corresponding to the SPARQL query statement, the triple pattern including primary variables or secondary variables, the primary variable is the subject, object or predicate of the triple pattern, the secondary variable is the subject and predicate, predicate and subject, subject and object, object and subject, object and predicate, or predicate and object of the triple pattern. In practical applications, while determining the triple pattern corresponding to the SPARQL query statement, the query path corresponding to the SPARQL query statement, i.e., the arrangement order of the triple pattern, can be determined. Furthermore, the triple pattern set consisting of at least one group of triple patterns corresponding to the SPARQL query statement can be determined as the basic graph pattern. For example, when the triple pattern corresponding to the SPARQL query statement is TP1, TP2, TP3, TP4, the basic graph pattern BGP={TP1, TP2, TP3, TP4} can be determined. Each triplet pattern in the basic graph pattern is used as a node to construct a complete directed graph corresponding to the basic graph pattern. In the complete directed graph, the nodes corresponding to each triplet pattern are bilaterally connected.

[0056] When the basic graph mode BGP = {TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9}, the following can be constructed: Figure 3 The complete directed graph shown.

[0057] In the embodiment of the present invention, after obtaining the query statement, the triple pattern corresponding to the query statement can be determined, and then a complete directed graph can be constructed according to the basic graph pattern formed by the triple pattern corresponding to the query statement.

[0058] Step 220: Determine the selectivity estimate of each of the triplet patterns.

[0059] In one implementation, step 220 may specifically include:

[0060] Selectivity estimation is performed on each of the triple patterns based on an ARQ / GSH heuristic mechanism or an ARQ / PF heuristic mechanism to determine a selectivity estimation value of each of the triple patterns.

[0061] Specifically, the selectivity estimate can be calculated by the internal heuristic mechanism of the Jena ARQ query engine. When JenaARQ performs selectivity estimation based on the ARQ / VC heuristic mechanism, the selectivity estimate of the triple pattern can be calculated based on the type and number of unbound components; the ARQ / VCP heuristic mechanism is a modified version of the ARQ / VC heuristic mechanism, and its structure is very similar to the ARQ / VC heuristic mechanism. When Jena ARQ performs selectivity estimation based on the ARQ / VCP heuristic mechanism, the selectivity estimate of the triple pattern connected by the predicate can be determined as 1.0. The ARQ / GSH heuristic mechanism is the heuristic mechanism that most accurately estimates the selectivity of the triple pattern. The ARQ / GSH heuristic mechanism is implemented by the underlying Jena memory graph and can find the exact size information of any triple pattern. However, the ARQ / GSH heuristic mechanism can only obtain the most accurate selectivity estimate in the case of a single triple pattern, and cannot obtain accurate selectivity estimates for multiple triple patterns. The ARQ / PF heuristic mechanism is a heuristic mechanism that requires pre-computed statistics and is able to make selectivity estimates for triple patterns and multiple triple patterns of connections. Although the ARQ / PF heuristic mechanism only supports non-inference graph models, the statistics required by the ARQ / PF heuristic mechanism can be constructed by calculating summary statistics of the inference model. Since the ARQ / PF heuristic mechanism creates customized statistics about multiple triple patterns of connections, the selectivity estimates for multiple connected triple patterns based on the ARQ / PF heuristic mechanism are the most accurate.

[0062] Therefore, when a SPARQL query statement corresponds to a set of triple patterns, the selectivity estimation of the triple patterns corresponding to the SPARQL query statement is performed based on the ARQ / GSH heuristic mechanism to determine the selectivity estimation value Card(TP i ); When the SPARQL query statement corresponds to multiple sets of triple patterns, the selectivity estimation of the triple patterns corresponding to the SPARQL query statement is obtained based on the ARQ / PF heuristic mechanism, and the selectivity estimation value Card(TP of each triple pattern corresponding to the SPARQL query statement is determined. i ).

[0063] In the embodiment of the present invention, the selectivity estimation value of the triple pattern corresponding to the query statement is determined based on the heuristic mechanism in the Jena ARQ query engine.

[0064] Step 230: Determine the estimated connection value between each of the triplet patterns.

[0065] In one implementation, step 230 may specifically include:

[0066] Determine the connection influence factors between the triple patterns according to the arrangement order of the triple patterns corresponding to the query statement; determine the estimated connection values between the triple patterns based on the arrangement order of the triple patterns corresponding to the query statement, the connection influence factors between the triple patterns, and the selectivity estimation values of the triple patterns.

[0067] Specifically, the estimated connection value between the triple patterns can be determined based on the MVC method, and the MVC method can determine the estimated connection value between the triple patterns based on Formula 1 and Formula 2.

[0068]

[0069]

[0070] Among them, Cp ij represents the edge between nodes TP i and node TP j , 0 ≤ i < N, 0 ≤ j < N, i ≠ j, i, j ∈ N. When the triple patterns corresponding to nodes TP i and node TP j in the SPARQL query statement are connected, it can be determined that When the triple patterns corresponding to nodes TP i and node TP j in the SPARQL query statement are not connected, it can be determined that Cp ij = TP i × TP j . Join(Cp ij ) represents the estimated connection value between triple pattern TP i and triple pattern TP j . When it is, the estimated connection value between triple pattern TP i and triple pattern TP j can be determined that Join(Cp ij ) = Join_Rate × Card(TP i ) × Card(TP i ). When Cp ij = TP i × TP j , it can be determined that Join(Cp ij ) = 1. It shows that when the triple patterns corresponding to the SPARQL query statement are connected, the estimated connection value between the triple patterns can be determined to be 1; when the triple patterns are not connected, it can be based on Join(Cp ij)=Join_Rate×Card(TP i )×Card(TP i ) determines the estimated connectivity values ​​between triplet patterns.

[0071] Join_Rate indicates triple pattern TP i and triplet pattern TP j The connection impact factor between Card(TP i ) represents the triple pattern TP i The selectivity estimate of Card(TP j ) represents the triple pattern TP j The selectivity estimate of .

[0072] The connection influence factor between triplet patterns can be determined based on Formula 3.

[0073]

[0074] Among them, s, p, and o represent the subject influence factor, predicate influence factor, and object influence factor respectively. The values ​​of s, p, and o are related to the connection method between triple patterns.

[0075] The values ​​of the subject influence factor, the predicate influence factor, and the object influence factor are all related to the connection mode between triple patterns. The connection mode between triple patterns is determined by the arrangement order of the triple patterns. Therefore, the arrangement order of the triple patterns corresponding to the SPARQL query statement can be determined. Based on the arrangement order of the triple patterns, the connection mode between the triple patterns can be determined as bounded connection or unbounded connection. The connection mode between the triple patterns can also be determined as ss, os, or so.

[0076] After determining that the connection mode between the triple patterns is bounded connection, the values ​​of the subject influence factor, the predicate influence factor, and the object influence factor can be further determined based on Table 1.

[0077] Table 1 Bounded connection impact factors

[0078] Bounded s p o s 4 6 2 p 6 0 6 o 4 6 2

[0079] After determining that the connection mode between each triple pattern is an unbounded connection, the values ​​of the subject influence factor, the predicate influence factor, and the object influence factor can be further determined based on Table 2.

[0080] Table 2 Impact factors of unbounded connections

[0081] Unbounded s p o s 2 3 1 p 3 3 3 o 2 3 1

[0082] After determining the connection influencing factor Join_Rate between triplet patterns, substituting it into Formula 2 can determine the estimated connection value between the triplet patterns.

[0083] In the embodiment of the present invention, it is achieved to determine the estimated connection values ​​between the triple patterns corresponding to the query statement.

[0084] Step 240: Determine the connection cost between each of the triple patterns according to the selectivity estimation value of each of the triple patterns and the estimated connection value between each of the triple patterns.

[0085] In one implementation, step 240 may specifically include:

[0086] The connection cost between the triple patterns is determined according to the selectivity estimation value of each triple pattern and the sum of the estimated connection values ​​between the triple patterns.

[0087] Specifically, the connection cost between triplet patterns may be determined based on Formula 4.

[0088] ω(i,j)=Card(TP i )+j(Cp ij )+Card(TP j ) Formula 4

[0089] In the embodiment of the present invention, the connection cost between the triple patterns corresponding to the query statement is determined.

[0090] Step 250: Convert the complete directed graph into a weight matrix according to the connection costs between the triple patterns.

[0091] In one implementation, step 250 may specifically include:

[0092] The weight of each node in the complete directed graph is determined according to the cost of each triple pattern, and the weight of the edge between each node in the complete directed graph is determined according to the connection cost between each triple pattern; the weight of each node in the complete directed graph and the weight of the edge between each node are used as matrix elements to construct the weight matrix to convert the complete directed graph into the weight matrix.

[0093] Specifically, since the cost of the triple pattern is 0, it can be determined that the weight of each node in the complete directed graph is 0, and the weight of the edge between the nodes corresponding to the triple pattern in the complete directed graph is determined according to the connection cost between the triple patterns. Then, the weights of the nodes in the complete directed graph and the weights of the edges between the nodes can be used as matrix elements to construct a weight matrix. Specifically, the weight matrix W shown in Formula 5 can be constructed.

[0094]

[0095] In the embodiment of the present invention, the conversion of a completely directed graph into a weight matrix is ​​achieved.

[0096] Step 260: reorder the triplet patterns, and determine a target query path based on the weight matrix and the reordering result.

[0097] In one implementation, step 260 may specifically include:

[0098] The triplet patterns are reordered to obtain a plurality of reordered results; the connection costs of the query paths corresponding to the various reordered results are determined based on the weight matrix, and the query path corresponding to the reordered result with the highest connection cost is determined as the target query path.

[0099] The SPARQL query statement is transformed into the following through the left-deep tree: Figure 3 The symmetric complete directed graph shown is Figure 3 As shown, the nodes of the complete directed graph represent triple patterns, and the edges of the complete directed graph represent bidirectional edge connections between triple patterns. It can be seen that the number of triple patterns in the SPARQL query statement is consistent with the number of nodes in the complete directed graph, and the number of connections between triple patterns in the SPARQL query statement is consistent with the number of edges in the complete directed graph. Both the nodes and edges in the complete directed graph are weighted. The weight of the node in the complete directed graph represents the cost of the triple pattern corresponding to the node, and the weight of the edge in the complete directed graph represents the connection cost between the triple patterns corresponding to the two nodes connected by the edge. When representing the complete directed graph based on the weight matrix, the diagonal matrix elements can be the weights of the nodes in the complete directed graph, that is, the costs of the triple patterns corresponding to the nodes, and the other matrix elements can be the weights of the edges in the complete directed graph, that is, the connection costs between the triple patterns corresponding to the two nodes connected by the edge.

[0100] The selectivity estimates of triple patterns are all fixed. It can be seen that the only factor that affects the difference in connection costs between triple patterns is the estimated connectivity between triple patterns. Connecting triple patterns with higher estimated connectivity makes the connection cost between triple patterns higher, which in turn makes the execution time of the query path shorter. Therefore, the query efficiency can be improved by reordering the triple patterns corresponding to the SPARQL query statement, changing the arrangement order of the triple patterns, and arranging the triple patterns with high estimated connectivity values ​​together.

[0101] Specifically, the triple patterns corresponding to the SPARQL query statements are reordered to obtain a variety of reordered results, and the reordered results are composed of triple patterns connected in sequence. The connection cost between the triple patterns connected in sequence can affect the execution time of the query path corresponding to the triple patterns connected in sequence, and the higher the connection cost between the triple patterns connected in sequence, the shorter the execution time of the query path corresponding to the triple patterns connected in sequence. The other matrix elements except the diagonal matrix elements in the weight matrix represent the connection cost between the triple patterns. After the triple patterns are reordered to obtain a variety of reordered results, the arrangement order of the triple patterns in various reordered results can be determined, and the connection cost between each triple pattern in the arrangement order of the triple patterns corresponding to the various reordered results is determined in the weight matrix, and then the connection cost of the various reordered results is determined. The connection cost of the reordered result is determined as the connection cost of the query path corresponding to the reordered result. The higher the connection cost of the query path, the shorter the execution time. Therefore, the query path with the highest connection cost can be determined as the target query path.

[0102] This application uses the Spark-MMAS-LKH algorithm, which combines the Min Max Ant System (MMAS) and an improved LK algorithm (Lin-Kernighan-Helsgaun, LKH) proposed by Helsgaun, to determine the arrangement order of triplet patterns with the highest connection cost.

[0103] Specifically, the weight matrix can be used as an input parameter to the Spark-MMAS-LKH algorithm. At the same time, multiple ants start from different triple patterns at the same time and find the optimal triple pattern arrangement order with the highest connection cost in the iteration. Insertion is performed through the relay mode. After each ant iteration finds a triple pattern arrangement order with the highest connection cost, the LKH algorithm is used to perform neighborhood permutation optimization to find a triple pattern arrangement order with a higher connection cost. The Spark-MMAS-LKH algorithm is executed based on the RDD operator in the distributed framework Spark, so that multiple ants can independently calculate the triple pattern arrangement order with the highest connection cost in multiple RDD partitions, and multiple ants operate in parallel. Therefore, MMAS can be regarded as a distributed operation process, which speeds up the iteration speed of the Spark-MMAS-LKH algorithm and greatly improves the efficiency of determining the triple pattern arrangement order with the highest connection cost. Finally, the triple pattern arrangement order with the highest connection cost can be obtained, and then the triple pattern arrangement order can be determined as the target query path.

[0104] In an embodiment of the present invention, by reordering triple patterns, multiple triple pattern arrangement orders can be determined, and the connection costs of the multiple triple pattern arrangement orders can be determined according to the weight matrix. The higher the connection cost of the triple pattern arrangement order, the shorter the execution time of the query path corresponding to the triple pattern arrangement order, and the higher the query efficiency. Therefore, the triple pattern arrangement order with the highest connection cost can be determined as the target query path, and the execution time of the target query path at this time is also the shortest.

[0105] Step 270: query the Resource Description Framework (RDF) dataset based on the target query statement to determine the query result.

[0106] Specifically, after determining the target query path, the RDF dataset is queried based on the target query path to obtain the query result of the SPARQL query statement on the RDF dataset.

[0107] In the embodiment of the present invention, the query result of the query statement on the RDF data set is determined, the query time is reduced, and the query efficiency is improved.

[0108] The data query method provided by the embodiment of the present invention includes: determining the basic graph pattern according to the triple pattern corresponding to the query statement, determining the complete directed graph corresponding to the basic graph pattern; determining the selectivity estimation value of each of the triple patterns; determining the estimated connection value between each of the triple patterns; determining the connection cost between each of the triple patterns according to the selectivity estimation value of each of the triple patterns and the estimated connection value between each of the triple patterns; converting the complete directed graph into a weight matrix according to the connection cost between each of the triple patterns; reordering the triple patterns, and determining the target query path based on the weight matrix and the reordering result; querying the resource description framework RDF data set based on the target query statement to determine the query result. The above technical solution, after obtaining the query statement, can determine the triple pattern corresponding to the query statement, determine the triple pattern set consisting of the triple pattern corresponding to the query statement as the basic graph pattern, use each triple pattern corresponding to the basic graph pattern as a node to construct a complete directed graph corresponding to the basic graph pattern, and construct a complete directed graph corresponding to the basic graph pattern based on Jena The heuristic mechanism in the ARQ query engine can determine the selectivity estimation value of the triple pattern corresponding to the query statement. Based on the arrangement order of the triple pattern corresponding to the query statement, the estimated connection value between the triple patterns corresponding to the query statement can be further determined. Then, the connection cost between the triple patterns corresponding to the query statement can be determined according to the selectivity estimation value of the triple pattern corresponding to the query statement and the estimated connection value between the triple patterns corresponding to the query statement. The connection cost between the triple patterns is used as the weight of the edge between the nodes corresponding to the triple pattern in the complete directed graph. The weight of the edge in the complete directed graph is used as a matrix element to construct a weight matrix. After the triple patterns corresponding to the query statement are reordered to obtain multiple triple pattern arrangement orders, the connection costs of the multiple triple pattern arrangement orders are determined according to the weight matrix. The higher the connection cost of the triple pattern arrangement order, the shorter the execution time of the query path corresponding to the triple pattern arrangement order, and the higher the query efficiency. Therefore, the triple pattern arrangement order with the highest connection cost can be determined as the target query path, and the execution time of the target query path at this time is also the shortest.

[0109] Figure 4 The flowchart of another data query method provided in the embodiment of the present invention exemplifies one of the implementation methods, which implements data query based on the SPARQL query engine, wherein the SPARQL query engine includes a query transformation layer (Query Transformation), a SPARQL algebra tree (SPARQL Algebra), a query optimization layer (Query Optimization), a query planning layer (Query Planning) and a query execution layer (Query Execution). Figure 4As shown, the implementation of the data query method may specifically include:

[0110] Step 410: The query conversion layer obtains the SPARQL query statement input by the user, determines the triple pattern corresponding to the SPARQL query statement and the arrangement order of the triple pattern, and determines the basic graph pattern according to the triple pattern corresponding to the SPARQL query statement.

[0111] Specifically, when determining the arrangement order of triple patterns corresponding to the SPARQL query statement, the triple patterns may be determined as query variables, and then a query variable list may be constructed.

[0112] Step 420: The SPARQL algebraic tree determines the complete directed graph corresponding to the basic graph pattern.

[0113] Specifically, the order of branches in a completely directed graph affects the execution time of SPARQL query statements.

[0114] Step 430: The query optimization layer constructs a weight matrix based on the completely directed graph, and inputs the weight matrix as an input parameter to the Spark-MMAS-LKH algorithm, so that the Spark-MMAS-LKH algorithm reorders the triple patterns corresponding to the SPARQL query statement, and then determines the reordering result with the highest connection cost based on the weight matrix.

[0115] Specifically, the diagonal matrix elements of the weight matrix constructed based on the complete directed graph are the costs of the triple patterns corresponding to the nodes in the complete directed graph, and the other matrix elements are the connection costs between the triple patterns corresponding to the two nodes connected by the edges in the complete directed graph. After the weight matrix is ​​input as an input parameter into the Spark-MMAS-LKH algorithm, the Spark-MMAS-LKH algorithm is executed based on the RDD operator in the distributed framework Spark. The MMAS algorithm enables multiple ants to start from different triple patterns at the same time and find the arrangement order of triple patterns with the highest connection cost in iteration. After each ant iteration finds a triple pattern arrangement order with the highest connection cost, the LKH algorithm can perform neighborhood permutation optimization on the triple pattern arrangement order with the highest connection cost, thereby finding a triple pattern arrangement order with a higher connection cost. The Spark-MMAS-LKH algorithm is executed based on the RDD operator in the distributed framework Spark, which speeds up the iteration speed of the Spark-MMAS-LKH algorithm and makes it more efficient to determine the arrangement order of triple patterns with higher connection costs.

[0116] Step 440: The query plan layer determines the target query path according to the reordering result with the highest connection cost.

[0117] Step 450: The query execution layer queries the triple patterns on the RDF dataset in sequence based on the target query path, finds triples matching each triple pattern in the RDF dataset, and determines the triples matching each triple pattern in the RDF dataset as the query results of the SPARQL query statement on the RDF dataset.

[0118] Specifically, matching points of each query variable in the query variable list are found in the RDF dataset. The matching points are triples in the RDF dataset that match each triple pattern. After verifying the triples, the triples that match each triple pattern are determined as the query results of the SPARQL query statement on the RDF dataset.

[0119] The implementation method of the data query method provided by the embodiment of the present invention has the corresponding beneficial effects of executing the data query method.

[0120] Figure 5 This is a schematic diagram of the structure of a data query device provided by an embodiment of the present invention. The device and the data query methods of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the data query device can refer to the embodiment of the above data query method.

[0121] The specific structure of the data query device is as follows: Figure 5 As shown, including:

[0122] A determination module 510 is used to determine a basic graph pattern according to a triple pattern corresponding to a query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein nodes of the complete directed graph represent each of the triple patterns;

[0123] A conversion module 520, configured to convert the complete directed graph into a weight matrix according to the connection costs between the triple patterns;

[0124] The query module 530 is used to reorder the triple patterns based on the weight matrix, determine a target query path according to the reordering result, and query a resource description framework RDF dataset based on the target query path to determine a query result.

[0125] Based on the above embodiment, the determination module 510 is specifically used for:

[0126] Determine a basic graph pattern according to a triple pattern corresponding to a query statement; and convert the basic graph pattern into a complete directed graph corresponding to the basic graph pattern based on a Jena ARQ query engine.

[0127] Based on the above embodiment, the device further includes:

[0128] The cost determination module is used to determine the connection cost between each of the triplet patterns.

[0129] Based on the above embodiment, the cost determination module is specifically used for:

[0130] Determine the selectivity estimation value of each triple pattern and the estimated connection value between each triple pattern; determine the connection cost between each triple pattern according to the selectivity estimation value of each triple pattern and the estimated connection value between each triple pattern.

[0131] In one implementation, determining the selectivity estimate of each triple pattern includes:

[0132] Selectivity estimation is performed on each of the triple patterns based on an ARQ / GSH heuristic mechanism or an ARQ / PF heuristic mechanism to determine a selectivity estimation value of each of the triple patterns.

[0133] In one implementation, determining the estimated connection value between each of the triple patterns includes:

[0134] According to the arrangement order of each triple pattern corresponding to the query statement, the connection influence factor between each triple pattern is determined; based on the arrangement order of each triple pattern corresponding to the query statement, the connection influence factor between each triple pattern and the selectivity estimation value of each triple pattern, the estimated connection value between each triple pattern is determined.

[0135] In one implementation, determining the connection cost between each triple pattern according to the selectivity estimation value of each triple pattern and the estimated connection value between each triple pattern includes:

[0136] The connection cost between the triple patterns is determined according to the selectivity estimation value of each triple pattern and the sum of the estimated connection values ​​between the triple patterns.

[0137] Based on the above embodiment, the conversion module 520 is specifically used for:

[0138] The weight of each node in the complete directed graph is determined according to the cost of each triple pattern, and the weight of the edge between each node in the complete directed graph is determined according to the connection cost between each triple pattern; the weight of each node in the complete directed graph and the weight of the edge between each node are used as matrix elements to construct the weight matrix to convert the complete directed graph into the weight matrix.

[0139] Based on the above embodiment, the query module 530 is specifically used for:

[0140] The triple pattern is reordered to obtain a plurality of reordered results; the connection costs of query paths corresponding to various reordered results are determined based on the weight matrix, and the query path corresponding to the reordered result with the highest connection cost is determined as the target query path; and a resource description framework RDF data set is queried based on the target query path to determine the query result.

[0141] The data query device provided in the embodiment of the present invention can execute the data query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the data query method.

[0142] It is worth noting that in the embodiment of the above-mentioned data query device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0143] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 A block diagram of an exemplary computer device 6 suitable for use in implementing embodiments of the present invention is shown. Figure 6 The computer device 6 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0144] like Figure 6 As shown, the computer device 6 is in the form of a general purpose computing electronic device. The components of the computer device 6 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting various system components (including the system memory 28 and the processing unit 16).

[0145] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0146] The computer device 6 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 6, including volatile and non-volatile media, removable and non-removable media.

[0147] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 6 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0148] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0149] The computer device 6 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 6, and / or any device that enables the computer device 6 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the computer device 6 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20. Figure 6 As shown, the network adapter 20 communicates with other modules of the computer device 6 via the bus 18. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with computer device 6, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0150] The processing unit 16 executes various functional applications and page displays by running the programs stored in the system memory 28, for example, implementing the data query method provided by the embodiment of the present invention, which includes:

[0151] Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns;

[0152] Converting the complete directed graph into a weight matrix according to the connection costs between the triplet patterns;

[0153] The triple patterns are reordered, a target query path is determined based on the weight matrix and the reordering result, and a resource description framework (RDF) data set is queried based on the target query path to determine a query result.

[0154] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the data query method provided by any embodiment of the present invention.

[0155] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, a data query method provided by an embodiment of the present invention is implemented, for example, and the method includes:

[0156] Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns;

[0157] Converting the complete directed graph into a weight matrix according to the connection costs between the triplet patterns;

[0158] The triple patterns are reordered, a target query path is determined based on the weight matrix and the reordering result, and a resource description framework (RDF) data set is queried based on the target query path to determine a query result.

[0159] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0160] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0161] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0162] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0163] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0164] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A data query method, It is characterized in that include: Determine a basic graph pattern according to the triple pattern corresponding to the query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein the nodes of the complete directed graph represent each of the triple patterns; Converting the complete directed graph into a weight matrix according to the connection costs between the triplet patterns; The triple patterns are reordered, a target query path is determined based on the weight matrix and the reordering result, and a resource description framework (RDF) data set is queried based on the target query path to determine a query result.

2. The data query method according to claim 1, It is characterized in that Determining a complete directed graph corresponding to the basic graph pattern includes: The basic graph pattern is converted into a complete directed graph corresponding to the basic graph pattern based on the Jena ARQ query engine.

3. The data query method according to claim 1, It is characterized in that Before converting the complete directed graph into a weight matrix according to the connection costs between the triple patterns, the method further comprises: Determining a selectivity estimate value for each of the triple patterns and an estimated connectivity value between each of the triple patterns; The connection cost between the triple patterns is determined according to the selectivity estimation value of each triple pattern and the estimated connection value between the triple patterns.

4. The data query method according to claim 3, It is characterized in that Determining a selectivity estimate for each of the triplet patterns includes: Selectivity estimation is performed on each of the triple patterns based on an ARQ / GSH heuristic mechanism or an ARQ / PF heuristic mechanism to determine a selectivity estimation value of each of the triple patterns.

5. The data query method according to claim 3, It is characterized in that Determining an estimated connection value between each of the triplet patterns comprises: Determining a connection influence factor between the triple patterns according to an arrangement order of the triple patterns corresponding to the query statement; Based on the arrangement order of each of the triple patterns corresponding to the query statement, the connection influence factor between each of the triple patterns and the selectivity estimation value of each of the triple patterns, the estimated connection value between each of the triple patterns is determined.

6. The data query method according to claim 3, It is characterized in that Determining the connection cost between the triple patterns according to the selectivity estimation value of each triple pattern and the estimated connection value between the triple patterns includes: The connection cost between the triple patterns is determined according to the selectivity estimation value of each triple pattern and the sum of the estimated connection values ​​between the triple patterns.

7. The data query method according to claim 1, It is characterized in that According to the connection costs between the triplet patterns, the complete directed graph is converted into a weight matrix, comprising: Determine the weight of each node in the complete directed graph according to the cost of each triple pattern, and determine the weight of the edge between each node in the complete directed graph according to the connection cost between each triple pattern; The weight matrix is ​​constructed by using the weights of the nodes in the complete directed graph and the weights of the edges between the nodes as matrix elements, so as to convert the complete directed graph into the weight matrix.

8. The data query method according to claim 1, It is characterized in that Reordering the triplet patterns and determining a target query path based on the weight matrix and the reordering result, including: Reordering the triplet patterns to obtain multiple reordering results; The connection costs of the query paths corresponding to the various reordering results are determined based on the weight matrix, and the query path corresponding to the reordering result with the highest connection cost is determined as the target query path.

9. A data query device, It is characterized in that include: A determination module, configured to determine a basic graph pattern according to a triple pattern corresponding to a query statement, and determine a complete directed graph corresponding to the basic graph pattern, wherein nodes of the complete directed graph represent each of the triple patterns; A conversion module, used for converting the complete directed graph into a weight matrix according to the connection costs between the triple patterns; The query module is used to reorder the triple patterns based on the weight matrix, determine a target query path according to the reordering result, and query a resource description framework RDF data set based on the target query path to determine a query result.

10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the data query method as described in any one of claims 1-8 is implemented.

11. A storage medium containing computer executable instructions, It is characterized in that The computer executable instructions are used to execute the data query method as described in any one of claims 1 to 8 when executed by a computer processor.