Relationship construction method and device, equipment, storage medium and product
By analyzing the abstract syntax tree and bytecode files of the business system, and generating graph data to represent the association relationships at all levels of the business system, it solves the problem of difficulty in quickly obtaining association relationships in the prior art, and realizes rapid analysis and evaluation of the impact on the service process.
Patent Information
- Application Number
- CN202411575640.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-04-18
AI Technical Summary
The existing technology is difficult to quickly obtain the correlation between various levels in the business system, making it difficult for businesses and developers to evaluate the scope of impact of the processing logic of risk variables and analyze the underlying data source on which risk variables depend.
By obtaining the abstract syntax tree and bytecode file corresponding to the source code of the target service, obtaining the data source information based on the abstract syntax tree, obtaining the call relationship between the target method and the risk variable based on the bytecode file, and generating graph data to represent the association relationship between nodes and edges.
It realizes the rapid construction and storage relationship between various levels of the business system without affecting the original service system, so that developers can understand the impact of modifying a certain node on the entire service process.
Smart Images

Figure CN119848264A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of business service technology, and in particular to a relationship building method, device, equipment, storage medium and product. Background Art
[0002] As the market environment becomes increasingly complex, more and more risk factors need to be considered in loan review. Currently, a risk strategy service often needs to process thousands of risk variables, and then deploy corresponding risk strategies based on the risk variables. The processing logic of these risk variables depends on each other and has a clear correlation. In addition, the processing logic of risk variables changes frequently, and the correlation between variables is often affected. This makes it difficult for business and developers to assess the impact of adjustments to the risk variable processing logic, and it is also difficult to analyze the underlying data sources that the risk variables rely on.
[0003] In related technologies, the communication and development process of new requirements often requires developers to manually sort out these contents, which is time-consuming and labor-intensive.
[0004] Therefore, how to quickly obtain the relationship between various levels in the business system is a problem that needs to be solved urgently. Summary of the invention
[0005] The main purpose of this application is to provide a relationship building method, device, equipment, storage medium and product, aiming to solve the technical problem of how to quickly obtain the association relationship between various levels in a business system.
[0006] To achieve the above purpose, the present application proposes a relationship building method, which includes: Get the abstract syntax tree and bytecode file corresponding to the source code of the target service; Get data source information based on the abstract syntax tree; Based on the bytecode file, obtain the calling relationship between multiple target methods and multiple risk variables; The data source information, multiple target methods, and multiple risk variables are respectively used as nodes, and the edges between the corresponding nodes are generated based on the calling relationship between the data source information, multiple target methods, and multiple risk variables to obtain graph data.
[0007] In one embodiment, obtaining data source information based on an abstract syntax tree includes: The data source information is extracted from the abstract syntax tree through a preset query statement, wherein the data source information includes the type of data source, calling interface, description and data transmission object.
[0008] In some embodiments, based on the bytecode file, obtaining the calling relationship between multiple target methods and multiple risk variables includes: In the constant pool corresponding to the bytecode file, multiple bytecodes in the bytecode file are traversed to find the target method corresponding to each bytecode, as well as the input risk variable and the output risk variable corresponding to the target method, to obtain the calling relationship between the multiple target methods and the multiple risk variables.
[0009] In some embodiments, the method further comprises: In response to receiving the lineage query request, obtaining a query keyword and a query condition from the lineage query request, wherein the query keyword is one or more of a risk variable, a target method, and data source information; In a graph database, searching for first target graph data whose nodes contain a query keyword and satisfy a query condition, wherein the graph database includes multiple groups of graph data; Output the first target image data.
[0010] In some embodiments, the query conditions include a target phase; In a graph database, searching for first target graph data whose nodes contain the query keyword and satisfy the query condition includes: In the graph database, searching for intermediate target graph data containing the query keyword, the intermediate target graph data including a plurality of pre-divided stages; The portion of the intermediate target graph data that is at the target stage is used as the first target graph data.
[0011] In some embodiments, the method further comprises: In response to receiving the query impact request, obtaining a target node in the query impact request; In a graph database, searching for second target graph data containing a target node, wherein the graph database includes multiple groups of graph data; Based on the edges of the second target graph data, marking nodes in the second target graph data that have a direct call relationship with the target node; Output the second target map data.
[0012] In addition, to achieve the above purpose, the present application also proposes a relationship building device, which includes: The data acquisition module is used to obtain the abstract syntax tree and bytecode file corresponding to the source code of the target service; An information acquisition module, used to acquire data source information based on an abstract syntax tree; A call analysis module is used to obtain the call relationship between multiple target methods and multiple risk variables based on the bytecode file; The data association module is used to take data source information, multiple target methods and multiple risk variables as nodes, generate edges between corresponding nodes based on the calling relationship between the data source information, multiple target methods and multiple risk variables, and obtain graph data.
[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a relationship building device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the relationship building method described above.
[0014] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the relationship construction method described above are implemented.
[0015] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the relationship building method described above are implemented.
[0016] One or more technical solutions proposed in this application have at least the following technical effects: Each time a service is executed, the abstract syntax tree and bytecode are used to analyze the source data, methods, risk variables, etc. called in the service process, and the relationship between the nodes in the entire service process is established without affecting the original service system. The relationship is stored in the form of graph data, so that in the subsequent operation and maintenance process, if there is a need to modify one of the nodes, the corresponding graph data can be directly obtained, and all content related to the node can be obtained, so that developers can promptly know the impact of modifying the node on the entire service process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A schematic diagram of a process of establishing a relationship provided by an embodiment of the present application is shown; Figure 2 A flowchart of obtaining a call relationship provided by an exemplary embodiment of the present application is shown; Figure 3 A schematic diagram showing a flow chart of a relationship building method provided by another embodiment of the present application is shown; Figure 4 A schematic diagram of a query interface provided by an exemplary embodiment of the present application is shown; Figure 5 A schematic diagram of the structure of a relationship building device provided in an embodiment of the present application is shown; Figure 6 A schematic diagram of the structure of a relationship building device provided in an embodiment of the present application is shown.
[0020] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0022] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0023] The main solution of the embodiment of the present application is: obtain the abstract syntax tree and bytecode file corresponding to the source code of the target service; obtain data source information based on the abstract syntax tree; obtain the calling relationship between multiple target methods and multiple risk variables based on the bytecode file; use the data source information, multiple target methods and multiple risk variables as nodes respectively, generate edges between corresponding nodes based on the calling relationship between the data source information, multiple target methods and multiple risk variables, and obtain graph data.
[0024] In related technologies, as the market environment becomes increasingly complex, more and more risk factors need to be considered in loan review. Currently, a risk strategy service often needs to process thousands of risk variables, and then deploy corresponding risk strategies based on the risk variables. The processing logic of these risk variables depends on each other and has a clear correlation. In addition, the processing logic of risk variables changes frequently, and the correlation between variables is often affected. This makes it difficult for business and developers to assess the impact of adjustments to the risk variable processing logic, and it is also difficult to analyze the underlying data sources that the risk variables rely on.
[0025] Therefore, in related technologies, the communication and development process of new requirements often requires developers to manually sort out these contents, which is time-consuming and labor-intensive.
[0026] In summary, how to quickly obtain the relationship between various levels in the business system is a problem that needs to be solved urgently.
[0027] Based on this, the present application provides a solution, which uses an abstract syntax tree and bytecode to analyze the source data, methods, risk variables and other contents called in the service process each time the service is executed, and establishes the association relationship between the nodes in the entire service process without affecting the original service system; the association relationship is stored in the form of graph data, so that in the subsequent operation and maintenance process, if there is a need to modify one of the nodes, the corresponding graph data can be directly obtained, and all contents related to the node can be obtained, so that developers can promptly know the impact of modifying the node on the entire service process.
[0028] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a relationship building device capable of realizing the above functions, etc. The following takes the relationship building device as an example to illustrate this embodiment and the following embodiments.
[0029] Reference Figure 1 , Figure 1 The flowchart of the relationship building method provided by an embodiment of the present application is shown. The relationship building method can be applied to a relationship building device, and includes the following steps S110 to S140: Step S110, obtaining an abstract syntax tree and a bytecode file corresponding to the source code of the target service.
[0030] The target service refers to the service selected and executed by the user in the product operation process. In this application, the target service can be a risk strategy service, which is used to combine the customer's risk information, comprehensively evaluate the customer's risk level, and make a final decision on it.
[0031] Below, taking the risk strategy service as an example, the relationship building method provided in the embodiment of the present application is explained.
[0032] The relationship building device is connected to the risk strategy system in communication, and the risk strategy system can be connected to the database system in communication. The risk strategy system can include a request acceptance module, a risk processing module, and a decision acquisition module, and is used to execute risk strategy services; the database system is used to store basic information of users (customers), such as risk information required for risk assessment. Specifically, the process of the risk strategy system executing risk strategy services can include the following steps: In some embodiments, the request acceptance module is used to accept a request from a customer (for example, a loan request) and send the request to the risk processing module; The risk processing module is used to obtain the risk information corresponding to the customer through the database system after receiving the request, and to process the risk information into risk variables through a series of first preset algorithms and send them to the decision acquisition module.
[0033] After receiving the risk variables, the decision acquisition module analyzes the risk variables based on a series of second preset algorithms, thereby ultimately obtaining a decision conclusion.
[0034] The source code of the target service refers to the underlying source code of the entire risk strategy system. As mentioned earlier, the risk strategy system is a risk strategy service implemented through source code.
[0035] An abstract syntax tree is an abstract representation of the syntax structure of a source code. It represents the syntax structure of a programming language in a tree-like form, and each node on the tree represents a structure in the source code. An abstract syntax tree can help developers understand and manipulate code. It is widely used in compilers and interpreters to facilitate code analysis and conversion. By converting source code into an abstract syntax tree, the code structure can be standardized, and the specified syntax elements can be focused on to avoid misrecognition that may be caused by using regular expressions.
[0036] In some implementations, the source code can be converted into an abstract syntax tree through some open source static code analysis tools. For example, in some feasible embodiments, a Programming Mistake Detector (PMD) tool can be used to convert the source code. For example, the data source type, data source description, data transfer object (DTO) corresponding to the data source, and data source call interface in the source code are expanded in the form of an abstract syntax tree.
[0037] Bytecode refers to the instruction set for the Java virtual machine to run. After the Java file (file format is .java) is compiled by the Java language programming compiler (java compiler, javac), a bytecode file (file format is .class) will be generated for the virtual machine to use. The virtual machine then interprets and executes based on the bytecode file. The bytecode file contains the constant pool, method table, field table, attribute table and other contents.
[0038] Among them, the constant pool is used to store various literals and symbolic references generated during compilation, such as class, interface name, field name, method name, and string literal, etc. Among them, a class includes multiple methods.
[0039] The method table is used to describe the methods declared in a class or interface, including the method's access modifiers, name, descriptor (parameter types and return type), and attributes.
[0040] The property table contains additional information about classes, fields, and methods, such as source code file name, line number mapping, debugging information, etc.
[0041] The field table describes the variables declared in a class or interface, including the field's access modifiers, name, type, and properties.
[0042] Step S120: acquiring data source information based on the abstract syntax tree.
[0043] In some implementations, the data source information may be extracted from the abstract syntax tree by using a preset query statement, wherein the data source information includes the type of data source, a calling interface, a description, and a data transmission object.
[0044] The preset query statement can be an XML Path Language (Xpath). Based on the XML path statement, the data source information (static information) in the abstract syntax tree can be extracted. Specifically, in the annotation, the type and description of the data source can be extracted; in the generic type, the DTO corresponding to the data source can be extracted; in the member variable, the corresponding calling interface can be extracted.
[0045] Step S130, based on the bytecode file, obtaining the calling relationship between multiple target methods and multiple risk variables.
[0046] Based on the bytecode file in the target service, multiple bytecodes in the bytecode file can be extracted.
[0047] In some implementations, multiple bytecodes in a bytecode file can be traversed in a constant pool corresponding to the bytecode file to find a target method corresponding to each bytecode, as well as an input risk variable and an output risk variable corresponding to the target method, to obtain a calling relationship between multiple target methods and multiple risk variables.
[0048] Since the present embodiment focuses on the calling relationship between different methods and risk variables, in some embodiments, only the bytecode of the method calling class in the bytecode file may be extracted.
[0049] In some implementations, after obtaining the target method corresponding to the bytecode based on the constant pool, it can be determined whether the target method is an input or output of the target class based on whether the target method is a get method or a set method.
[0050] For example, Figure 2As shown, after the bytecode file is obtained, the bytecode is first obtained from the bytecode file. For each bytecode, determine whether the bytecode is the bytecode of the method call class. If it is not the bytecode of the method call class, skip the current bytecode directly. If it is the bytecode of the method call class, search the constant pool, obtain the specific method corresponding to the current bytecode, and determine whether the method is a get method or a set method. If it is a get method, the bytecode is determined as the input of the class corresponding to the current bytecode; if it is a set method, the bytecode is determined as the output of the class corresponding to the current bytecode.
[0051] Step S140 , taking the data source information, multiple target methods, and multiple risk variables as nodes respectively, generating edges between corresponding nodes based on the calling relationships among the data source information, multiple target methods, and multiple risk variables, and obtaining graph data.
[0052] Graph data is a data structure that uses nodes (vertices) and edges (connections) to represent entities and their relationships. In graph data, nodes represent entities and edges represent the relationships between entities.
[0053] After the aforementioned steps S110 to S130, the present embodiment has obtained the data source information, the target method called in the target service process, and the multiple risk variables used in the target service process. The data source information, multiple target methods, and multiple risk variables are respectively used as nodes, and the call relationships obtained in steps S120 and S130 are used as edges to establish a directed acyclic graph.
[0054] During the continuous execution of the target service, a directed acyclic graph is continuously established, thereby obtaining a graph database (such as a neo4j graph database). Based on the graph database, the corresponding graph data can be screened and the completed service call process can be traced back through the following steps S210 to S230 when only any node is known.
[0055] This embodiment provides a relationship building method. Each time a service is executed, the source data, methods, risk variables and other contents called in the service process are analyzed by using an abstract syntax tree and bytecode, and the association relationship between the nodes in the entire service process is established without affecting the original service system; the association relationship is stored in the form of graph data, so that in the subsequent operation and maintenance process, if there is a need to modify one of the nodes, the corresponding graph data can be directly obtained, and all contents related to the node can be obtained, so that developers can promptly know the impact of modifying the node on the entire service process.
[0056] In other embodiments, Figure 3As shown, the relationship building method may further include steps S210 to S230.
[0057] Step S210, in response to receiving the query request, obtaining the query target and the query condition.
[0058] Step S220, in the graph database, searching for corresponding target graph data according to the query target and the query condition.
[0059] Among them, the query request may include a blood relationship query request, a query impact request, etc.
[0060] For blood relationship query request①: For example, a lineage query request can be a user Figure 4 In the search results, click the title bar of blood relationship analysis, and enter the query information in any column such as process, middle layer variable, query layer number, etc., and then click query.
[0061] The relationship building device can obtain query keywords (i.e., intermediate layer variables) and query conditions (i.e., process stages, query layers, etc.) from the lineage query request. It can be understood that the query keywords are one or more of the risk variables, target methods, and data source information.
[0062] In some implementations, the process of the target service may be divided into multiple process stages in advance, that is, when the graph data is constructed, different process stages have been divided. The user may input the target stage to filter out the part of the graph data that is in the target stage.
[0063] Specifically, after receiving the blood vessel query request, the relationship building device may search for the intermediate target graph data containing the query keyword in the graph database; and use the portion of the intermediate target graph data that is in the target stage as the first target graph data.
[0064] It can be understood that the intermediate target graph data should be a complete graph data, and the first target graph data is an incomplete graph data.
[0065] In some embodiments, when the query conditions include the query layer number n, the intermediate target graph data can be first determined as described above, and then in the intermediate target graph data, based on the node corresponding to the query keyword, the n-layer nodes closest to the node are filtered out as the first target graph data.
[0066] For query impact request ②: In some embodiments, in response to receiving a query impact request, a target node in the query impact request can be obtained; in a graph database, second target graph data containing the target node is searched, and the graph database includes multiple groups of graph data; based on the edges of the second target graph data, nodes in the second target graph data that have a direct calling relationship with the target node are marked; and the second target graph data is output.
[0067] It is understandable that by querying the impact request, you can intuitively query the impact range when a certain node (or multiple nodes) are changed. The impact range can help developers determine whether a certain node needs to be modified, and help developers judge the consequences of the modification.
[0068] Step S230, outputting target graph data.
[0069] It can be understood that the relationship building method provided in the embodiment of the present application is generally to more clearly and intuitively reflect the relationship between the various parts of the entire service process. Therefore, in some embodiments, the first / second target graph data can be rendered in a directed acyclic graph so that it can be rendered as follows: Figure 5 The method shown is presented to the user.
[0070] In some implementations, the interface may also include options such as "View Processing Only" and "Simple Mode". The user can click "View Processing Only" to have the final DAG only retain the corresponding portion of the risk information processing and hide the other portions. The user can click "Simple Mode" to have the final DAG not display specific information but only include node names.
[0071] In more feasible implementations, developers can also design more filtering options based on the graph database according to actual needs, which is not limited in this embodiment.
[0072] This application also provides a relationship building device, please refer to Figure 5 , the relationship building device 100 includes: The data acquisition module 110 is used to obtain the abstract syntax tree and bytecode file corresponding to the source code of the target service; An information acquisition module 120, configured to acquire data source information based on the abstract syntax tree; A call analysis module 130, used to obtain a call relationship between multiple target methods and multiple risk variables based on the bytecode file; The data association module 140 is used to take the data source information, the multiple target methods and the multiple risk variables as nodes, generate edges between the corresponding nodes based on the calling relationship between the data source information, the multiple target methods and the multiple risk variables, and obtain graph data.
[0073] The relationship building device 100 provided in the present application adopts the relationship building method in the above embodiment, which can solve the technical problem of how to quickly obtain the association relationship between various levels in the business system. Compared with the prior art, the beneficial effects of the relationship building device 100 provided in the present application are the same as the beneficial effects of the relationship building method provided in the above embodiment, and the other technical features in the relationship building device 100 are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0074] The present application provides a relationship building device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the relationship building method in the above-mentioned embodiment one.
[0075] Reference below Figure 6 , which shows a schematic diagram of the structure of a relationship building device suitable for implementing the embodiment of the present application. The relationship building device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The relationship building device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0076] like Figure 6As shown, the relationship building device 200 may include a processing device 210 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 220 or a program loaded from a storage device 230 to a random access memory (RAM: Random Access Memory) 240. In RAM240, various programs and data required for the operation of the relationship building device are also stored. The processing device 210, ROM220 and RAM240 are connected to each other through a bus 250. An input / output (I / O) interface 260 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 260: an input device 270 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 280 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 230 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 290. The communication device 290 can allow the relationship building device to communicate with other devices wirelessly or wired to exchange data. Although the figure shows a relationship building device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.
[0077] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device, or installed from the storage device 230, or installed from the ROM 220. When the computer program is executed by the processing device 210, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0078] The relationship building device provided by the present application adopts the relationship building method in the above embodiment, which can solve the technical problem of how to quickly obtain the association relationship between various levels in the business system. Compared with the prior art, the beneficial effects of the relationship building device provided by the present application are the same as the beneficial effects of the relationship building method provided by the above embodiment, and the other technical features in the relationship building device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0079] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0080] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0081] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the relationship building method in the above-mentioned embodiment.
[0082] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0083] The computer-readable storage medium may be included in the relationship building device; or may exist independently without being assembled into the relationship building device.
[0084] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the relationship building device, the relationship building device can write computer program codes for performing the operations of the present application in one or more programming languages or a combination thereof. The programming languages include object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0085] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0087] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned relationship building method, and can solve the technical problem of how to quickly obtain the association relationship between various levels in the business system. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the relationship building method provided in the above-mentioned embodiment, and will not be repeated here.
[0088] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned relationship building method when executed by a processor.
[0089] The computer program product provided by this application can solve the technical problem of how to quickly obtain the association relationship between various levels in the business system. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the relationship building method provided in the above embodiment, which will not be repeated here.
[0090] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A relationship building method, characterized in that: The relationship building method comprises: Get the abstract syntax tree and bytecode file corresponding to the source code of the target service; Acquire data source information based on the abstract syntax tree; Based on the bytecode file, obtaining a calling relationship between multiple target methods and multiple risk variables; The data source information, the multiple target methods, and the multiple risk variables are respectively used as nodes, and edges between the corresponding nodes are generated based on the calling relationships among the data source information, the multiple target methods, and the multiple risk variables to obtain graph data.
2. The relationship building method according to claim 1, characterized in that: The acquiring data source information based on the abstract syntax tree includes: The data source information is extracted from the abstract syntax tree through a preset query statement, wherein the data source information includes the type, calling interface, description and data transmission object of the data source.
3. The relationship building method according to claim 1, characterized in that: The obtaining, based on the bytecode file, a calling relationship between a plurality of target methods and a plurality of risk variables comprises: In the constant pool corresponding to the bytecode file, multiple bytecodes in the bytecode file are traversed to find the target method corresponding to each bytecode and the input risk variable and output risk variable corresponding to the target method, so as to obtain the calling relationship between the multiple target methods and the multiple risk variables.
4. The relationship building method according to claim 1, characterized in that: The method further comprises: In response to receiving a lineage query request, obtaining a query keyword and a query condition from the lineage query request, wherein the query keyword is one or more of a risk variable, a target method, and data source information; In a graph database, searching for first target graph data whose nodes contain the query keyword and satisfy the query condition, wherein the graph database includes multiple groups of graph data; The first target map data is output.
5. The relationship building method according to claim 4, characterized in that: The query conditions include a target stage; The step of searching, in the graph database, for first target graph data whose nodes contain the query keyword and satisfy the query condition comprises: In a graph database, searching for intermediate target graph data containing the query keyword, wherein the intermediate target graph data includes a plurality of pre-divided stages; The portion of the intermediate target graph data that is in the target stage is used as the first target graph data.
6. The relationship building method according to claim 1, characterized in that: The method further comprises: In response to receiving the query impact request, obtaining a target node in the query impact request; Searching for second target graph data containing the target node in a graph database, wherein the graph database includes multiple groups of graph data; Based on the edges of the second target graph data, marking nodes in the second target graph data that have a direct call relationship with the target node; The second target image data is output.
7. A relationship building device, characterized in that: The relationship building device comprises: The data acquisition module is used to obtain the abstract syntax tree and bytecode file corresponding to the source code of the target service; An information acquisition module, used to acquire data source information based on the abstract syntax tree; A call analysis module, used for obtaining the call relationship between multiple target methods and multiple risk variables based on the bytecode file; A data association module is used to take the data source information, the multiple target methods and the multiple risk variables as nodes, generate edges corresponding to the nodes based on the calling relationship between the data source information, the multiple target methods and the multiple risk variables, and obtain graph data.
8. A relationship building device, characterized in that: The relationship building device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the relationship building method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the relationship building method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the relationship building method according to any one of claims 1 to 6 are implemented.