IP Library Granted Patent US 11,567,932
Granted Patent B2
US 11,567,932 · App. 17/080,698 · Granted Jan 31, 2023

Efficient compilation of graph queries on top of SQL based relational engine

Inventors: Vlad Haprian (Zurich, CH); Laurent Daynes (Saint-Ismier, FR); Zhen Hua Liu (San Mateo, CA); Lei Sheng (Foster City, CA); Hugo Kapp (Zurich, CH); Marco Arnaboldi (Zurich, CH); Jean-Pierre Lozi (Zurich, CH); Andrew Witkowski (Foster City, CA); Hassan Chafi (San Mateo, CA); Sungpack Hong (Palo Alto, CA)
Assignee: Oracle International Corporation
G06F16/2445G06F16/2282G06F16/2456G06F16/24526G06F16/252
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,567,932
App. No.
17/080,698
Granted
Jan 31, 2023
Kind
B2
Abstract

Techniques support graph pattern matching queries inside a relational database management system (RDBMS) that supports SQL execution. The techniques compile a graph pattern matching query into a SQL query that can then be executed by the relational engine. As a result, techniques enable execution of graph pattern matching queries on top of the relational engine by avoiding any change in the existing SQL engine.

Claims (34)

1. A method comprising:

a database system generating a main Structure Query Language (SQL) query from a graph pattern query that includes a query pattern, wherein the graph pattern query is issued against a heterogenous graph having either vertices or edges stored in a plurality of tables stored in the database system, wherein at least two tables of the plurality of tables store either vertices of the heterogenous graph or edges of the heterogenous graph, wherein the database system includes a processor, wherein the generating the main SQL query comprises:

generating pattern specializations for the graph pattern query, wherein each pattern specialization of the pattern specializations is a mapping of each variable in the query pattern to a respective table of the plurality of tables; and

generating individual SQL query blocks for the pattern specializations;

wherein the main SQL query includes a UNION ALL condition between the individual SQL query blocks; and

a database system executing the main SQL query, wherein the executing the main SQL query generates a result for the graph pattern query.

2. The method of claim 1 , wherein the heterogenous graph is defined by a database dictionary of the database system.

3. The method of claim 1 , wherein generating pattern specializations for the graph pattern query comprises: identifying variables in the query pattern; generating a graph representation of the graph pattern query, wherein the graph representation is a collection of data structures representing the query pattern;

generating a first mapping of each variable of the variables in the graph pattern query to a label, based on the graph representation; generating a second mapping of each variable in the graph pattern query to a set of one or more tables of the plurality of tables, based on a label associated with a respective variable in the first mapping.

4. The method of claim 3 , wherein the graph representation includes nodes and links representing the variables, wherein each node of the nodes and links is associated with a label constraint from the graph pattern query.

5. The method of claim 3 , wherein each pattern specialization of the pattern specializations is generated based on the second mapping and a definition of the heterogenous graph.

6. The method of claim 1 , wherein generating individual SQL query blocks for the pattern specializations comprises: for each pattern specialization of the pattern specializations, generating a FROM clause, wherein the FROM clause includes a table alias for each variable in a respective pattern specialization; generating a SELECT clause, wherein the SELECT clause includes a first column name corresponding with each projected property name that is qualified with a variable in a COLUMN clause of the graph pattern query, wherein the first column name is qualified by a table alias of a first particular table of the plurality of tables; generating a WHERE clause, wherein the WHERE clause includes: a second column name corresponding with each property name that is qualified with a variable in a WHERE clause of the graph pattern query, wherein the second column name is qualified by a table alias of a second particular table of the plurality of tables, and a JOIN condition between particular tables of the plurality of tables associated with the respective pattern specialization;

wherein an individual SQL query block corresponding to the respective pattern specialization includes the FROM clause, the COLUMN clause, and the WHERE clause.

7. The method of claim 1 , wherein the graph pattern query includes at least one anonymous variable in the query pattern.

8. The method of claim 7 , further comprising prior to generating the main SQL query, generating a unique variable name for each anonymous variable in the graph pattern query.

9. The method of claim 1 , wherein the graph pattern query includes a variable occurring multiple times in the query pattern.

10. The method of claim 9 , wherein obtaining pattern specializations for the graph pattern query comprises, for each pattern specialization of the pattern specializations, using a same table from the plurality of tables for each occurrence of the variable in the query pattern.

