IP Library › Granted Patent US 12,242,487
Granted Patent B2
US 12,242,487 · App. 17/965,687 · Granted Mar 4, 2025

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

Inventors: Vlad Ioan Haprian (Zurich, CH); Lei Sheng (Foster City, CA); Laurent Daynes (Saint-Ismier, FR); Zhen Hua Liu (San Mateo, CA); Hugo Kapp (Zurich, CH); Marco Arnaboldi (Zurich, CH); Andrew Witkowski (Foster City, CA); Sungpack Hong (Palo Alto, CA); Hassan Chafi (San Mateo, CA)
Assignee: Oracle International Corporation
G06F16/24566G06F16/2433
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 12,242,487
App. No.
17/965,687
Granted
Mar 4, 2025
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 that includes a bounded recursive pattern 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 that include bounded recursive patterns on top of the relational engine by avoiding any change in the existing SQL engine.

Claims (67)

1. A method comprising:

a database management system (DBMS) compiling a graph pattern matching query that includes a bounded recursive pattern query into a main SQL query, wherein:

the bounded recursive pattern query specifies a start variable, an end variable, a recursive pattern, and a bound expression defining at least a maximum number of repetitions of the recursive pattern;

the graph pattern matching query is issued against a heterogenous graph having vertices and edges stored in a plurality of tables;

compiling the graph pattern matching query into the main SQL query comprises:

unfolding the bounded recursive pattern query into a set of pattern specializations, wherein:

the set of pattern specializations is bounded by the bound expression; and

each of the pattern specializations is a mapping of each variable in the bounded recursive pattern query to a respective table of the plurality of tables;

generating individual SQL query blocks for the set of pattern specializations;

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

the DBMS executing the main SQL query, wherein executing the main SQL query generates a result for the graph pattern matching query.

2. The method of claim 1 , wherein the bound expression further defines a minimum number of repetitions of the recursive pattern.

3. The method of claim 1 , wherein compiling the graph pattern matching query into the main SQL query further comprises:

parsing the bounded recursive pattern query into an intermediate representation that connects vertices in the heterogeneous graph corresponding to the start variable and the end variable via the bounded recursive pattern query.

4. The method of claim 1 , wherein unfolding the bounded recursive pattern query into the set of pattern specializations comprises determining a table assignment such that any label constraints on the bounded recursive pattern query are respected and the label constraints on a start vertex corresponding to the start variable and an end vertex corresponding to the end variable are respected.

5. The method of claim 1 , wherein unfolding the bounded recursive pattern query into a set of pattern specializations comprises:

binding the start variable and the end variable to underlying tables in the plurality of tables;

executing a breadth-first search on the heterogeneous graph starting at each vertex matching the start variable and ending at a vertex matching the end variable.

6. The method of claim 5 , wherein the breadth-first search allows nodes in the heterogeneous graph to be visited multiple times.

7. The method of claim 5 , wherein:

each hop in the breadth-first search corresponds to a repetition of the bounded recursive pattern query; and

the breadth-first search stops when the maximum number of repetitions of the recursive pattern is reached.

8. The method of claim 5 , wherein executing the breadth-first search comprises applying label constraints to variables of the bounded recursive pattern query.

9. The method of claim 5 , wherein executing the breadth-first search comprises applying neighbor constraints such that only tables having a neighbor table are fetched.

10. The method of claim 1 , wherein the heterogeneous graph is defined by a database dictionary of the DBMS.

11. The method of claim 1 , wherein generating individual SQL query blocks for the pattern specializations comprises:

for each 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 matching 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 matching 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.

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 management system (DBMS) compiling a graph pattern matching query that includes a bounded recursive pattern query into a main SQL query, wherein:

the bounded recursive pattern query specifies a start variable, an end variable, a recursive pattern, and a bound expression defining at least a maximum number of repetitions of the recursive pattern;

the graph pattern matching query is issued against a heterogenous graph having vertices and edges stored in a plurality of tables;

