CN-121979512-A - Intelligent audit reasoning code generation method and system based on knowledge graph and templated mapping, electronic equipment and computer readable storage medium
Abstract
The invention belongs to the crossing field of artificial intelligence and software engineering, and discloses an intelligent audit reasoning code generation method and system based on knowledge graph and templatization mapping. The method comprises the steps of firstly constructing a knowledge graph of the monitoring auditing field comprising rules, cases, entities, risk nodes and association relations thereof, secondly analyzing various nodes in the graph into standardized logical element tuples through a predefined node mapping rule set, calling corresponding preset Python code templates according to node types to generate point execution functions, meanwhile, generating control codes describing inter-node reasoning logic based on the predefined relation mapping rules, and finally, dynamically polymerizing the relative node point functions and the control codes into an executable complete auditing reasoning program according to the dependency relations among the nodes from a target entity node by utilizing an automatic graph traversal-based reasoning chain assembly algorithm. The invention obviously improves the intelligent level and response speed of the audit supervision work.
Inventors
- LIN SHANDONG
- WU SHAOHUA
- LIN XIAODONG
- LIN WENKAI
- SONG ZHENGCHEN
Assignees
- 厦门美亚亿安信息科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260408
Claims (10)
- 1. The intelligent audit reasoning code generation method based on the knowledge graph and the templatization mapping is characterized by comprising the following steps: step 1, constructing a knowledge graph in the field of audit, wherein the knowledge graph comprises rule nodes, case nodes, entity nodes, risk nodes and association relations among the nodes; Step 2, based on a predefined node mapping rule set, analyzing various nodes in the knowledge graph into standardized logic element tuples, and calling a corresponding preset Python code template according to the node type to generate a node execution function; Step 3, based on a predefined relation mapping rule, generating a control code for describing inter-node reasoning logic, wherein the control code comprises an entity level control module corresponding to entity nodes and a global level control module for coordinating a plurality of entity level control modules; And 4, adopting an automatic assembly algorithm of an inference chain based on graph traversal, starting from a target entity node, and dynamically aggregating the node execution function and the control code according to the dependency relationship among nodes in the knowledge graph to generate an executable complete audit inference program.
- 2. The intelligent audit reasoning code generation method based on the knowledge graph and the templated mapping according to claim 1, wherein the association relationship in the knowledge graph at least comprises five types of special relationships, namely an entity-rule association relationship, a rule-risk association relationship, an entity-risk association relationship, a rule-rule association relationship and a case-rule association relationship.
- 3. The intelligent audit reasoning code generation method based on knowledge graph and templatization mapping according to claim 1, wherein the step 1 is specifically: step 1.1, constructing rules according to a predefined meta model, and defining a meta model of a knowledge graph; Step 1.2, using the meta model as an extraction template, and using a natural language processing NLP technology to identify and extract specific nodes and association relations from various data sources; Step 1.3, cleaning, aligning, merging and checking the results extracted in the step 1.2 by taking the meta model as a fusion reference to obtain fused nodes and relations so as to ensure the consistency and normalization of the knowledge graph; And 1.4, storing the nodes and the relations fused in the step 1.3 into a graph database according to the semantics defined by the meta-model to form a final knowledge graph.
- 4. The intelligent audit reasoning code generation method based on the knowledge graph and the templated mapping according to claim 3, wherein the meta model specifies the node types, the node attributes, the association relations among the nodes and the semantic constraints allowed to appear in the knowledge graph.
- 5. The intelligent audit reasoning code generation method based on knowledge graph and templatization mapping according to claim 1, wherein the step 2 is specifically: The method comprises the steps of 2.1, predefining a mapping rule set of five types of nodes facing to the auditing field, wherein the mapping rule set comprises mapping rules aiming at rule nodes, risk nodes, entity nodes and case nodes; Step 2.2, reading the node to be processed from the knowledge graph, identifying the node type of the node to be processed, and matching the corresponding mapping rule from the mapping rule set according to the node type; analyzing the attributes of the nodes according to the attribute extraction rules and the logic element generation rules defined in the matched mapping rules to generate standardized logic element tuples, wherein the standardized logic element tuples comprise node type fields, node identification fields, function name fields, node description fields, analyzed logic element fields and metadata fields; Step 2.4, selecting a corresponding code template from a preset template library according to the node type and the template identification in the mapping rule; filling the generated logical element tuples into corresponding placeholders of the selected code templates to generate complete node execution function codes; and 2.6, carrying out grammar verification on the generated function codes, and registering the generated function codes into a global function library after verification is passed to form callable node execution functions.
- 6. The intelligent audit reasoning code generation method based on knowledge graph and templatization mapping according to claim 5, wherein the step 3 is specifically: A mapping rule set facing to the special relation of the auditing field is predefined, and each mapping rule defines an applicable relation type, a source node type constraint, a target node type constraint, a control code semantic and a corresponding code generation template identifier; step 3.2, extracting various relation edges from the knowledge graph according to the mapping rule set, and classifying and aggregating according to the source nodes to form a relation set taking the source nodes as units; Step 3.3, selecting a corresponding preset control code generation template according to the relation type of each relation set, filling the aggregated relation data into the template, and generating a control code segment taking a source node as a unit; step 3.4, integrating and packaging the generated control code segments, generating an entity-level control module for each entity node, integrating all the control code segments of the entity serving as the source node into a whole by the entity-level control module, and providing calling to the outside through a unified execution interface; And 3.5, generating a global level control module for the whole reasoning process, and integrating all entity level control modules into a unified control system, wherein the global level control module comprises a dependency relationship control code among entities and a main execution function framework.
- 7. The intelligent audit reasoning code generation method based on knowledge graph and templatization mapping according to claim 6, wherein the step 4 is specifically: Step 4.1, traversing a knowledge graph according to a predefined relation type traversing strategy by taking a target entity node as a starting point, and determining a module range needing to be activated, wherein the module range comprises an entity-level control module needing to be activated from a pre-generated control module library, and a rule node executing function and a risk node executing function needing to be imported from a node executing function library; Step 4.2, according to the determined module range, carrying out dependency analysis on rule nodes and risk nodes to be imported, constructing a dependency graph according to call dependencies among the nodes, and determining a hierarchical execution sequence of the nodes by adopting topological ordering, wherein entity nodes are executed firstly as reasoning starting points, the rule nodes are executed after the entity nodes, and the risk nodes are executed after the rule nodes triggering the rule nodes; Step 4.3, importing entity-level control modules corresponding to entity nodes from a pre-generated control module library, and importing node execution functions corresponding to rule nodes and risk nodes from a node execution function library; step 4.4, dynamically binding the imported entity-level control module with the node execution function according to the hierarchical execution sequence, and assembling an executable reasoning program for a target entity based on a pre-generated global control module frame; And 4.5, executing the reasoning program, generating a result output interface, and formatting the reasoning result into structural output.
- 8. An intelligent audit reasoning code generation system based on knowledge graph and templated mapping is characterized in that the system executes the intelligent audit reasoning code generation method based on knowledge graph and templated mapping according to any one of claims 1-7, the system comprises a knowledge graph construction module, a templated mapping module, a control code generation module and a reasoning chain assembly module, The knowledge graph construction module is used for constructing a knowledge graph of the monitoring audit field, wherein the knowledge graph comprises rule nodes, case nodes, entity nodes and risk nodes, and the association relation among the nodes; The templatization mapping module is used for analyzing the nodes in the knowledge graph into logical element tuples based on a predefined node mapping rule set, and calling a corresponding preset Python code template to generate a node execution function; a control code generation module for generating a control code describing inter-node inference logic based on a predefined relationship mapping rule, the control code including an entity level control module corresponding to an entity node and a global level control module coordinating a plurality of entity level control modules; and the inference chain assembly module is used for dynamically aggregating the node execution function and the control code according to the dependency relationship among the nodes in the knowledge graph from the target entity node by adopting an automatic inference chain assembly algorithm based on graph traversal, so as to generate an executable complete audit inference program.
- 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, characterized in that the processor implements the method of any of claims 1 to 7 when executing the computer program.
- 10. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor of an electronic device, causes the electronic device to perform the method of any of the preceding claims 1 to 7.
Description
Intelligent audit reasoning code generation method and system based on knowledge graph and templated mapping, electronic equipment and computer readable storage medium Technical Field The invention belongs to the crossing field of artificial intelligence and software engineering, and particularly relates to an intelligent audit reasoning code generation method and system based on knowledge graph and templatization mapping, electronic equipment and a computer readable storage medium, which are used for realizing automatic conversion from the field knowledge to an executable audit reasoning program. Background Along with the increasingly strict supervision requirements of various industries, the supervision and audit work plays a vital role in the aspects of risk prevention and control, compliance examination and the like. Traditional audit mainly relies on manual review of rules, rules and historical cases, and reasoning judgment is performed by combining expert experience. However, with the complexity of the regulatory system and the explosive growth of the business data, the traditional manual mode faces the problems of low efficiency, non-uniform standards, difficult knowledge inheritance and the like. In order to improve the intelligence level of the audit, knowledge graph technology is introduced into the field in recent years for structurally storing rules, cases, entities and association relations thereof. However, most of existing knowledge graph-based auditing applications stay at the knowledge retrieval and visual display level, users still need to manually read the relationship in the graph and judge by combining with own experience, and direct driving from knowledge to decision logic cannot be realized. In other words, the knowledge graph is used only as a static knowledge base, lacking the ability to dynamically translate the nodes and relationships in the graph into executable inference code. On the other hand, if the traditional manual coding mode is adopted to develop the audit reasoning program, the development period is long, the maintenance cost is high, the code styles and logic structure differences written by different auditors are large, and the consistency and reliability of the codes are difficult to ensure. In addition, the manual coding mode is difficult to respond to changes in time in the face of continuous updating of business rules and dynamic adjustment of supervision requirements, so that the adaptability and flexibility of an auditing system are insufficient. Therefore, how to automatically generate audit reasoning codes from a static audit knowledge graph to a dynamic, reliable and maintainable audit knowledge graph becomes a technical problem to be solved in the field. Disclosure of Invention The invention aims to overcome the defects of the prior art, and provides an intelligent audit reasoning code generation method and system based on knowledge graph and templated mapping, electronic equipment and a computer readable storage medium, so as to solve the problems from static audit knowledge graph to automatic generation of dynamic, reliable and maintainable audit reasoning codes. The invention provides an intelligent audit reasoning code generation method based on knowledge graph and templatization mapping, which comprises the following steps: step 1, constructing a knowledge graph in the field of audit, wherein the knowledge graph comprises rule nodes, case nodes, entity nodes, risk nodes and association relations among the nodes; Step 2, based on a predefined node mapping rule set, analyzing various nodes in the knowledge graph into standardized logic element tuples, and calling a corresponding preset Python code template according to the node type to generate a node execution function; Step 3, based on a predefined relation mapping rule, generating a control code for describing inter-node reasoning logic, wherein the control code comprises an entity level control module corresponding to entity nodes and a global level control module for coordinating a plurality of entity level control modules; And 4, adopting an automatic assembly algorithm of an inference chain based on graph traversal, starting from a target entity node, and dynamically aggregating the node execution function and the control code according to the dependency relationship among nodes in the knowledge graph to generate an executable complete audit inference program. The intelligent audit reasoning code generation method based on the knowledge graph and the templated mapping at least comprises the following five special relations, namely an entity-rule association relation, a rule-risk association relation, an entity-risk association relation, a rule-rule association relation and a case-rule association relation. The intelligent audit reasoning code generation method based on the knowledge graph and the templatization mapping comprises the following steps: step 1.1, constructing rules according to a prede