IP Library › Granted Patent US 12,056,492
Granted Patent B2
US 12,056,492 · App. 17/780,940 · Granted Aug 6, 2024

Method and apparatus for generating dependence graph, device, storage medium and program product

Inventors: Jiaxun Wei (Beijing, CN); Yuxuan Huo (Beijing, CN); Cong Zhang (Beijing, CN); Hui Tang (Beijing, CN); Ze Chen (Beijing, CN)
Assignee: Beijing Baidu Netcom Science Technology Co., Ltd.
G06F9/3838G06F9/541
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,056,492
App. No.
17/780,940
Filed
May 27, 2022
Granted
Aug 6, 2024
Kind
B2
Examiner
WU, DAXIN
Art Unit
2191
USPC
717/144
Abstract

A method of generating a dependence graph, an apparatus, a device, a storage medium and a program product are provided. The method includes: obtaining a hook API used by a function component; obtaining a parameter value of the hook API used by the function component; and generating a dependence graph. The hook API corresponds to a hook node in the dependence graph, the parameter value corresponds to a value node in the dependence graph, and there is a connection relationship between the value node and a corresponding hook node.

Claims (52)

1. A method of generating a dependence graph, comprising:

obtaining a hook application programming interface (API) used by a function component;

obtaining a parameter value of the hook API used by the function component; and

generating the dependence graph, wherein the hook API corresponds to a hook node in the dependence graph, the parameter value of the hook API corresponds to a value node in the dependence graph, and there is a connection relationship between the value node and a corresponding hook node;

wherein the method further comprises:

in a case that the hook API used by the function component comprises a customized hook API, performing a recursive analysis on the customized hook API to obtain an atomic hook API directly; and

in a case that there is a further hook API in addition to the atomic hook API obtained through the recursive analysis, obtaining a parameter value of the atomic hook API, and obtaining a parameter value of the further hook API in addition to the atomic hook API obtained through the recursive analysis,

wherein the dependence graph further comprises:

a hook node corresponding to the atomic hook API, a hook node corresponding to the further hook API, a value node corresponding to the parameter value of the atomic hook API and a value node corresponding to the parameter value of the further hook API, and there is a connection relationship between each value node and a corresponding hook node.

2. The method according to claim 1 , further comprising: in a case that the dependence graph comprises a target value node of a new identifier capable of being obtained through an expression, generating a value node corresponding to the new identifier in the dependence graph, and establishing a connection relationship between the target value node and the value node of the new identifier.

3. The method according to claim 1 , further comprising:

obtaining an extensible markup language (XML) expression of a top level of the function component;

generating a component node corresponding to the XML expression of the top level in the dependence graph; and

in a case that the XML expression of the top level comprises a target XML expression referring to an identifier of a value node in the dependence graph, establishing a connection relationship between the target XML expression and a corresponding value node in the dependence graph.

4. The method according to claim 3 , wherein generating the component node corresponding to the XML expression of the top level in the dependence graph comprises:

simplifying a syntax tree of the XML expression of the top level to obtain an XML expression of at least one predetermined level, and generating a component node corresponding to the XML expression of the at least one predetermined level in the dependence graph.

5. An electronic device, comprising:

at least one processor; and

a memory communicatively connected to the at least one processor, wherein the memory is configured to store instructions executable by the at least one processor, and the instructions, when being executed by the at least one processor, cause the at least one processor to perform:

obtaining a hook application programming interface (API) used by a function component;

obtaining a parameter value of the hook API used by the function component; and

generating the dependence graph, wherein the hook API corresponds to a hook node in the dependence graph, the parameter value of the hook API corresponds to a value node in the dependence graph, and there is a connection relationship between the value node and a corresponding hook node;

wherein the instructions, when being executed by the at least one processor, cause the at least one processor to further perform:

in a case that the hook API used by the function component comprises a customized hook API, performing a recursive analysis on the customized hook API to obtain an atomic hook API directly; and

in a case that there is a further hook API in addition to the atomic hook API obtained through the recursive analysis, obtaining a parameter value of the atomic hook API, and obtaining a parameter value of the further hook API in addition to the atomic hook API obtained through the recursive analysis,