compiling the graph pattern matching query into the main SQL query comprises:

unfolding the bounded recursive pattern query into a set of pattern specializations, wherein:

the set of pattern specializations is bounded by the bound expression; and

each of the pattern specializations is a mapping of each variable in the bounded recursive pattern query to a respective table of the plurality of tables;

generating individual SQL query blocks for the set of pattern specializations;

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

the DBMS executing the main SQL query, wherein executing the main SQL query generates a result for the graph pattern matching query.

13. The one or more non-transitory computer-readable storage media of claim 12 , wherein the bound expression further defines a minimum number of repetitions of the recursive pattern.

14. The one or more non-transitory computer-readable storage media of claim 12 , wherein compiling the graph pattern matching query into the main SQL query further comprises:

parsing the bounded recursive pattern query into an intermediate representation that connects vertices in the heterogeneous graph corresponding to the start variable and the end variable via the bounded recursive pattern query.

15. The one or more non-transitory computer-readable storage media of claim 12 , wherein unfolding the bounded recursive pattern query into the set of pattern specializations comprises determining a table assignment such that any label constraints on the bounded recursive pattern query are respected and the label constraints on a start vertex corresponding to the start variable and an end vertex corresponding to the end variable are respected.

16. The one or more non-transitory computer-readable storage media of claim 12 , wherein unfolding the bounded recursive pattern query into a set of pattern specializations comprises:

binding the start variable and the end variable to underlying tables in the plurality of tables;

executing a breadth-first search on the heterogeneous graph starting at each vertex matching the start variable and ending at a vertex matching the end variable.

17. The one or more non-transitory computer-readable storage media of claim 16 , wherein the breadth-first search allows nodes in the heterogeneous graph to be visited multiple times.

18. The one or more non-transitory computer-readable storage media of claim 16 ,

wherein:

each hop in the breadth-first search corresponds to a repetition of the bounded recursive pattern query; and

the breadth-first search stops when the maximum number of repetitions of the recursive pattern is reached.

19. The one or more non-transitory computer-readable storage media of claim 16 , wherein executing the breadth-first search comprises applying label constraints to variables of the bounded recursive pattern query.

20. The one or more non-transitory computer-readable storage media of claim 16 , wherein executing the breadth-first search comprises applying neighbor constraints such that only tables having a neighbor table are fetched.

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

