IP Library › Granted Patent US 12,572,820
Granted Patent B2
US 12,572,820 · App. 17/011,734 · Granted Mar 10, 2026

Methods and systems for generating knowledge graphs from program source code

Inventors: Vikas Choudhary (Bangalore, IN); Harsh Mohan Modawel (Bangalore, IN); Vinoth Jeba Kumar Radha Krishnan (Bangalore, IN); Ganesh Bhat (Mississauga, CA)
Assignee: INTUIT INC.
G06N5/02G06F8/433G06F18/214G06F18/29
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,572,820
App. No.
17/011,734
Granted
Mar 10, 2026
Kind
B2
Abstract

Certain aspects of the present disclosure provide techniques for generating knowledge graphs from program source code. An example method generally includes receiving a source code definition of a workflow implemented in an application. The source code definition of the workflow is converted into an intermediate representation of the workflow, the intermediate representation comprising a condensed version of the source code definition. An abstract syntax tree representation of the workflow is generated based on the intermediate representation of the workflow. A structured file is generated by traversing the abstract syntax tree representation of the workflow, wherein the structured file comprises a definition of the workflow in a knowledge graph-specific language. The structured file is deployed to a knowledge graph execution engine.

Claims (72)

1 . A method for generating a knowledge graph definition from program source code, comprising:

receiving a source code definition of a workflow implemented in an application;

converting the source code definition of the workflow into an intermediate representation of the workflow, the intermediate representation comprising a condensed version of the source code definition;

generating an abstract syntax tree representation of the workflow based on the intermediate representation of the workflow;

generating a structured file by:

traversing the abstract syntax tree representation of the workflow recursively until reaching a bottom of the abstract syntax tree representation;

identifying, based on the reaching of the bottom of the abstract syntax tree representation, operations that are to be invoked in the workflow using a knowledge graph definition generator; and

writing the structured file from the bottom of the abstract syntax tree representation to a root node of the abstract syntax tree representation based on the identifying of the operations that are to be invoked in the workflow, wherein the structured file comprises a definition of the workflow in a knowledge graph-specific language readable by a knowledge graph execution engine, wherein the knowledge graph-specific language comprises a declarative construct that is decoupled from programmatic and platform-related constraints associated with a programming language of the source code definition of the workflow; and

deploying the structured file to the knowledge graph execution engine.

2 . The method of claim 1 , wherein converting the source code definition of the workflow into the intermediate representation of the workflow comprises removing programming language-specific constructs from the source code definition of the workflow.

3 . The method of claim 1 , wherein converting the source code definition of the workflow into the intermediate representation of the workflow comprises removing loop structures from the source code definition of the workflow.

4 . The method of claim 1 , wherein converting the source code definition of the workflow into the intermediate representation of the workflow comprises rewriting the source code definition such that a value is assigned to a variable in the source code definition once regardless of a number of assignments that are made to the variable in the source code definition.

5 . The method of claim 1 , wherein generating the abstract syntax tree representation of the workflow comprises:

tokenizing the intermediate representation of the workflow based on a lexical analysis of the intermediate representation; and

building the abstract syntax tree by syntactically analyzing the tokenized intermediate representation of the workflow based on a context-free grammar associated with the knowledge graph-specific language.

6 . The method of claim 5 , wherein tokenizing the intermediate representation of the workflow comprises:

identifying one or more variables in the intermediate representation of the workflow based on identifying assignments of values to the one or more variables in the intermediate representation of the workflow; and

generating a token for each of the one or more variables in the intermediate representation of the workflow.

7 . The method of claim 5 , wherein building the abstract syntax tree comprises:

generating a tree data structure based on an order in which operations are defined in the intermediate representation of the workflow such that an output of a function is represented as a root node of the abstract syntax tree.

8 . The method of claim 7 , wherein:

nodes in the tree data structure represent an operation of a plurality of operations defined in the context-free grammar associated with the knowledge graph-specific language, and

the plurality of operations comprise mathematical primitive operations/logical operations/conditional operations defined in a programming language and function calls in the application.

9 . The method of claim 1 , wherein:

generating the structured file comprises translating each node in the abstract syntax tree to a node in a calculation graph, and

nodes in the calculation graph represent operations or inputs into an operation performed to execute the workflow.

10 . The method of claim 1 , wherein generating the structured file comprises recursively traversing the abstract syntax tree such that operations defined at a lowest level of the abstract syntax tree are defined first in the structured file.

11 . The method of claim 1 , wherein the structured file includes labels associated with variables defined in the program source code.

12 . The method of claim 11 , further comprising: replacing the labels associated with variables defined in the program source code with corresponding labels in a data model associated with the knowledge graph execution engine.

13 . A system, comprising:

a processor; and

a memory having instructions stored thereon which, when executed by the processor, performs an operation for generating a knowledge graph from program source code, the operation comprising:

receiving a source code definition of a workflow implemented in an application;

converting the source code definition of the workflow into an intermediate representation of the workflow, the intermediate representation comprising a condensed version of the source code definition;

generating an abstract syntax tree representation of the workflow based on the intermediate representation of the workflow;

generating a structured file by:

traversing the abstract syntax tree representation of the workflow recursively until reaching a bottom of the abstract syntax tree representation;

identifying, based on the reaching of the bottom of the abstract syntax tree representation, operations that are to be invoked in the workflow using a knowledge graph definition generator; and