11. The method of claim 1 , wherein the main SQL query is generated when an issuer of the graph pattern query has SELECT privileges for the heterogenous graph and compiled into an executable query plan using privileges of an owner of the heterogenous graph.

12. One or more non-transitory computer-readable storage media storing one or more sequences of program instructions which, when executed by one or more computing devices, cause:

a database system generating a main SQL query from a graph pattern query that includes a query pattern, wherein the graph pattern query is issued against a heterogenous graph having either vertices or edges stored in a plurality of tables stored in the database system, wherein at least two tables of the plurality of tables each store either vertices of the graph or edges of the graph, wherein generating the main SQL query comprises:

generating pattern specializations for the graph pattern query, wherein each of the pattern specializations is a mapping of each variable in the query pattern to a respective table of the plurality of tables;

generating individual SQL query blocks for the pattern specializations;

wherein the main SQL query includes a UNION ALL condition between the individual SQL query blocks;

a database system executing the main SQL query, wherein executing the main SQL query generates a result for the graph pattern query.

13. The one or more non-transitory computer-readable storage media of claim 12 , wherein the heterogenous graph is defined by a database dictionary of the database system.

14. The one or more non-transitory computer-readable storage media of claim 12 , wherein generating pattern specializations for the graph pattern query comprises: identifying variables in the query pattern; generating a graph representation of the graph pattern query, wherein the graph representation is a collection of data structures representing the query pattern; generating a first mapping of each variable of the variables in the graph pattern query to a label, based on the graph representation; generating a second mapping of each variable in the graph pattern query to a set of one or more tables of the plurality of tables, based on a label associated with a respective variable in the first mapping.

15. The one or more non-transitory computer-readable storage media of claim 14 , wherein the graph representation includes nodes and links representing the variables, wherein each node of the nodes and links is associated with a label constraint from the graph pattern query.

16. The one or more non-transitory computer-readable storage media of claim 14 , wherein each pattern specialization of the pattern specializations is generated based on the second mapping and a definition of the heterogenous graph.

17. The one or more non-transitory computer-readable storage media of claim 12 , wherein generating individual SQL query blocks for the pattern specializations comprises: for each pattern specialization of the pattern specializations, generating a FROM clause, wherein the FROM clause includes a table alias for each variable in a respective pattern specialization; generating a SELECT clause, wherein the SELECT clause includes a first column name corresponding with each projected property name that is qualified with a variable in a COLUMN clause of the graph pattern query, wherein the first column name is qualified by a table alias of a first particular table of the plurality of tables; generating a WHERE clause, wherein the WHERE clause includes: a second column name corresponding with each property name that is qualified with a variable in a WHERE clause of the graph pattern query, wherein the second column name is qualified by a table alias of a second particular table of the plurality of tables, and a JOIN condition between particular tables of the plurality of tables associated with the respective pattern specialization; wherein an individual SQL query block corresponding to the respective pattern specialization includes the FROM clause, the COLUMN clause, and the WHERE clause.

18. The one or more non-transitory computer-readable storage media of claim 12 , wherein the graph pattern query includes at least one anonymous variable in the query pattern.

19. The one or more non-transitory computer-readable storage media of claim 18 , further comprising prior to generating the main SQL query, generating a unique variable name for each anonymous variable in the graph pattern query.

20. The one or more non-transitory computer-readable storage media of claim 12 , wherein the graph pattern query includes a variable occurring multiple times in the query pattern.

21. The one or more non-transitory computer-readable storage media of claim 20 , wherein obtaining pattern specializations for the graph pattern query comprises, for each pattern specialization of the pattern specializations, using a same table from the plurality of tables for each occurrence of the variable in the query pattern.

22. The one or more non-transitory computer-readable storage media of claim 12 , wherein the main SQL query is generated when an issuer of the graph pattern query has SELECT privileges for the heterogenous graph and compiled into an executable query plan using privileges of an owner of the heterogenous graph.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 27, 2020
From: HAPRIAN, VLAD; DAYNES, LAURENT; LIU, ZHEN HUA; SHENG, LEI; KAPP, HUGO; ARNABOLDI, MARCO; LOZI, JEAN-PIERRE; WITKOWSKI, ANDREW; CHAFI, HASSAN; HONG, SUNGPACK
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 054179/0596 →
Continuity (1)
Related Publication 20220129451A1 · Apr 28, 2022