22. 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 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 matching 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 matching 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.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 8, 2022
From: WITKOWSKI, ANDREW
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 062026/0734 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 13, 2022
From: HAPRIAN, VLAD IOAN; SHENG, LEI; DAYNES, LAURENT; LIU, ZHEN HUA; KAPP, HUGO; ARNABOLDI, MARCO; HONG, SUNGPACK; CHAFI, HASSAN
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 061420/0072 →
Continuity (1)
Related Publication 20240126764A1 · Apr 18, 2024
References Cited (48)
US 20060101001A1 · Lindsay et al. · 2006 [cited by applicant]
US 20080071754A1 · Muras · 2008 [cited by examiner]
US 20080184197A1 · Dobbins et al. · 2008 [cited by applicant]
US 20100088666A1 · Box et al. · 2010 [cited by applicant]
US 20110270861A1 · Arshavsky et al. · 2011 [cited by applicant]
US 20160103931A1 · Appavu · 2016 [cited by applicant]
US 20160179883A1 · Chen · 2016 [cited by examiner]
US 20160342708A1 · Fokoue-Nkoutche et al. · 2016 [cited by applicant]
US 20170046388A1 · Kirk · 2017 [cited by examiner]
US 20180067987A1 · Kang et al. · 2018 [cited by applicant]
US 20180136798A1 · Aggour · 2018 [cited by examiner]
US 20180218088A1 · Fischer et al. · 2018 [cited by applicant]
US 20180293329A1 · Yanagisawa · 2018 [cited by applicant]
US 20190205480A1 · Zhang et al. · 2019 [cited by applicant]
US 20190213356A1 · Vagujhelyi et al. · 2019 [cited by applicant]
US 20190311060A1 · Bross et al. · 2019 [cited by applicant]
US 20200226053A1 · Meibusch · 2020 [cited by examiner]
US 20200334234A1 · Mendel-Gleason · 2020 [cited by examiner]
US 20200364268A1 · Xu et al. · 2020 [cited by applicant]
US 20210034615A1 · Chen et al. · 2021 [cited by applicant]
US 20210064660A1 · Xu et al. · 2021 [cited by applicant]
US 20210149854A1 · Barde et al. · 2021 [cited by applicant]
US 20210256063A1 · Kasperovics · 2021 [cited by examiner]
US 20220129451A1 · Haprian et al. · 2022 [cited by applicant]
US 20220129461A1 · Haprian et al. · 2022 [cited by applicant]
US 20220129465A1 · Haprian et al. · 2022 [cited by applicant]
Zemke, Fred, “Fixed Graph Patterns”, ISO/IEC SC32/WG3:ERF-035, dated Sep. 14, 2018, 25 pages. [cited by applicant]
TigerGraph, “The Only Scalable Graph Database for the Enterprise”, https://www.tigergraph.com/, last viewed on Nov. 4, 2020, 9 pages. [cited by applicant]
PGQL, “Property Graph Query Language”, http://pgql-lang.org/, last viewed on Nov. 3, 2020, 5 pages. [cited by applicant]
Neo4j Graph Platform, “What is Neo4j?”, https://neo4j.com/, last viewed on Nov. 4, 2020, 14 pages. [cited by applicant]
Neo4j Graph Database Platform, “Cypher Query Language”, https://neo4j.com/developer/cypher/, dated Nov. 4, 2020, 7 pages. [cited by applicant]
Michaels, Jan, “Property Graph Data Model—The Proposal”, Individual Expert Contribution, dated Jan. 16, 2019, 76 pages. [cited by applicant]
Haprian, Vlad et al., “Efficient compilation of bounded recursive graph queries on top of SQL based relational engine”, 5 pages. [cited by applicant]
Databricks, “Graph Analysis Tutorial with GraphFrames”, dated Jul. 21, 2020, https://docs.databricks.com/spark/latest/graph-analysis/graphframes/graph-analysis-tutorial.html, 2 pages. [cited by applicant]
Apache TinkerPop, “The Gremlin Graph Traversal Machine and Language”, tinkerpop.apache.org/gremlin.html, last viewed on Nov. 4, 2020, 6 pages. [cited by applicant]
Amazon Neptune, “Overview” https://aws.amazon.com/neptune/, last viewed on Nov. 4, 2020, 20 pages. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,719, filed Oct. 26, 2020, Notice of Allowance and Fees Due, Oct. 20, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,700, filed Oct. 26, 2020, Advisory Action, Mar. 30, 2023. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,700, filed Oct. 26, 2020, Final Rejection, Jan. 18, 2023. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,698, filed Oct. 26, 2020, Notice of Allowance and Fees Due, Dec. 28, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,719, filed Oct. 26, 2020, Notice of Allowance and Fees Due, Aug. 11, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,719, filed Oct. 26, 2020, Notice of Allowance and Fees Due, Jul. 7, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,719, filed Oct. 26, 2020, Non-Final Rejection, Dec. 14, 2021. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,700, filed Oct. 26, 2020, Non-Final Rejection, Sep. 9, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,698, filed Oct. 26, 2020, Notice of Allowance and Fees Due, Sep. 14, 2022. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,698, filed Oct. 26, 2020, Non-Final Rejection, Dec. 24, 2021. [cited by applicant]
Haprian, U.S. Appl. No. 17/080,698, filed Oct. 26, 2020, Final Rejection, May 18, 2022. [cited by applicant]
“SAP HANA Graph Reference”, SAP HANA Platform 2.0 SPS 04 Document Version: 1.1 dated Oct. 31, 2019, SAP.com, 86 pages. [cited by applicant]