wherein the dependence graph further comprises:

a hook node corresponding to the atomic hook API, a hook node corresponding to the further hook API, a value node corresponding to the parameter value of the atomic hook API and a value node corresponding to the parameter value of the further hook API, and there is a connection relationship between each value node and a corresponding hook node.

6. The electronic device according to claim 5 , wherein the instructions, when being executed by the at least one processor, cause the at least one processor to further perform:

in a case that the dependence graph comprises a target value node of a new identifier capable of being obtained through an expression, generating a value node corresponding to the new identifier in the dependence graph, and establishing a connection relationship between the target value node and the value node of the new identifier.

7. The electronic device according to claim 5 , wherein the instructions, when being executed by the at least one processor, cause the at least one processor to further perform:

obtaining an extensible markup language (XML) expression of a top level of the function component;

generating a component node corresponding to the XML expression of the top level in the dependence graph; and

in a case that the XML expression of the top level comprises a target XML expression referring to an identifier of a value node in the dependence graph, establishing a connection relationship between the target XML expression and a corresponding value node in the dependence graph.

8. The electronic device according to claim 7 , wherein generating the component node corresponding to the XML expression of the top level in the dependence graph comprises:

simplifying a syntax tree of the XML expression of the top level to obtain an XML expression of at least one predetermined level, and generating a component node corresponding to the XML expression of the at least one predetermined level in the dependence graph.

9. A non-transitory computer-readable storage medium, storing computer instructions, wherein the computer instructions, when being executed by a computer, cause the computer to perform:

obtaining a hook application programming interface (API) used by a function component;

obtaining a parameter value of the hook API used by the function component; and

generating the dependence graph, wherein the hook API corresponds to a hook node in the dependence graph, the parameter value of the hook API corresponds to a value node in the dependence graph, and there is a connection relationship between the value node and a corresponding hook node;

wherein the computer instructions, when being executed by the computer, cause the computer to further perform:

in a case that the hook API used by the function component comprises a customized hook API, performing a recursive analysis on the customized hook API to obtain an atomic hook API directly; and

in a case that there is a further hook API in addition to the atomic hook API obtained through the recursive analysis, obtaining a parameter value of the atomic hook API, and obtaining a parameter value of the further hook API in addition to the atomic hook API obtained through the recursive analysis,

wherein the dependence graph further comprises:

a hook node corresponding to the atomic hook API, a hook node corresponding to the further hook API, a value node corresponding to the parameter value of the atomic hook API and a value node corresponding to the parameter value of the further hook API, and there is a connection relationship between each value node and a corresponding hook node.

10. The storage medium according to claim 9 , wherein the computer instructions, when being executed by the computer, cause the computer to further perform:

in a case that the dependence graph comprises a target value node of a new identifier capable of being obtained through an expression, generating a value node corresponding to the new identifier in the dependence graph, and establishing a connection relationship between the target value node and the value node of the new identifier.

11. The storage medium according to claim 9 , wherein the computer instructions, when being executed by the computer, cause the computer to further perform:

obtaining an extensible markup language (XML) expression of a top level of the function component;

generating a component node corresponding to the XML expression of the top level in the dependence graph; and

in a case that the XML expression of the top level comprises a target XML expression referring to an identifier of a value node in the dependence graph, establishing a connection relationship between the target XML expression and a corresponding value node in the dependence graph.

12. The storage medium according to claim 11 , wherein generating the component node corresponding to the XML expression of the top level in the dependence graph comprises:

simplifying a syntax tree of the XML expression of the top level to obtain an XML expression of at least one predetermined level, and generating a component node corresponding to the XML expression of the at least one predetermined level in the dependence graph.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 13, 2022
From: WEI, JIAXUN; HUO, YUXUAN; ZHANG, CONG; TANG, HUI; CHEN, ZE
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 060187/0159 →
Priority Claims (1)
CN 202110219222.2 · Feb 26, 2021 · national
Continuity (1)
Related Publication 20240053991A1 · Feb 15, 2024