writing the structured file from the bottom of the abstract syntax tree representation to a root node of the abstract syntax tree representation based on the identifying of the operations that are to be invoked in the workflow, wherein the structured file comprises a definition of the workflow in a knowledge graph-specific language readable by a knowledge graph execution engine, wherein the knowledge graph-specific language comprises a declarative construct that is decoupled from programmatic and platform-related constraints associated with a programming language of the source code definition of the workflow; and

deploying the structured file to the knowledge graph execution engine.

14 . The system of claim 13 , wherein converting the source code definition of the workflow into the intermediate representation of the workflow comprises one or more of:

removing programming language-specific constructs from the source code definition of the workflow;

removing loop structures from the source code definition of the workflow; or

rewriting the source code definition such that a value is assigned to a variable in the source code definition once regardless of a number of assignments that are made to the variable in the source code definition.

15 . The system of claim 13 , wherein generating the abstract syntax tree representation of the workflow comprises:

tokenizing the intermediate representation of the workflow based on a lexical analysis of the intermediate representation; and

building the abstract syntax tree by syntactically analyzing the tokenized intermediate representation of the workflow based on a context-free grammar associated with the knowledge graph-specific language.

16 . The system of claim 15 , wherein tokenizing the intermediate representation of the workflow comprises:

identifying one or more variables in the intermediate representation of the workflow based on identifying assignments of values to the one or more variables in the intermediate representation of the workflow; and

generating a token for each of the one or more variables in the intermediate representation of the workflow.

17 . The system of claim 15 , wherein building the abstract syntax tree comprises:

generating a tree data structure based on an order in which operations are defined in the intermediate representation of the workflow such that an output of a function is represented as a root node of the abstract syntax tree.

18 . The system of claim 17 , wherein:

nodes in the tree data structure represent an operation of a plurality of operations defined in the context-free grammar associated with the knowledge graph-specific language, and

the plurality of operations comprise mathematical primitive operations/logical operations/conditional operations defined in a programming language and function calls in the application.

19 . The system of claim 18 , wherein:

generating the structured file comprises translating each node in the abstract syntax tree to a node in a calculation graph, and

nodes in the calculation graph represent operations or inputs into an operation performed to execute the workflow.

20 . A method for generating a knowledge graph definition from program source code, comprising:

receiving a source code definition of a workflow implemented in an application;

converting the source code definition of the workflow into an intermediate representation of the workflow, the intermediate representation comprising a condensed version of the source code definition;

generating an abstract syntax tree representation of the workflow based on the intermediate representation of the workflow by:

tokenizing the intermediate representation of the workflow based on a lexical analysis of the intermediate representation; and

building the abstract syntax tree by syntactically analyzing the tokenized intermediate representation of the workflow based on a context-free grammar associated with knowledge graph-specific language to generate a tree data structure based on an order in which operations are defined in the intermediate representation of the workflow such that an output of a function is represented as a root node of the abstract syntax tree, wherein:

nodes in the tree data structure represent an operation of a plurality of operations defined in the context-free grammar associated with the knowledge graph-specific language,

the plurality of operations comprise mathematical primitive operations/logical operations/conditional operations defined in a programming language and function calls in the application, and

the knowledge graph-specific language comprises a declarative construct that is decoupled from programmatic and platform-related constraints associated with a programming language of the source code definition of the workflow;

generating a structured file by:

traversing the abstract syntax tree representation of the workflow recursively until reaching a bottom of the abstract syntax tree representation;

identifying, based on the reaching of the bottom of the abstract syntax tree representation, operations that are to be invoked in the workflow using a knowledge graph definition generator; and

writing the structured file from the bottom of the abstract syntax tree representation to a root node of the abstract syntax tree representation based on the identifying of the operations that are to be invoked in the workflow, wherein the structured file comprises a definition of the workflow in the knowledge graph-specific language readable by a knowledge graph execution engine; and

deploying the structured file to the knowledge graph execution engine.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 3, 2020
From: CHOUDHARY, VIKAS; MODAWEL, HARSH MOHAN; RADHA KRISHNAN, VINOTH JEBA KUMAR; BHAT, GANESH
To: INTUIT INC.
Reel/Frame 053690/0032 →
Continuity (1)
Related Publication 20220067538A1 · Mar 3, 2022
References Cited (18)
US 7043720B2 · Kuzmin · 2006 [cited by examiner]
US 9026903B1 · Michael · 2015 [cited by examiner]
US 10416972B1 · Forghani · 2019 [cited by examiner]
US 10534604B1 · Kimball · 2020 [cited by examiner]
US 20090259454A1 · Adir · 2009 [cited by examiner]
US 20120254665A1 · Pasala · 2012 [cited by examiner]
US 20140282424A1 · Sheridan · 2014 [cited by examiner]
US 20170091293A1 · Cummings · 2017 [cited by examiner]
US 20170344349A1 · He · 2017 [cited by examiner]
US 20180373986A1 · Rainwater · 2018 [cited by examiner]
US 20190303141A1 · Li · 2019 [cited by examiner]
US 20200042706A1 · Allen · 2020 [cited by examiner]
US 20210056211A1 · Olson · 2021 [cited by examiner]
US 20210240456A1 · Dwars · 2021 [cited by examiner]
US 20210286718A1 · Ravindar · 2021 [cited by examiner]
US 20210318858A1 · Xu · 2021 [cited by examiner]
US 20220066752A1 · Zhang · 2022 [cited by examiner]
Fechete et al., Generating Control Flow Graphs for Ada Programs, Sep. 2007, 48 pages (Year: 2007). [cited by examiner]