SPARQL query sub-graph pattern matching method based on VF2 algorithm
By transforming SPARQL queries into query graphs and combining them with the filtering and validation steps of the VF2 algorithm, the problem of low efficiency of SPARQL queries in large-scale RDF data is solved, achieving more efficient information retrieval and matching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG LAB
- Filing Date
- 2022-12-29
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies struggle to efficiently handle information retrieval and matching of large-scale RDF data, especially when performing SPARQL queries on massive amounts of RDF data, resulting in a large search space and low query efficiency.
A SPARQL query subgraph pattern matching method based on the VF2 algorithm is adopted. By transforming the SPARQL query statement into a query graph, the filtering and verification steps of the VF2 algorithm are used, combined with the subgraph pattern characteristics of chain, star, snowflake and complex types, to reduce the search space and reduce intermediate process data, thereby improving query efficiency.
It improves the efficiency of SPARQL queries, reduces the search space and intermediate process data, and enhances query speed and accuracy.
Smart Images

Figure CN115905295B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of RDF data query technology, specifically to a SPARQL query subgraph pattern matching method based on the VF2 algorithm. Background Technology
[0002] With the rapid development and application of the Semantic Web, an increasing number of application areas are utilizing the RDF (Resource Description Framework) model to describe large-scale domain data, such as search engines, road traffic, social networks, and bioinformatics. The RDF model primarily employs...<s,p,o> The triple form describes the metadata of a piece of data, where s represents the subject, p represents the predicate, and o represents the object. For example:<John,interest,UIDesign> This indicates that John likes the UI Design course. In a triple, the predicate p can also be considered a directed edge, and the subject s and object o can be considered nodes; therefore, a triple can also be represented as... Therefore, triples form a directed graph through shared subject and object terms, and massive amounts of RDF data can form a large-scale directed graph. Currently, RDF datasets in these application areas have reached the scale of billions of data points. Therefore, information retrieval and matching for large-scale RDF data is one of the key problems that urgently need to be solved.
[0003] There is an urgent need for a SPARQL query subgraph pattern matching method based on the VF2 algorithm that can perform information retrieval and matching for large-scale RDF domain data, in order to solve the problems existing in the current technology. Summary of the Invention
[0004] The purpose of this invention is to provide a SPARQL query subgraph pattern matching method based on the VF2 algorithm. The specific technical solution is as follows:
[0005] The SPARQL query subgraph pattern matching method based on the VF2 algorithm includes the following steps:
[0006] S1: Present the SPARQL query statement in the form of a SPARQL query graph. Based on the chain recognition rule and the star recognition rule, the SPARQL query graph is divided into a chain query graph and a star query graph.
[0007] S2: Establish the basic matching rules of the VF2 algorithm, and establish chain matching rules based on the structural and semantic information of the chain query graph, and establish star matching rules based on the structural and semantic information of the star query graph;
[0008] S3: Based on the chain recognition rules and star recognition rules, the RDF data graphs in the RDF database are divided into chain data graphs and star data graphs; using the VF2 algorithm, the chain query graph is matched with the chain data graph and the star query graph is matched with the star data graph according to the basic matching rules, chain matching rules and star matching rules in step S2, and the matching set is filtered and the result is output.
[0009] Preferably, the chain identification rule is: when the SPARQL query graph only has the node at the start of the link, the node at the end of the link, and the nodes in the link, it belongs to the chain query graph;
[0010] The star schema identification rule is: when a SPARQL query graph has a core point and branch nodes, it belongs to a star schema query graph.
[0011] Preferably, the basic matching rules in step S2 include predecessor rules, successor rules, predecessor 1-hop rules, successor 1-hop rules, and 2-hop rules.
[0012] Preferably, the expression for the chain-like matching rule is as follows:
[0013]
[0014]
[0015] The expression for the star-pattern matching rule is:
[0016]
[0017] Where REdge-attr represents the predicate attribute consistency verification rule in the chained query graph, RLinear-s represents the semantic consistency verification rule for nodes and edges in the chained query graph, Rstar represents the structural relationship verification rule for special nodes in the star-shaped query graph, Rstar-s represents the semantic consistency verification rule for the star-shaped query graph, s represents the current matching state, qtp represents the matched objects in the current SPARQL query graph, gtp represents the matched objects in the current RDF data graph, edg1 represents the edge with relation type or attribute type in the SPARQL query graph, and edg1′ represents the edge with relation type or attribute type in the RDF data graph. Edges of relation type or attribute type: Q1 indicates that there is a sibling topology relationship between matched objects in the SPARQL query graph; Q1′ indicates that there is a sibling topology relationship between unmatched objects in the SPARQL query graph; Q2 indicates that there is a sibling topology relationship between matched objects in the RDF data graph; Q2′ indicates that there is a sibling topology relationship between unmatched objects in the RDF data graph; Q3 indicates that there is some semantic information in the SPARQL star query graph; Q3′ indicates that there is semantic information corresponding to Q3 in the RDF data graph; RO1 indicates semantic information in the RDF data graph; RG1 indicates semantic information in the SPARQL query graph.
[0018] Preferably, step S3 specifically includes:
[0019] S3-1: Based on the chain-based identification rules and the star-based identification rules, the RDF data graphs in the RDF database are divided into chain-based data graphs and star-based data graphs;
[0020] S3-2: Based on the chain matching algorithm R-VF-Linear in the VF2 algorithm, the chain query graph and the chain data graph are matched according to the basic matching rules and chain matching rules, and the chain data graph matching set is filtered and the result is output.
[0021] S3-3: Based on the star-shaped matching algorithm R-VF-Star in the VF2 algorithm, the star-shaped query graph and star-shaped data graph are matched according to the basic matching rules and star-shaped matching rules, and the star-shaped data graph matching set is filtered and the result is output.
[0022] Preferably, the expression for the node at the starting point of the link is: in-degree = 0, out-degree = 1; the expression for the node at the ending point of the link is: in-degree = 1, out-degree = 0; and the expression for the nodes in the link is: out-degree = in-degree = 1.
[0023] The expression for the core point is: in-degree = 0, out-degree = Count(D.out-degree); the expression for the branch node is: in-degree = 1, out-degree = 0.
[0024] Where in-degree represents out-degree, out-degree represents in-degree, and Count(D.out-degree) represents the total out-degree of all nodes in the star query graph.
[0025] Preferably, the predecessor rule expression is:
[0026] The successor rule expression is:
[0027] The front-end 1-hop rule expression is:
[0028] The subsequent 1-hop rule expression is:
[0029] The 2-hop rule expression is:
[0030] Where s represents the current matching state, qtp represents the matched object in the current SPARQL query graph, gtp represents the matched object in the current RDF data graph, RHead represents the predecessor rule, HQ indicates that the matched object qtp in the SPARQL query graph has a predecessor relationship with the object qtp′ to be matched, HG indicates that the matched object gtp in the RDF data graph has a predecessor relationship with the object gtp′ to be matched, HQ′ indicates that the object qtp′ to be matched in the SPARQL query graph has a predecessor relationship with the matched object qtp, and HG′ indicates that the object gtp to be matched in the RDF data graph has a predecessor relationship with the matched object qtp. p′ has a predecessor relationship with the matched object gtp. RTail indicates a successor rule. TQ indicates that the matched object qtp in the SPARQL query graph has a successor relationship with the object qtp′ to be matched. TQ′ indicates that the object qtp′ to be matched in the SPARQL query graph has a successor relationship with the matched object qtp. TG indicates that the matched object gtp in the RDF data graph has a successor relationship with the object gtp′ to be matched. TG′ indicates that the object gtp′ to be matched in the RDF data graph G has a successor relationship with the matched object gtp. Rv-in indicates a predecessor 1-hop rule. CTQ in This represents the number of 1-hop successor relations for the object qtp′ to be matched in the SPARQL query graph, CTG. in CHQ represents the number of 1-hop successor relations for the object gtp′ to be matched in the RDF data graph. inCHG represents the number of 1-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. in This indicates the number of 1-hop predecessor relationships for the object gtp' to be matched in the RDF data graph, Rv-out indicates the successor 1-hop rule, and CTQ. out This represents the number of 1-hop successor relationships that exist for the object qtp′ to be matched in the SPARQL query graph, CTG. out CHQ represents the number of 1-hop successor relationships that exist for the object gtp′ to be matched in the RDF data graph. out CHG represents the number of 1-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. out CTQ represents the number of 1-hop predecessor relationships that exist for the object gtp′ to be matched in the RDF data graph. new This represents the number of 2-hop successor relations for the object qtp′ to be matched in the SPARQL query graph, CTG. new CHQ represents the number of 2-hop successor relations for the object gtp′ to be matched in the RDF data graph. new CHG represents the number of 2-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. new This indicates the number of 2-hop predecessor relationships that exist for the objects to be matched in the RDF data graph.
[0031] Preferably, the application of the basic rules includes:
[0032] Step 1: Verify the predecessor relationships in the SPARQL query graph using predecessor rules and verify the successor relationships in the SPARQL query graph using successor rules;
[0033] Step 2: Use the predecessor 1-hop rule to determine the future matching trend of the next match and use the successor 1-hop rule to determine the future matching trend of the next match;
[0034] Step 3: Use the 2-hop rule to determine the number of neighbors in predecessor and successor relationships again.
[0035] Preferably, the SPARQL query statement in step S1 is stored in an adjacency list format and then converted into a SPARQL query graph.
[0036] The application of the technical solution of the present invention has the following beneficial effects:
[0037] (1) This invention utilizes the inherent graph structure of RDF data. By transforming SPARQL queries for RDF data into query graphs, each variable or constant in the SPARQL query statement corresponds to a node in the query graph, and each triple pattern in the WHERE clause corresponds to an edge in the query graph. This transforms the SPARQL (SimpleProtology and RDF Query Language) query problem for RDF data into a subgraph matching problem. A SPARQL query is essentially a subgraph matching process of its corresponding query graph on the RDF data graph. Subgraph matching can fully utilize the structural and semantic information of the RDF data graph and the SPARQL query graph, thereby improving query efficiency.
[0038] (2) This invention also adds the VF2 algorithm to the SPARQL query subgraph pattern matching method. The subgraph isomorphism of the VF2 algorithm is actually a subgraph matching process. It mainly uses two steps, filtering and verification, to reduce the space overhead during search matching, thereby improving the efficiency of subgraph matching. Existing research shows that there are two main factors affecting the efficiency of SPARQL queries: a large search space and the generation of a large amount of intermediate process data when the query contains the same variables for connection. Therefore, the main strategies to improve the speed of SPARQL queries are also divided into two categories: reducing the search space and reducing the intermediate process data generated by the join operation. This invention combines the advantage of the VF2 algorithm's filtering and verification steps, which can prune through pattern matching, and utilizes the chain, star, snowflake, and complex subgraph pattern features of the SPARQL query graph. It proposes a VF2-based SPARQL query subgraph pattern matching rule and subgraph matching method, which uses the structural features of the SPARQL query itself to perform subgraph matching to reduce the search space range in the RDF data graph and reduce intermediate process data, thereby improving the efficiency of SPARQL queries.
[0039] In addition to the objectives, features, and advantages described above, the present invention has other objectives, features, and advantages. The invention will now be described in further detail with reference to the figures. Attached Figure Description
[0040] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0041] Figure 1 This is a schematic diagram of the chain query graph in the preferred embodiment 1 of the present invention;
[0042] Figure 2 This is a schematic diagram of the star-shaped query graph in the preferred embodiment 1 of the present invention;
[0043] Figure 3 This is a schematic diagram of the snowflake-shaped query graph;
[0044] Figure 4 This is a structural diagram of a complex query graph;
[0045] Figure 5 This is a flowchart illustrating the SPARQL query subgraph pattern matching method based on the VF2 algorithm in the preferred embodiment of the present invention.
[0046] Figure 6 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for chain-type data graphs in RDF data graphs when the scaling factor SF = 1000;
[0047] Figure 7 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for chain-type data graphs in RDF data graphs when the scaling factor SF = 10000;
[0048] Figure 8 This is a comparison chart of the average query time of three existing query methods and the present invention for chain-type data graphs in RDF data graphs under different data scales (some data points are not shown);
[0049] Figure 9 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for star-shaped data plots in RDF data plots when the scaling factor SF=10;
[0050] Figure 10 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for star-shaped data plots in RDF data plots when the scaling factor SF=100;
[0051] Figure 11 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for star-shaped data plots in RDF data plots when the scaling factor SF = 1000;
[0052] Figure 12 This is a comparison chart of the query time of three existing query methods and the query time of the present invention for star-shaped data plots in RDF data plots when the scaling factor SF = 10000;
[0053] Figure 13 This is a comparison chart of the average query time of three existing query methods and the present invention for star-shaped data plots in RDF data graphs under different data scales (some data points are not shown);
[0054] Figure 14 This is a comparison chart of the query time of the R-VF-Linear and R-VF-Star algorithms in this invention for star-shaped data plots in RDF data plots with a scaling factor SF=10;
[0055] Figure 15 This is a comparison chart of the query time of the R-VF-Linear and R-VF-Star algorithms in this invention for star-shaped data plots in RDF data plots with a scaling factor SF=100;
[0056] Figure 16 This is a comparison chart of the query time of the R-VF-Linear and R-VF-Star algorithms in this invention for star-shaped data plots in RDF data plots with a scaling factor SF=1000;
[0057] Figure 17 This is a comparison chart of the query time of the R-VF-Linear and R-VF-Star algorithms in this invention for star-shaped data plots in RDF data plots with a scaling factor SF=10000;
[0058] Figure 18 This is a comparison chart of the query times for snowflake-shaped and complex data graphs in RDF data graphs when the scaling factor SF=10, using three existing query methods.
[0059] Figure 19 This is a comparison chart of the query times of three existing query methods and the present invention for snowflake-shaped and complex data graphs in RDF data graphs when the scaling factor SF=100;
[0060] Figure 20 This is a comparison chart of the query times of three existing query methods and the present invention for snowflake-shaped and complex data graphs in RDF data graphs when the scaling factor SF = 1000;
[0061] Figure 21 This is a comparison chart showing the query time of three existing query methods with that of the present invention for snowflake-shaped and complex data graphs in RDF data graphs when the scaling factor SF = 10000. Detailed Implementation
[0062] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, the present invention can be implemented in many different ways as defined and covered by the claims.
[0063] Example 1:
[0064] See Figure 5 The SPARQL query subgraph pattern matching method based on the VF2 algorithm includes the following steps:
[0065] S1: Present the SPARQL query statement as a SPARQL query graph, and classify the SPARQL query graph into a chain query graph and a star query graph according to the chain recognition rule and the star recognition rule; see [link / reference] Figure 1 , Figure 2 , Figure 3 as well as Figure 4 SPARQL query graphs mainly have four subgraph patterns: chain, star, snowflake, and complex. It can be seen that snowflake and complex SPARQL queries can be transformed into chain and star graphs according to the chain and star recognition rules. Therefore, the subgraph patterns of chain and star SPARQL queries can be used as the basic subgraph pattern structure of SPARQL queries. That is, SPARQL query graphs can be divided into chain query graphs and star query graphs according to the chain and star recognition rules.
[0066] SPARQL query subgraph pattern type identification involves storing the triplet patterns in the SPARQL query using an adjacency list format and converting them into query graph patterns. Based on this, subgraph patterns are identified according to chain and star schema rules. The algorithm pseudocode is shown in Table 1.
[0067] Table 1. SPARQL Query Subgraph Pattern Type Recognition Algorithm S-Judge
[0068]
[0069]
[0070] Lines 5-20 describe the SPARQL chain query graph identification function. This function categorizes nodes in a chain structure into three types: in-degree = 0, out-degree = 1; out-degree = in-degree = 1; and in-degree = 1, out-degree = 0. Based on this structural characteristic, nodes containing only these three types can be identified as chain-like. Different conditions determine the node's location within the chain structure. Specifically, when in-degree = 0 and out-degree = 1, the node is at the start of the chain; in-degree = 1 and out-degree = 0, the node is at the end of the chain; and out-degree = in-degree = 1, the node is at the midpoint of the chain. In other words, the chain identification rule is: a SPARQL query graph containing only nodes at the start, end, and middle of a chain is considered a chain query graph.
[0071] Lines 21-34 represent the identification function for SPARQL star query graphs. A SPARQL star query graph is radially shaped, radiating outwards with multiple branch links. Each branch can represent the attribute relationship between the subject and object terms. Nodes in the star graph can be divided into two categories: in-degree = 0, out-degree = Count(D.out-degree); and in-degree = 1, out-degree = 0. When in-degree = 0 and out-degree = Count(D.out-degree), meaning the out-degree equals the total out-degree of all nodes in the star query graph, the node is considered a core node, the common starting point of all branch nodes. When in-degree = 1 and out-degree = 0, the node is considered a branch node. Therefore, the star graph identification rule is: a SPARQL query graph with both a core node and branch nodes is considered a star query graph.
[0072] Where in-degree represents out-degree, out-degree represents in-degree, Count(D.out-degree) represents the total out-degree of all nodes in the star query graph, Q represents the SPARQL query graph, QTP represents the set of all triples in the SPARQL query graph, QB represents the set of semantic relations between triples in the SPARQL query graph, QS represents the set of subjects, QO represents the set of objects, qs, qo.
[0073] S2: Establish the basic matching rules of the VF2 algorithm, and establish chain matching rules based on the structural and semantic information of the chain query graph, and establish star matching rules based on the structural and semantic information of the star query graph.
[0074] The basic matching rules include:
[0075] Rule 1 (Predecessor Rule). The predecessor rule is also known as rule RHead. Its expression is as follows:
[0076]
[0077] The RHead rule indicates that any object qtp′ to be matched in the SPARQL query graph has a predecessor relationship with qtp, i.e. gtp′ also exists in RDF data graphs, and it also has a predecessor relationship, the expression of which is: Similarly, the rule requires that any matching object gtp′ in the RDF data graph has a predecessor relationship with gtp, i.e. In the SPARQL query graph, there exists a predecessor relationship between qtp′ and qtp, and its expression is: Both gtp and qtp belong to sets MG(s) and MQ(s) within the matching set M(s). The rule should also satisfy count(Head(Q,qtp)) ≤ count(Head(G,gtp)), where Head is a function to retrieve the set of predecessor relations, s represents the subject, qtp represents the matched object in the current SPARQL query graph, qtp′ represents the object to be matched in the current SPARQL query graph, HQ indicates that the matched object qtp and the object to be matched qtp′ in the SPARQL query graph have a predecessor relation, MQ(s) represents the set of elements in the matching set M(s) that belong to the SPARQL query graph, and Q represents the SPARQL... In the query graph, gtp represents the matched object in the current RDF data graph, qtp′ represents the object to be matched in the current RDF data graph, HG indicates that there is a predecessor relationship between the matched object gtp and the object to be matched gtp′ in the RDF data graph, G represents the RDF data graph, HQ′ indicates that there is a predecessor relationship between the object to be matched qtp′ and the matched object qtp in the SPARQL query graph, HG′ indicates that there is a predecessor relationship between the object to be matched gtp′ and the matched object gtp in the RDF data graph, and MG(s) represents the set of the matching set M(s) that belongs to the RDF data graph.
[0078] Rule 2 (Successor Rule). The successor rule is the RTail rule. Its expression is as follows:
[0079]
[0080] The RTail rule indicates that any object qtp′ to be matched in the SPARQL query graph has a successor relationship with qtp, expressed as: gtp′ also exists in RDF data graphs, and similarly, there is a successor relationship, expressed as follows: Similarly, the rule requires that any matching object gtp′ in the RDF data graph has a successor relationship with gtp, and its expression is: In the SPARQL query graph, there exists a successor relationship between qtp' and qtp, meaning that... The rule also requires that count(Tail(Q,qtp)) ≤ count(Tail(G,gtp)), where Tail is a function to obtain the set of successor relationships, TQ indicates that there is a successor relationship between the matched object qtp and the object to be matched qtp′ in the SPARQL query graph, TQ′ indicates that there is a successor relationship between the object to be matched qtp′ and the matched object qtp in the SPARQL query graph, TG indicates that there is a successor relationship between the matched object gtp and the object to be matched gtp′ in the RDF data graph, and TG′ indicates that there is a successor relationship between the object to be matched gtp′ and the matched object gtp in the RDF data graph G.
[0081] Rule 3 (Precursor 1-hop Rule). The precursor 1-hop rule, also known as Rv-in, is expressed as follows:
[0082]
[0083] This rule is a further judgment following the first two rules, used to determine the future matching trend for the next match. If the object being satisfied is of the predecessor type, i.e., TQin(s), then this rule requires that the object belongs to the number of predecessor neighbor sets in the SPARQL query graph, expressed as: This set is less than or equal to the number of predecessor neighbors of the corresponding object on the RDF data graph, i.e. At the same time, it should also satisfy the requirement that the number of successor neighbor sets in the SPARQL query graph is [number missing]. The size of this set is less than or equal to the number of successor neighbors of the corresponding object in the RDF data graph, i.e. This rule setting allows for early prediction of matching trends and early determination of whether continuing the search on a branch is valid. Specifically, CTQ... in This represents the number of 1-hop successor relations for the object qtp′ to be matched in the SPARQL query graph, CTG. in CHQ represents the number of 1-hop successor relations for the object gtp′ to be matched in the RDF data graph. in CHG represents the number of 1-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. in TQin(s) represents the number of 1-hop predecessor relationships between the object to be matched gtp′ in the RDF data graph, TQin(s) represents the set of objects in the SPARQL query graph that have predecessor relationships with the objects in the MQ(s) set, and TGin(s) represents the set of objects in the RDF graph that have predecessor relationships with the objects in the MG(s) set.
[0084] Rule 4 (Successor 1-hop rule). The successor 1-hop rule is the Rv-out rule, and its expression is as follows:
[0085]
[0086] This rule also determines the future matching trend after the predecessor and successor rules. If the previously satisfied object is a successor type, i.e., TQout(s), then that object needs to satisfy the number of predecessor neighbor sets in the SPARQL query graph, expressed as: The size of this set is less than or equal to the number of predecessor neighbors of the corresponding object on the RDF data graph, i.e., CHG out Its expression is It should also satisfy the requirement of the number of successor neighbor sets in the SPARQL query graph, i.e., CTQ. out Its expression is The number of successor neighbors on the RDF data graph is less than or equal to the number of successor neighbors, i.e., CTG. out Its expression is If the judgment fails, it is necessary to backtrack to the last matching position and re-verify the first two rules, including CTQ. out This represents the number of 1-hop successor relationships that exist for the object qtp′ to be matched in the SPARQL query graph, CTG. out CHQ represents the number of 1-hop successor relationships that exist for the object gtp′ to be matched in the RDF data graph. out CHG represents the number of 1-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. out TQout(s) represents the number of 1-hop predecessor relationships between the object gtp′ to be matched in the RDF data graph, TQout(s) represents the set of objects in the SPARQL graph that have successor relationships with the objects in the MQ(s) set, and TGout(s) represents the set of objects in the RDF graph that have successor relationships with the objects in the MG(s) set.
[0087] Rule 5 (2-hop rule). The 2-hop rule, also known as the Rv-new rule, is expressed as follows:
[0088]
[0089] This rule is the next step in the decision based on the first four rules. It addresses the possibility of a 1-hop relationship mismatch even when the first four rules are satisfied. If a mismatch occurs, the search branch stops; continuing the search would only result in unnecessary computation and wasted time. If the matched object is determined to be a part of the SPARQL query graph that has no direct relationship with MQ(s), i.e., objects of type TQin(s) and TQout(s) with a 1-hop relationship, then it is only necessary to determine the number of predecessor and successor neighbors again, i.e., CHQ. new and CTQ new CHQ new and CTQ new Corresponding to count(Head(Q,qtp)TQd(s)) and count(Tail(Q,qtp)TQd(s)) respectively, the rule requires that these two sets are less than or equal to the corresponding parts in the RDF data graph, i.e., CHG. new With CTG new These can be expressed as count(Head(G,gtp)TGd(s)) and count(Tail(G,gtp)TGd(s)) respectively, where CTQ new This represents the number of 2-hop successor relations for the object qtp′ to be matched in the SPARQL query graph, CTG.new CHQ represents the number of 2-hop successor relations for the object gtp′ to be matched in the RDF data graph. new CHG represents the number of 2-hop predecessor relationships for the object qtp′ to be matched in the SPARQL query graph. new The first element represents the number of 2-hop predecessor relationships between the objects to be matched in the RDF data graph. The second element represents the set in the RDF data graph that has no direct relationship with the subset of M(s). The third element represents the set in the SPARQL query graph that has no direct relationship with the subset of M(s). The fourth element represents the set in both the RDF data graph and the SPARQL query graph that has no direct relationship with the subset of M(s).
[0090] Rule 6 (Chain Matching Rules). Chain matching rules include REdge-attr and RLinear-s, and their expressions are as follows:
[0091]
[0092]
[0093] In a SPARQL query graph, edges between nodes are categorized into two types: relation type and attribute type. By distinguishing the different attributes of predicate edges, this rule can quickly improve edge matching efficiency and is applicable to SPARQL chained query graphs. Specifically, the rule is used to determine whether the attributes of edges in a SPARQL query graph belong to the same type. The REdge-attr rule indicates that the attribute of any edge in a SPARQL query graph, i.e., edg1, is represented as Attr(qtp′). qe )(((qtp,qtp′)∈QB)∧(qtp′ qe ∈QE)), exist on the RDF data graph, and the corresponding objects belong to the same type of edge, i.e., edg1′, which can be expressed as Attr(gtp′). ge )(((gtp,gtp′)∈GB)∧(gtp′ ge ∈GE). The RLinear-s rule determines the semantic information of the SPARQL query graph, that is... Semantic information matching also exists in RDF data graphs, that is... Wherein, REdge-attr represents the predicate attribute consistency verification rule in the chained query graph, RLinear-s represents the semantic consistency verification rule of nodes and edges in the chained query graph, s represents the current matching state, edg1 represents the edge with relation type or attribute type in the SPARQL query graph, edg1′ represents the edge with relation type or attribute type in the RDF data graph, RO1 represents the semantic information in the RDF data graph, RG1 represents the semantic information in the SPARQL query graph, qs represents the subject in the SPARQL query graph, qe represents the predicate in the SPARQL query graph, qo represents the object in the SPARQL query graph, gs represents the subject in the RDF data graph, ge represents the predicate in the RDF data graph, and go represents the object in the RDF data graph.
[0094] Rule 7 (Star Schema Matching Rule). The star schema rule includes the rules RStar and RStar-s. Its expression is as follows:
[0095]
[0096]
[0097] The RStar rule is used to determine whether there is a sibling topological relationship between any object to be matched and any already matched object in the SPARQL query graph. Furthermore, there are parts with the same relationship in the RDF data graph, that is... Conversely, in RDF data graphs, sibling relationships exist, that is... Such a relationship also exists in the SPARQL query graph, namely... The RStar-s rule is semantically based and used to determine the semantic information present in any SPARQL star query graph. Its expression is: The corresponding semantic information exists in the RDF data graph, and its expression is: This rule is used to maintain semantic consistency across the shared star schema core. Here, RStar represents the validation rule for the structural relationships of special nodes in the star schema query graph, RStar-s represents the semantic consistency validation rule for the star schema query graph, Q1 indicates that there is a sibling topological relationship between matched objects in the SPARQL query graph, Q1′ indicates that there is a sibling topological relationship between objects to be matched in the SPARQL query graph, Q2 indicates that there is a sibling topological relationship between matched objects in the RDF data graph, Q2′ indicates that there is a sibling topological relationship between objects to be matched in the RDF data graph, Q3 indicates that there is some semantic information in the SPARQL star schema query graph, and Q3′ indicates that there is semantic information in the RDF data graph corresponding to Q3.
[0098] S3: Based on the chain-based identification rules and the star-based identification rules, the RDF data graphs in the RDF database are divided into chain-based data graphs and star-based data graphs; using the VF2 algorithm, based on the basic matching rules, chain-based matching rules, and star-based matching rules in step S2, the chain-based query graph is matched with the chain-based data graph, and the star-based query graph is matched with the star-based data graph, respectively, and the matching sets are filtered and the results are output;
[0099] Step S3 specifically includes:
[0100] S3-1: Based on the chain-based identification rules and the star-based identification rules, the RDF data graphs in the RDF database are divided into chain-based data graphs and star-based data graphs;
[0101] S3-2: Based on the chain matching algorithm R-VF-Linear in the VF2 algorithm, the chain query graph and the chain data graph are matched according to the basic matching rules and chain matching rules, and the chain data graph matching set is filtered and the result is output.
[0102] S3-3: Based on the star-shaped matching algorithm R-VF-Star in the VF2 algorithm, the star-shaped query graph and star-shaped data graph are matched according to the basic matching rules and star-shaped matching rules, and the star-shaped data graph matching set is filtered and the result is output.
[0103] The pseudocode for the algorithm is shown in Tables 2 and 3:
[0104] Table 2. Chain Matching Algorithm R-VF-Linear
[0105]
[0106] Table 3. R-VF-Star Star Schema Matching Algorithm
[0107]
[0108] The acquisition of the matching set is divided into two cases: chain-like and star-like. For a chain-like SPARQL query graph, it is viewed as a set of links, where each link consists of several triples connected end-to-end. When matching on an RDF data graph, candidate matches must exist in the neighbors of the subject and object of each triple. The candidate set P(s) changes continuously as matched objects are added to the matching set M(s). Obtaining this set requires certain conditions to be met; once these conditions are true, the candidate set P(s) is obtained. The specific details of the condition settings are as follows:
[0109] Based on the current state s, the candidate set may come from the neighbor set of the matched set, including TQ(s), TQd(s), TG(s), and TGd(s). However, the final candidate set is determined based on the following conditions:
[0110]
[0111] Based on the above three conditions, the candidate set P(s) comes from TQout(s) and TGout(s), because in general, at least one of TQout(s) and TGout(s) is not empty.
[0112] For a star-shaped SPARQL query graph, the candidate set P(s) may come from the neighbor set of the matched set, including TQ(s), TQd(s), TG(s), and TGd(s). However, the final candidate set is mainly determined based on the following conditions:
[0113]
[0114] After analyzing the above situation and considering the structural characteristics of the SPARQL star query graph, given that constant node matching is confirmed, it is necessary to find the keywords connected to the constant nodes. Therefore, the next step is to prioritize TQin(s) and TGin(s) as candidate sets. Here, TQ(s) represents the set that has a topological relationship with the MQ(s) set in the SPARQL query graph, and TG(s) represents the set that has a topological relationship with objects in the MG(s) set in the RDF graph. This represents the empty set.
[0115] experiment
[0116] This invention establishes an experimental environment and uses tools to generate chained and star-shaped query templates on the WatDiv synthetic dataset for testing. At the same time, it compares query time and other related indicators with common query methods such as S2X, PigSPARQL, and SHARD.
[0117] I. Experimental Design and Environment
[0118] The experimental scheme consists of three modules: (1) Acquiring experimental data. The SPARQL query statements in the experiment are generated by the WatDiv query generator, and the RDF dataset is generated by the WatDiv data generator. (2) Processing the RDF dataset. The experiment will process the RDF data (i.e., the RDF data graph) to achieve the goal of reducing the storage space of the dataset. (3) Setting different experimental indicators and comparing the experimental results of different methods. This invention tests the performance of the two sub-algorithms R-VF-Linear and R-VF-Star in the R-VF2 algorithm, and designs a comparative experiment for the R-VF-Star sub-algorithm.
[0119] The experiment used a laboratory server as the primary operating environment. This server was partitioned into four virtual machines using VMware virtual machine software, version VMware 15.5.0. A Spark distributed cluster was built using these four machines, consisting of one Master node and three Worker nodes. Spark centrally managed the cluster's resource allocation; the Master node allocated resources and distributed tasks to the Worker nodes, while the Worker nodes received messages, monitored their resource consumption, and observed task processing status. To ensure that the configuration of each machine did not affect the experimental results, all machines were configured with identical parameters. The hardware configuration of each machine is shown in Table 4.
[0120] Table 4 Hardware Configuration
[0121]
[0122] Software configuration for each machine: JDK 1.8.0; Hadoop 2.7.7 as the distributed infrastructure; Spark 2.4.5 as the distributed computing framework; PyCharm Community 2020.2.3 as the programming software; deployed in Yarn mode. The experiment uses the Python programming language. To leverage the big data computing advantages of the Spark cluster, PySpark is installed to complete the computational tasks. PySpark is an API provided by Spark developers specifically for Python programs; it is lightweight, simple, and can connect to Spark clusters.
[0123] II. Experimental Data and Processing
[0124] The first step in the experimental design is to acquire experimental data. This step requires the use of external data tools to generate the data. After acquiring the data, certain processing methods are used to preprocess the data to assist in the completion of the experiment.
[0125] (1) Experimental Dataset
[0126] The data used in the experiment was the WatDiv standard synthetic dataset. WatDiv is an RDF data management and testing tool developed by the Waterloo Data System organization. It allows users to define their own dataset size according to their needs; that is, users can set different scaling factors to generate test datasets of different sizes using WatDiv's data generator. The scaling factors used in the experiment were SF=10, SF=100, SF=1000, and SF=10000. Table 5 shows the dataset size for each scaling factor. In the experiment, the WatDiv query generator was also used to generate SPARQL query statements. The experiment used five chain schemas (L1-L5) and seven star schemas (S1-S7).
[0127] Table 5 RDF dataset
[0128]
[0129] (2) Data processing
[0130] The excessive URL characters in the RDF dataset lead to high space complexity. Therefore, a processing program is designed to process the original data to reduce the computational complexity in subsequent experiments. A single data point is extracted from the original WatDiv dataset, in the form of a triplet as shown below. <http: / / db.uwaterloo.ca / ~galuc / wsdbm / User0,http: / / db.uwaterloo.ca / ~galuc / wsdbm / friendOf,http: / / db.uwaterloo.ca / ~galuc / wsdbm / User1> The experimental design involved deleting meaningless strings and retaining numerical values for the subject and object, ultimately using an adjacency list for storage. The data processing described above utilized the PREPROCESS algorithm, and Table 6 shows the specific details.
[0131] Table 6 RDF Data Processing Algorithm PREPROCESS
[0132]
[0133]
[0134] Through preprocessing, the size of the RDF dataset was reduced by 75.5%-79.3% under different scaling factors, with an average reduction of 77.4%. The processed data is approximately one-third of the original data, significantly reducing the data size. Table 7 shows the specific changes in data size.
[0135] Table 7. Changes in Data Scale
[0136]
[0137] III. Experimental Results and Analysis
[0138] The experiment is based on the synthetic dataset WatDiv. Existing methods are tested on chain and star structure templates. The performance of these three methods and the R-VF2 algorithm proposed in this invention are compared under different experimental indicators, thereby evaluating the performance of the R-VF2 algorithm.
[0139] (1) Evaluate the query efficiency of the R-VF-Linear chain matching algorithm under the SPARQL chain structure.
[0140] To verify the effectiveness of the R-VF-Linear matching algorithm on large-scale RDF data, experiments were conducted to test query time using RDF data with scaling factors SF = 1000 and 10000. The experimental results are as follows: Figure 6 , Figure 7 as well as Figure 8 As shown.
[0141] It can be seen that, compared with the three existing query methods SHARD, PigSPARQL, and S2X, the R-VF-Linear algorithm in this invention has the shortest query time and the best query efficiency under both data scales. Specifically, for RDF data with a scaling factor SF = 1000, the SHARD method took 1132s-1720s to obtain query results, while R-VF-Linear only took 178s-191s. Calculations show that the query speed of R-VF-Linear is 5.0-8.5 times faster than the SHARD method. PigSPARQL and S2X took 683s-1183s and 286s-713s to obtain query results, respectively. The data shows that the query speed of the R-VF-Linear algorithm is improved by 2.64-5.3 times and 0.5-3 times, respectively. In summary, under a data scale of SF = 1000, the overall query speed of the R-VF-Linear method is improved by 0.5-8.5 times.
[0142] When the scaling factor SF = 10000, the query times for SHARD, PigSPARQL, S2X, and R-VF-Linear are in the ranges of 4592s-7409s, 775s-1275s, 498s-800s, and 255s-277s, respectively. The data shows that R-VF-Linear is 16-28 times faster than SHARD, PigSPARQL, and S2X, respectively, and 2-4 times faster. Overall, R-VF-Linear improves query speed by 1-28 times when SF = 10000.
[0143] The experimental results show that R-VF-Linear improves query speed for both data sizes. This is mainly because the designed chain-like rules can quickly reduce branches and continue searching, thus improving query speed.
[0144] (2) Evaluate the average query time and its variation under the SPARQL chain structure using the R-VF-Linear chain matching algorithm. By comparing the above experimental metrics, the scalability of the R-VF-Linear matching algorithm is evaluated. Experimental results are as follows: Figure 8 As shown.
[0145] It can be seen that the R-VF-Linear algorithm has a lower average query time than SHARD, PigSPARQL, and S2X for all four sizes of RDF data. The data indicates that the R-VF-Linear algorithm consistently achieves better performance.
[0146] Specifically, when the scaling factor SF = 10, the difference between R-VF-Linear and the SHARD, PigSPARQL, and S2X methods is particularly significant. When the RDF data scaling factor SF = 100, the average query time required for SHARD, PigSPARQL, and S2X methods is approximately 1134s, 953s, and 149s, respectively, while R-VF-Linear only requires 101s. In terms of time metrics, R-VF-Linear is 10, 8, and 0.5 times faster than the other three methods. When SF = 1000, the average query times reach 1477s, 970s, 478s, and 184s, respectively, with R-VF-Linear being 7, 4, and 2 times faster than the other methods. When the scaling factor SF = 10000, the average query times for the four methods are approximately 6072s, 1071s, 705s, and 265s, respectively, with R-VF-Linear being 21, 3, and 2 times faster than the others. Experimental data show that R-VF-Linear improves query speed by an average of 34, 6.25, 5.5, and 12.5 times under different data sizes. The experimental data fully validates the effectiveness of the R-VF-Linear method on chain-like structures.
[0147] From the perspective of time-varying magnitude, the data shows that SHARD, R-VF-Linear, PigSPARQL, and S2X exhibit varying degrees of growth. From small-scale to large-scale data, the average query time of all four methods monotonically increases with the size of the dataset. Calculations show that the growth rate of R-VF-Linear's magnitude of change is far lower than the growth rate of the dataset size, which fully demonstrates R-VF-Linear's good scalability and reflects its effectiveness in handling large-scale data.
[0148] (3) Evaluate the query speed of the R-VF-Star matching algorithm in this invention on star topologies, thereby demonstrating the effectiveness of the algorithm for star topologies. Experimental results are as follows: Figure 9 , Figure 10 , Figure 11 , Figure 12 as well as Figure 13 As shown.
[0149] As can be seen, the R-VF-Star method in this invention has a lower query time than other methods when processing star-shaped structures, which fully demonstrates that the algorithm has a faster query speed.
[0150] Specifically, with a scaling factor SF = 10, the R-VF-Star algorithm demonstrates a significant advantage in query time for star schemas compared to other methods. When SF = 1000, the query times required by SHARD, PigSPARQL, and S2X for processing star schemas range from 1700s to 4416s, 724s to 950s, 329s to 683s, and 148s to 168s, respectively. This indicates that R-VF-Star improves query speed by more than double. When SF = 10000, the query times required by each method for star schemas range from 7073s to 20671s, 965s to 1541s, 427s to 786s, and 208s to 223s, respectively. This clearly demonstrates that even with the largest datasets, SHARD, PigSPARQL, and S2X offer significantly faster query times than R-VF-Star.
[0151] Analysis revealed that the RV-Star method improved query speed by 6.7-175, 2-42, 2-13, and 2-92 times for four data sizes. This is mainly due to the reduced computational complexity caused by lower data space overhead and the targeted rules in the star schema that reduced the number of searches.
[0152] (4) The query speed of the R-VF-Star matching algorithm on a star schema is compared with the average query time and variation of the four methods to illustrate the scalability of R-VF-Star in this invention. Experimental data are as follows: Figure 13 As shown.
[0153] It can be seen that among the four methods mentioned above, the R-VF-Star method has the shortest average query time. Specific data shows that the average query times for the above methods fall within the ranges of 1644s-10349s, 689s-1072s, 112s-649s, and 15s-214s, respectively. This clearly demonstrates that R-VF-Star performs optimally regardless of the data scale tested. Calculation analysis shows that R-VF-Star improves the average query speed by 6-103, 1-22, 2-14, and 2-47 times overall, and by 54.5, 11.5, 8, and 24.5 times respectively.
[0154] By comparing the changes in the four methods with the increase of data size, it can be seen that R-VF-Star has the smallest change, lower than the others, and its change is also lower than the change in data size. This fully demonstrates that this method can be applied to query problems with large-scale data, and also shows that the method has good scalability.
[0155] (5) Evaluate the advantages of the R-VF-Star algorithm over the R-VF-Linear algorithm for star-structure queries. Experiments were conducted on identical star-structures, comparing the query efficiency between R-VF-Linear and R-VF-Star. To ensure the experiment's success, the star-structure was split into several links, and the R-VF-Linear algorithm was used. If R-VF-Star shows better performance, it indicates that the design of the star-structure rules in the R-VF-Star algorithm is more advantageous for queries on star-structures. The query time for star-structure queries in the experiment is as follows: Figure 14 , Figure 15 , Figure 16 as well as Figure 17 As shown.
[0156] It can be seen that the R-VF-Star method has a shorter query time than R-VF-Linear under all four data sizes. This fully demonstrates from the perspective of query efficiency that R-VF-Star is more suitable for SPARQL star schema query graphs and can solve query problems on star schemas.
[0157] Analysis revealed that R-VF-Linear, executed at different scales, required query times ranging from 18s-22s, 84s-89s, 181s-198s, and 238s-264s, with average query times of approximately 19.9s, 85.3s, 189s, and 252s, respectively. In contrast, R-VF-Star, processing star schemas, required 14s-17s, 64s-73s, 148s-168s, and 208-223s, with average query times of approximately 15.6s, 68.6s, 158.8s, and 214.1s, respectively. Compared to R-VF-Linear, R-VF-Star improved query efficiency by 15-36%, 16-27%, 11-31%, and 10-23%, respectively, with average improvements of 27%, 24%, 19%, and 17%, resulting in an overall improvement of approximately 21.75%. Analysis of the above data shows that the R-VF-Star method has high query efficiency when processing star-structured queries, fully demonstrating its effectiveness. The main reason for this is that the R-VF-Star method fully utilizes the structural relationships of the star-structured subgraphs, preserving the shared keywords among branches within the star structure.
[0158] (6) Evaluate the effectiveness of the two sub-algorithms, R-VF-Linear and R-VF-Star, for complex queries. Test these two sub-algorithms on a complex query graph (R-Matching is used in the graph to represent R-VF-Linear and R-VF-Star in this invention).
[0159] from Figure 18 , Figure 19 , Figure 20 as well as Figure 21 As can be seen, with the continuous increase in data scale, the query time of the above four methods increases under different data scales, but the amount of increase is not the same.
[0160] Comparing specific query times, SHARD's query time reached 103 seconds for scaling factors SF=10, 100, and 1000, and 104 seconds for scaling factor SF=10000, showing a significant increase and far exceeding R-Matching. When the scaling factor SF=10, the proposed R-Matching method improved query speed by 5-112 times compared to S2X, PigSPARQL, and SHARD. This fully demonstrates that the R-Matching method can solve complex query problems on a small scale. When the scaling factor SF=100, R-Matching's query speed improved by 1-11 times. When the scaling factor SF of the RDF dataset was 1000, the method's query speed was 1.5-13 times faster than the other three methods. When the data size SF=10000, the query speed was 4-59 times faster than other methods, also demonstrating good query performance.
[0161] Calculations show that the R-Matching method improves query speed by an average of 58.5, 6, 7.25, and 31.5 times for datasets of different sizes. This fully demonstrates that R-Matching exhibits a significant performance advantage on two complex SPARQL structures, representing an order-of-magnitude improvement. The data further validates the effectiveness of the two sub-algorithms in the VF2-based SPARQL query subgraph pattern matching method on subgraph structures.
[0162] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A SPARQL query subgraph pattern matching method based on the VF2 algorithm, characterized in that, Includes the following steps: S1: Present the SPARQL query statement in the form of a SPARQL query graph. Based on the chain recognition rule and the star recognition rule, the SPARQL query graph is divided into a chain query graph and a star query graph. S2: Establish the basic matching rules of the VF2 algorithm, and establish chain matching rules based on the structural and semantic information of the chain query graph, and establish star matching rules based on the structural and semantic information of the star query graph; S3: Based on the chain-based identification rules and the star-based identification rules, the RDF data graphs in the RDF database are divided into chain-based data graphs and star-based data graphs; using the VF2 algorithm, based on the basic matching rules, chain-based matching rules, and star-based matching rules in step S2, the chain-based query graph is matched with the chain-based data graph, and the star-based query graph is matched with the star-based data graph, respectively, and the matching sets are filtered and the results are output; The chain-type identification rule is as follows: when the SPARQL query graph only has the starting node of the link, the ending node of the link, and the nodes in the link, it belongs to the chain-type query graph. The star-shaped identification rule is: when a SPARQL query graph has a core point and branch nodes, it belongs to a star-shaped query graph. The expression for the node at the starting point of the link is: , The expression for the endpoint node of the link is: , The expression for a node in the link is: ; The expression for the core point is: , The expression for the branch node is: , ; in, Indicates the degree of departure. Indicates in-degree. This represents the total out-degree of all nodes in the star query graph; The basic matching rules in step S2 include predecessor rules, successor rules, predecessor 1-hop rules, successor 1-hop rules, and 2-hop rules; The predecessor rule expression is: ; The successor rule expression is: ; The front-end 1-hop rule expression is: ; The subsequent 1-hop rule expression is: ; The 2-hop rule expression is: ; in, Indicates the current matching status. This indicates the objects that have been matched in the current SPARQL query graph. This indicates the objects that have been matched in the current RDF data graph. Indicates the predecessor rule. This indicates the matched objects in the SPARQL query graph. Matching object There is a precursor relationship. This indicates matched objects in the RDF data graph. Matching object There is a precursor relationship. This represents the objects to be matched in the SPARQL query graph. Matched objects There is a precursor relationship. This represents the object to be matched in the RDF data graph. Matched objects There is a precursor relationship. Indicates the successor rule, This indicates the matched objects in the SPARQL query graph. Matching object There is a successor relationship. This represents the objects to be matched in the SPARQL query graph. Matched objects There is a successor relationship. This indicates matched objects in the RDF data graph. Between with the object to be matched There is a successor relationship. This represents the objects to be matched in the RDF data graph G. Matched objects There is a successor relationship. This indicates the front-wheel drive 1-hop rule. This represents the objects to be matched in the SPARQL query graph. The number of 1-hop successor relations. This represents the object to be matched in the RDF data graph. The number of 1-hop successor relations. This represents the objects to be matched in the SPARQL query graph. The number of 1-hop predecessor relationships. This represents the object to be matched in the RDF data graph. The number of 1-hop predecessor relationships. Indicates the successor 1-hop rule, This represents the objects to be matched in the SPARQL query graph. Numbers that have a 1-hop successor relation This represents the object to be matched in the RDF data graph. Numbers with 1-hop successor relations This represents the objects to be matched in the SPARQL query graph. The number of 1-hop predecessor relationships. This represents the object to be matched in the RDF data graph. The number of 1-hop predecessor relationships. This represents the objects to be matched in the SPARQL query graph. The number of 2-hop successor relations. This represents the object to be matched in the RDF data graph. The number of 2-hop successor relations. This represents the objects to be matched in the SPARQL query graph. The number of 2-hop precursor relationships. This indicates the number of 2-hop predecessor relationships between the objects to be matched in the RDF data graph; The expression for the chain-like matching rule is as follows: ; ; The expression for the star-pattern matching rule is: ; ; in, This represents the predicate attribute consistency verification rules in the chain-like query graph. This represents the semantic consistency verification rules for nodes and edges in a chain-like query graph. Validation rules representing the structural relationships of special nodes in a star-shaped query graph. This represents the semantic consistency verification rules for the star query graph. Indicates the current matching status. This indicates the objects that have been matched in the current SPARQL query graph. This indicates the objects that have been matched in the current RDF data graph. This indicates that there are edges of relation type or attribute type in the SPARQL query graph. This indicates that there are edges of relation type or attribute type in the RDF data graph. This indicates that there is a sibling topology relationship between matched objects in the SPARQL query graph. This indicates that there is a sibling topology relationship between the objects to be matched in the SPARQL query graph. This indicates that there is a sibling topology relationship between matched objects in the RDF data graph. This indicates that there is a sibling topology relationship between the objects to be matched in the RDF data graph. This indicates that there is some semantic information in the SPARQL star query graph. This indicates that there is semantic information in the RDF data graph corresponding to Q3. Represents semantic information in RDF data graphs. This represents the semantic information in the SPARQL query graph.
2. The SPARQL query subgraph pattern matching method according to claim 1, characterized in that, Step S3 specifically includes: S3-1: Based on the chain-based identification rules and the star-based identification rules, the RDF data graphs in the RDF database are divided into chain-based data graphs and star-based data graphs; S3-2: Based on the chain matching algorithm R-VF-Linear in the VF2 algorithm, the chain query graph and the chain data graph are matched according to the basic matching rules and the chain matching rules, and the chain data graph matching set is filtered and the result is output. S3-3: Based on the star-shaped matching algorithm R-VF-Star in the VF2 algorithm, the star-shaped query graph and star-shaped data graph are matched according to the basic matching rules and star-shaped matching rules, and the star-shaped data graph matching set is filtered and the result is output.
3. The SPARQL query subgraph pattern matching method according to claim 1, characterized in that, The application of the basic matching rules includes: Step 1: Verify the predecessor relationships in the SPARQL query graph using predecessor rules and verify the successor relationships in the SPARQL query graph using successor rules; Step 2: Use the predecessor 1-hop rule to determine the future matching trend of the next match and use the successor 1-hop rule to determine the future matching trend of the next match; Step 3: Use the 2-hop rule to determine the number of neighbors in predecessor and successor relationships again.
4. The SPARQL query subgraph pattern matching method according to claim 1, characterized in that, The SPARQL query statement described in step S1 is stored in an adjacency list format and then converted into a SPARQL query graph.