Metadata structure analysis method and device, equipment, medium and product
By receiving and segmenting user natural language requests in the ERP system, searching and encapsulating metadata database field information, generating and processing structured data packets, the problem of high expression error rate in the ERP system was solved, enabling more efficient ERP system development and operation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-03-27
AI Technical Summary
In enterprise application systems, due to the complexity of ERP business, the expression generated by the system after receiving the user's natural language requirements has a high error rate, which affects the efficient and stable operation of the system.
By receiving natural language business requirements input by users, word segmentation is performed, the corresponding field information in the metadata database of the ERP system is found, encapsulated into a structured data packet, and sent to a preset large language model for processing to generate the target business logic execution code, including correction and legality determination.
It reduces the error rate of the generated target business logic execution code, improves the development efficiency of the ERP system, reduces the requirements for users' professional knowledge, and enhances the ability of the large language model to understand the metadata of the ERP system.
Smart Images

Figure CN121745083A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a metadata structure analysis method and device, equipment, medium and product. BACKGROUND
[0002] In an enterprise application system, due to the complexity of ERP (Enterprise Resource Planning) business, there are many complex services in the system. Different services need to be executed under different expressions, and the implementation of the expression depends on the metadata of the ERP itself, and the accuracy and rationality of the expression directly affect whether the ERP system can run efficiently and stably.
[0003] In related technologies, after receiving the original requirement information of the user, i.e., the natural language requirement, the system directly sends the original requirement information to a large model for processing, and then returns the processing result to the user. However, this easily leads to a high error rate of the generated expression. SUMMARY
[0004] Therefore, it is necessary to provide a metadata structure analysis method, device, computer equipment, computer readable storage medium and computer program product to solve the above technical problems.
[0005] In a first aspect, the present application provides a metadata structure analysis method, which comprises:
[0006] receiving a natural language business requirement input by a user, and performing word segmentation processing on the natural language business requirement to obtain at least one keyword;
[0007] finding field information corresponding to each keyword in a metadata database of an ERP system, and encapsulating each field information to obtain a structured data package corresponding to the natural language business requirement;
[0008] sending the structured data package to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement.
[0009] In one of the embodiments, the word segmentation processing on the natural language business requirement comprises:
[0010] obtaining a system environment state when the natural language business requirement is received; the system environment state comprises a context parameter;
[0011] performing word segmentation processing on the natural language business requirement based on the context parameter.
[0012] In one of the embodiments, the encapsulation of each field information to obtain the structured data package corresponding to the natural language business requirement comprises:
[0013] In the case where there is no field corresponding to the preset function syntax rule in the field information, each field information is encapsulated to obtain a structured data packet corresponding to the natural language business requirement.
[0014] In the case where there is a field corresponding to the preset function syntax rule in the field information, each field information and the preset function syntax rule are encapsulated to obtain a structured data packet corresponding to the natural language business requirement.
[0015] In one of the embodiments, the structured data packet is sent to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement, including:
[0016] The structured data packet is sent to a preset large language model for processing to obtain an initial business logic execution code.
[0017] According to a preset correction strategy, the initial business logic execution code is corrected to obtain a corrected business logic execution code.
[0018] According to a preset legality determination rule, the corrected business logic execution code is determined for legality, in the case where the corrected business logic execution code is legal, the corrected business logic execution code is determined as the target business logic execution code; in the case where the corrected business logic execution code is illegal, a first alarm information is issued.
[0019] In one of the embodiments, according to a preset legality determination rule, the corrected business logic execution code is determined for legality, including:
[0020] Based on the corrected business logic execution code, a plurality of test cases and their corresponding preset running results are generated.
[0021] The test cases are run to obtain test results, in the case where each test result is consistent with the corresponding preset running result, the corrected business logic execution code is determined to be legal.
[0022] In one of the embodiments, based on the corrected business logic execution code, a plurality of test cases and their corresponding preset running results are generated, including:
[0023] According to a preset safety detection rule, the corrected business logic execution code is detected for safety to obtain a detection result.
[0024] In the case where the detection result is safe, based on the corrected business logic execution code, a plurality of test cases and their corresponding preset running results are generated; in the case where the detection result is dangerous, a second alarm information is issued.
[0025] In a second aspect, the present application also provides a metadata structure parsing device, which comprises:
[0026] The business requirement processing module is configured to receive a natural language business requirement input by a user and perform word segmentation processing on the natural language business requirement to obtain at least one keyword.
[0027] The data packet generation module is configured to search for field information corresponding to each keyword in a metadata database of an ERP system and encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement.
[0028] The execution code generation module is configured to send the structured data packet to a preset large language model for processing to obtain target business logic execution code corresponding to the natural language business requirement.
[0029] In a third aspect, the present application also provides a computer device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0030] The business requirement processing module is configured to receive a natural language business requirement input by a user and perform word segmentation processing on the natural language business requirement to obtain at least one keyword.
[0031] The data packet generation module is configured to search for field information corresponding to each keyword in a metadata database of an ERP system and encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement.
[0032] The execution code generation module is configured to send the structured data packet to a preset large language model for processing to obtain target business logic execution code corresponding to the natural language business requirement.
[0033] In a fourth aspect, the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the following steps:
[0034] The business requirement processing module is configured to receive a natural language business requirement input by a user and perform word segmentation processing on the natural language business requirement to obtain at least one keyword.
[0035] The data packet generation module is configured to search for field information corresponding to each keyword in a metadata database of an ERP system and encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement.
[0036] The execution code generation module is configured to send the structured data packet to a preset large language model for processing to obtain target business logic execution code corresponding to the natural language business requirement.
[0037] In a fifth aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, implements the following steps:
[0038] receiving a natural language business requirement input by a user, and performing word segmentation processing on the natural language business requirement to obtain at least one keyword;
[0039] finding field information corresponding to each keyword in a metadata database of an ERP system, and encapsulating each field information to obtain a structured data package corresponding to the natural language business requirement;
[0040] sending the structured data package to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement.
[0041] The above metadata structure analysis method, device, equipment, medium and product first receive a natural language business requirement input by a user, and perform word segmentation processing on the natural language business requirement to obtain at least one keyword; then find field information corresponding to each keyword in a metadata database of an ERP system, and encapsulate each field information to obtain a structured data package corresponding to the natural language business requirement; finally, send the structured data package to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement; in this way, the natural language requirement can be associated with the metadata of the ERP system, and the scattered field information can be organized into structured data, thereby helping to improve the understanding ability of the preset large language model for the metadata of the ERP system, and helping to provide accurate input for the preset large language model, thereby being able to reduce the error rate of the generated target business logic execution code; in addition, the requirement for professional knowledge of the user can also be reduced, the user only needs to describe the requirement in natural language, and the system can automatically generate the target business logic execution code, thereby helping to improve the development efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0042] Figure 1 a flowchart of a metadata structure analysis method provided for some embodiments of the present application;
[0043] Figure 2 a flowchart of word segmentation processing on a business requirement provided for some embodiments of the present application;
[0044] Figure 3 a flowchart of obtaining a structured data package provided for some embodiments of the present application;
[0045] Figure 4 a flowchart of determining a target business logic execution code provided for some embodiments of the present application;
[0046] Figure 5A flowchart for determining the legality of the corrected business logic execution code is provided for some embodiments of the present application.
[0047] Figure 6 A flowchart for generating test cases is provided for some embodiments of the present application.
[0048] Figure 7 A structural block diagram of a metadata structure parsing apparatus is provided for some embodiments of the present application.
[0049] Figure 8 An internal structural diagram of a computer device is provided for some embodiments of the present application. DETAILED DESCRIPTION
[0050] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not used to limit the present application.
[0051] The metadata structure parsing method provided by the embodiments of the present application can be applied to a terminal loading an ERP system, and the terminal also loads a preset large language model. When the ERP system receives a natural language business requirement input by a user, the natural language business requirement can be first processed for word segmentation to obtain at least one keyword. Then, in the metadata database of the ERP system, field information corresponding to each keyword is searched for, and each field information is encapsulated to obtain a structured data packet corresponding to the natural language business requirement. Finally, the structured data packet is sent to the preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement. In this way, the natural language requirement can be associated with the metadata of the ERP system, and the scattered field information can be organized into structured data, thereby helping to improve the understanding ability of the preset large language model for the metadata of the ERP system and helping to provide accurate input for the preset large language model, so as to reduce the error rate of the generated target business logic execution code. In addition, the requirement for professional knowledge of the user can also be reduced, and the user only needs to describe the requirement in natural language, and the system can automatically generate the target business logic execution code, thereby helping to improve the development efficiency.
[0052] In one embodiment, as shown in Figure 1 the method is applied to the terminal described above. In this embodiment, the method includes the following steps:
[0053] In step 102, a natural language business requirement input by a user is received, and the natural language business requirement is processed for word segmentation to obtain at least one keyword.
[0054] The natural language business requirement input by the user is a requirement for a business operation or processing of the ERP system described in daily natural language by the user. The word segmentation processing is a process of splitting the natural language business requirement into independent words or phrases according to semantic and grammatical rules. The word segmentation processing can use a word segmentation algorithm in natural language processing (NLP) technology, such as rule-based word segmentation, statistical-based word segmentation, and the like. The keywords are words or phrases extracted from the natural language business requirement and important to the core semantics of the requirement.
[0055] For example, assuming that the natural language business requirement input by the user is “find goods with inventory quantity less than 50 pieces”, the keywords obtained after the word segmentation processing can include “find”, “inventory quantity”, “less than”, “50 pieces”, and “goods”.
[0056] Optionally, the NLP word segmentation tool can be used to perform the word segmentation processing on the natural language business requirement input by the user to obtain at least one keyword.
[0057] In step 104, the field information corresponding to each keyword is found in the meta database of the ERP system, and each field information is encapsulated to obtain a structured data package corresponding to the natural language business requirement.
[0058] The meta database of the ERP system is a database storing all the metadata in the ERP system. The metadata is information describing the structure, meaning, relationship, and the like of various business data in the ERP system. The field information is detailed information about the business data stored in the ERP system meta database corresponding to the keyword.
[0059] The field information can include a business field identifier, field attributes, enumeration values, and a hierarchical relationship between fields. The business field identifier is used to uniquely identify the name or code of a business field, for example, “FOrderID” represents the number of a sales order. The field attributes are used to describe the characteristics of the field, such as data type (integer, string, date, and the like), length, and precision, and the like, for example, the data type of “FOrderAmount” (order amount) can be a numerical value, the length is 10 bits, and the precision is 2 bits. For some fields, the value can only be selected from a pre-defined limited set, and the values in this set are enumeration values. For example, the enumeration values of “FOrderStatus” (order status) can be “ordered”, “shipped”, “completed”, and the like. The hierarchical relationship between fields is used to describe the hierarchical structure and association relationship between different fields. For example, in a bill of materials, there is a hierarchical relationship between the “parent material” and “child material” fields.
[0060] The structured data packet is a data packet formed by encapsulating the found field information in a certain format. It can use formats such as JSON and XML to organize scattered field information into a unified, easy-to-transmit and process data structure, providing clear and accurate input for subsequent preset large language model processing.
[0061] Optionally, SQL queries can be performed in the metadata database to find corresponding field information based on keywords, and programming languages such as Python can be used to encapsulate field information into JSON or XML format data packets.
[0062] Step 106, send the structured data packet to the preset large language model for processing to obtain the target business logic execution code corresponding to the natural language business requirement.
[0063] The preset large language model is a pre-trained model with strong language understanding and generation capabilities. The preset large language model is used to receive structured data packets and generate target business logic execution code that meets requirements based on field information and business requirements.
[0064] The target business logic execution code is generated by the preset large language model based on the structured data packet and is used to execute specific business logic in the ERP system. The target business logic execution code can be any of the ERP system conditional expressions, SQL query statements, or scripts for automated testing. ERP system conditional expressions are expressions used to define business rules and conditions in the ERP system, such as "FOrderAmount>100000 AND FOrderDate>=‘2024-01-01’ AND FOrderDate<=‘2024-01-31’", which is used to filter sales orders with sales exceeding 100,000 yuan in January 2024. SQL query statements are used to query data that meets specific conditions from the database, for example, "SELECT * FROMSalesOrders WHERE OrderAmount>100000 AND OrderDate BETWEEN‘2024-01-01’ AND‘2024-01-31’", which is also used to filter sales orders with sales exceeding 100,000 yuan in January 2024. Scripts for automated testing are scripts used to automate testing of ERP system functions. For example, a Python script simulates user login, order creation, order modification, and other operations in the ERP system and verifies whether the system response meets expectations.
[0065] Optionally, the structured data packet can be sent to the preset large language model through an API interface, and the target business logic execution code returned by the large language model is received.
[0066] For example, the user's natural language business requirement is: "the document type is standard purchase application list, and the acceptance mode is amount acceptance". If this requirement is directly sent to the preset large language model for processing in the traditional way, the preset large language model cannot be normally parsed, because the preset large language model cannot know what the document type represents, and cannot know what the standard purchase list is, so the preset large language model cannot generate a correct expression. In the embodiment, after obtaining the natural language business requirement, the word segmentation processing is performed first to obtain the keywords such as "document type", "standard purchase application list", "acceptance mode", and "amount acceptance". Then, the metadata existing in the ERP itself is combined to further know that "document type" (the field Key is FBillTypeID) and "amount acceptance" (the field Key is FACCTYPE) are both fields, and "standard purchase application list" (the enumeration value obtained by parsing is '93591469feb54ca2b08eb635f8b79de3') and "amount acceptance" (the enumeration value obtained by parsing is 'A') are respectively the enumeration names of the fields. Then, the parsed field information is assembled into a JSON format data packet, which is sent to the preset large language model. The preset large language model can finally correctly return the expression result: (FBillTypeID == '93591469feb54ca2b08eb635f8b79de3') AND (FACCTYPE=='A'), which meets the expression requirement of the ERP.
[0067] In the above metadata structure parsing method, the natural language business requirement input by the user is received first, and the natural language business requirement is subjected to word segmentation processing to obtain at least one keyword. Then, the field information corresponding to each keyword is searched in the metadata database of the ERP system, and each field information is encapsulated to obtain a structured data packet corresponding to the natural language business requirement. Finally, the structured data packet is sent to the preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement. In this way, the natural language requirement can be associated with the metadata of the ERP system, and the dispersed field information can be organized into a structured data, thereby helping to improve the understanding ability of the preset large language model for the metadata of the ERP system, and helping to provide accurate input for the preset large language model, so as to reduce the error rate of the generated target business logic execution code. In addition, the requirement for the user's professional knowledge can be reduced, the user only needs to describe the requirement in natural language, and the system can automatically generate the target business logic execution code, which helps to improve the development efficiency.
[0068] In an embodiment, in order to improve the resolution accuracy and resolution efficiency, further, as shown in Figure 2 the natural language business requirement is subjected to word segmentation processing, including:
[0069] In step 202, the system environment state when receiving the natural language business requirement is acquired.
[0070] The system environment state can be a collection of the overall running state and related information of the ERP system when receiving the natural language business requirement, for reflecting the current business scenario, operation background and various related conditions of the system, and can provide necessary environmental information for accurately understanding and processing the natural language requirement of the user. The system environment state includes context parameters, and can also include current login user information (user role and department to which the user belongs, etc.), current operation business module (such as procurement management, sales management, etc.), current time information, system configuration information (such as data display format and business rule setting, etc.). Among them, the context parameters are specific parameters in the system environment state closely related to the current business requirement, which can clearly indicate the specific context scenario of the business requirement, so as to help the system more accurately resolve the natural language business requirement. For example, in the ERP system, the context parameters can include the current processing document type (such as purchase order, sales invoice, etc.), specific business process stage (such as purchase application stage, purchase approval stage, etc.), business data range (such as data of a certain time period, data of a certain department, etc.).
[0071] Optionally, the system will automatically record various operations and state information in the log file during operation, and a program can be written to read these log files and extract the system environment state information related to the current business requirement from them, including context parameters, for example, recording user login information, current operation business module and operation time, etc.
[0072] In step 204, the natural language business requirement is subjected to word segmentation processing based on the context parameters.
[0073] Optionally, a series of word segmentation rules can be defined according to the context parameters, for example, if the context parameters indicate that the current business scenario is "purchase order", then for the "order" related words involved in the natural language business requirement, word segmentation can be performed according to the business logic of the purchase order. Specifically, regular expressions or custom rule engines can be used to implement this. In addition, a word segmentation model based on machine learning can also be trained, taking the context parameters as part of the input features, for example, using a deep learning model (such as Long Short-Term Memory, LSTM), inputting the context parameters and the natural language business requirement into the model together, so as to make the model output the word segmentation result.
[0074] In this embodiment, by introducing the context parameter, additional semantic information can be provided for the word segmentation processing, so as to help the system more accurately understand the meaning and boundary of the words in the natural language business requirement, that is, to help determine the business scenario and search range, so that the system does not need to try all possible word combinations, but performs word segmentation according to the context parameter, thereby improving the accuracy and efficiency of the analysis.
[0075] In one embodiment, as shown in FIG. 3, the field information is encapsulated to obtain a structured data packet corresponding to the natural language business requirement, including: Figure 3
[0076] Step 302, in the case where there is no field corresponding to the preset function syntax rule in the field information, the field information is encapsulated to obtain a structured data packet corresponding to the natural language business requirement.
[0077] The preset function syntax rule is a rule extracted from an IronPython script engine, including a date processing function, a string operation function, a mathematical operation function, and a set operation function.
[0078] Optionally, when encapsulating the field information without the preset function syntax rule, a suitable data structure can be designed to accommodate each field information, such as a hierarchical structure, which is organized according to the logical relationship between each field information. For example, if the business requirement is to process an employee information, the data structure can include employee basic information (name, age, etc.) and work information (department and position, etc.). Then, each field information is arranged and filled according to the determined data structure, and encapsulated into a structured data packet in JSON format.
[0079] Step 304, in the case where there is a field corresponding to the preset function syntax rule in the field information, the field information and the preset function syntax rule are encapsulated to obtain a structured data packet corresponding to the natural language business requirement.
[0080] Optionally, when it is identified that there is a field corresponding to the preset function syntax rule, the field and the preset function syntax rule are integrated into the data structure determined before, and encapsulated into a structured data packet in JSON format.
[0081] For example, when the obtained natural language business requirement is "read the entry line containing the material name and fill the sum of the application quantity field into the remarks field", we can first perform word segmentation to obtain keywords such as "material", "name", "contains", "memory", "entry line", "application quantity", and "remarks". Then, combined with ERP metadata parsing, we can obtain fields such as "material" (field key is FMaterialId, which has a name attribute of "FName"), application quantity (field key is FReqQty), remarks (field key is FNote), and entry line (document body key is FENTITY). Since there is a summation operation, the sum function is needed. Finally, we combine this information into a JSON format data packet and send it to the preset large language model. The preset large language model then returns the specific expression: FNote=sum(map(lambdax:(x.FReqQty if(x.FMaterialId <> null and x.FMaterialId.FName.find('memory')!=-1) else 0), FENTITY)).
[0082] In this embodiment, when there is no field corresponding to the preset function syntax rule in the field information, the purpose of encapsulating the field information is to transform the natural language business requirements into a structured and easy-to-process data form. When there is a field corresponding to the preset function syntax rule, encapsulating the field information and the preset function syntax rule is to preserve the complex logic in the business requirements. However, whether it is simple field information or information containing complex function rules, it can be stored and processed in a unified way, thereby reducing the system's processing time and resource consumption. Moreover, the system can directly operate on the structured data without having to re-parse the natural language each time.
[0083] In one embodiment, due to limitations or misunderstandings in the training data of the preset large language model, the generated business logic execution code may have shortcomings in terms of style, performance, and security. To make the final target business logic execution code more standardized, efficient, and secure, further, such as... Figure 4 As shown, the structured data packets are sent to a pre-defined large language model for processing to obtain the target business logic execution code corresponding to the natural language business requirements, including:
[0084] Step 402: The structured data packet is sent to the preset large language model for processing to obtain the initial business logic execution code.
[0085] The initial business logic execution code is the business logic execution code initially generated by the preset large language model based on the structured data packets.
[0086] Optionally, if the preset large language model requires the input data to be in JSON format, the data packet is first converted into a standard JSON string; then the structured data packet is sent as input to the preset large language model using the API interface provided by the preset large language model. During the interface call process, identity verification, setting of request parameters, and other operations are required; finally, the result returned by the preset large language model is received, which is the initial business logic execution code.
[0087] Step 404, according to the preset correction strategy, the initial business logic execution code is corrected to obtain the corrected business logic execution code.
[0088] Among them, the preset correction strategy can be a series of rules, such as code style specifications, specific syntax rules, etc.
[0089] Optionally, the initial business logic execution code can be checked line by line or section by section to match the above rules and find out the parts that do not meet the rules. For the parts that do not meet the rules, they are replaced or modified according to the correction strategy. For example, if there are non-standard variable names in the code, modify them according to the naming specification; if the code uses outdated functions, replace them with new functions. In this way, the correction of the initial business logic execution code can be realized. For example, the business logic execution code should use "Date" to represent the date, but the initial business logic execution code contains Chinese "date", which needs to be corrected to "Date".
[0090] Step 406, according to the preset legality determination rule, the legality of the corrected business logic execution code is determined, and in the case that the corrected business logic execution code is legal, the corrected business logic execution code is determined as the target business logic execution code; in the case that the corrected business logic execution code is illegal, a first alarm information is sent out.
[0091] Among them, the preset legality determination rule is used to check whether the corrected business logic execution code meets the specific syntax rules and code format specifications. The specific syntax rules include checking whether the parentheses are paired, whether the variables are defined before use, etc. The code format specifications include the indentation method of the code, the comment specification, the naming convention, etc. The preset legality determination rule is also used to verify whether the corrected business logic execution code meets the specific business requirements, such as in an e-commerce system, the order amount calculation usually follows the product price, discount rules and shipping rules, etc. The determination rule checks whether the code correctly implements these business rules to avoid problems such as incorrect amount calculation. The first alarm information can be in the form of a text prompt box popped up on the system interface, or sent to relevant technical personnel or system administrators through email, message notification, etc.
[0092] Optionally, the syntax checking tool of the programming language or the customized legality determination rule can be used to verify the legality of the corrected business logic execution code. In addition to syntax checking, the code also needs to be verified according to business rules. For example, whether the data access permission involved in the code conforms to the business regulations, whether the execution logic of the code will cause data conflict, etc. According to the verification result, it is judged whether the corrected business logic execution code is legal. If the verification result is that the corrected business logic execution code passes, it can be determined that the corrected business logic execution code is the target business logic execution code; if the verification result is that the corrected business logic execution code does not pass, it is determined that the corrected business logic execution code is illegal, and a first alarm information is issued to prompt the user to generate the business logic execution code again.
[0093] In this embodiment, the initial business logic execution code is corrected according to the preset correction strategy to obtain the corrected business logic execution code, and the legality of the corrected business logic execution code is determined according to the preset legality determination rule, which helps to ensure that the corrected business logic execution code is legal in syntax and business rules, avoids system failure, data error or security problem caused by illegal code, and issues an alarm information in the case that the corrected code is illegal, so as to remind the relevant personnel to handle in time.
[0094] In one embodiment, as shown in Figure 5 The legality of the corrected business logic execution code is determined according to the preset legality determination rule, including:
[0095] Step 502, based on the corrected business logic execution code, a plurality of test cases and their corresponding preset running results are generated.
[0096] The test case is a set of input data and corresponding operation steps designed to verify whether the corrected business logic execution code conforms to the preset legality determination rule, which is a specific description of the behavior of the corrected business logic execution code in different scenarios. By executing the test case, various possible business scenarios can be simulated, and it is checked whether the output of the code under different input conditions conforms to the expectation, so as to find the errors, logic loopholes or places not conforming to the business rules in the corrected business logic execution code. The preset running result is the expected output determined in advance according to the business demand and the legality determination rule for each test case. The preset running result is the basis for judging whether the code execution result is correct.
[0097] Optionally, the boundary conditions of the input data of the corrected business logic execution code can be determined first, such as the minimum value, the maximum value, and the values near the boundary, etc. For example, if the code processes age data, the boundary values can be 0 and 110. Test cases are generated in this way; the input data can also be divided into different equivalence classes, and a representative value is selected from each equivalence class as the input of the test case. For example, for a corrected business logic execution code that judges the positive and negative of a number, the input data can be divided into three equivalence classes: positive integers, negative integers, and zero. Test cases that meet the actual business scenarios can also be designed according to business requirements and legality determination rules. For example, in an e-commerce system, test cases are generated according to the rules of commodity inventory and price. In addition, for some complex business logic, part of the test cases can be designed manually, and more test cases can be generated by using an automated testing tool.
[0098] In step 504, the test cases are run to obtain test results, and in the case where each test result is consistent with the corresponding preset running result, it is determined that the corrected business logic execution code is legal.
[0099] It can be understood that by actually running the test cases, it is verified whether the output of the corrected code under different input conditions meets the expectation, so as to determine whether the code is legal. If all the test results are consistent with the preset running results, it means that the corrected business logic execution code meets the legality determination rules within the current test coverage.
[0100] Optionally, the test cases can be executed first using an automated testing framework, which can conveniently manage test cases, run tests, and record test results; then a script is written to call the corrected business logic execution code and pass the input of the test case to the code to obtain the execution result; then, the execution result is compared with the preset running result, and if all the test results are consistent with the preset running result, it means that the corrected business logic execution code is legal.
[0101] In this embodiment, by generating comprehensive test cases and performing tests, hidden errors and logic vulnerabilities in the corrected business logic execution code can be found in time and repaired, thereby improving the reliability and stability of the corrected business logic execution code, and further helping to meet the business requirements and security requirements.
[0102] In one embodiment, as shown in Figure 6 Based on the corrected business logic execution code, a plurality of test cases and their corresponding preset running results are generated, including:
[0103] In step 602, the corrected business logic execution code is detected according to the preset security detection rules to obtain a detection result.
[0104] It can be understood that there may be sensitive words or threat words in the corrected business logic execution code, which is not conducive to the security of the system, therefore, the corrected business logic execution code needs to be detected for security. The preset security detection rules can include input verification rules, access control rules, data encryption rules and code vulnerability detection rules. The input verification rule requires the corrected business logic execution code to strictly verify and filter all external inputs to prevent attack means such as cross-site scripting. The access control rule is used to specify the access permission of the code to the resource, to ensure that only authorized users or programs can access specific resources. The data encryption rule requires encryption of data for code involving sensitive information to ensure the security of data during transmission and storage. For example, the user's password needs to be encrypted before being stored in the database to prevent password leakage. The code vulnerability detection rule checks whether there are common security vulnerabilities in the code, such as buffer overflow, null pointer reference, etc.
[0105] Optionally, a static code analysis tool can be used to detect the security of the corrected business logic execution code; or a custom rule matching algorithm can be used to check the corrected business logic execution code line by line, for example, by using regular expressions to match whether there are unsafe function calls or sensitive information leakage in the corrected business logic execution code. In addition, an automated script can be written to combine multiple security detection tools and rules to detect the code in batches. The script can be run regularly to ensure that the security of the code is continuously monitored.
[0106] Step 604, in the case of a safe detection result, generating a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code; in the case of a dangerous detection result, issuing a second alarm information.
[0107] The second alarm information is a prompt information issued in the case of a dangerous security detection result, which is used to remind the developer or system administrator that the code has security risks. The second alarm information usually contains specific security problem description, problem location (such as line number of the code) and possible influence, so that the relevant personnel can take timely measures to repair.
[0108] Optionally, if the detection result is safe, a test case generation tool or algorithm is called to generate test cases and preset running results; if the detection result is dangerous, an alarm mechanism is triggered to send a second alarm information, which can be sent to relevant personnel using a message notification system such as email, SMS, instant messaging tool, etc. The notification content can include detailed security problem description and processing suggestions.
[0109] In the embodiment, the security vulnerabilities in the corrected business logic execution code can be found and repaired in advance, the risk of system attack is reduced, and the security and stability of the system are ensured; in addition, the test cases are generated based on the security of the corrected business logic execution code, the test failure and repeated work caused by security problems are avoided, and the efficiency and accuracy of the test are improved.
[0110] In one detailed embodiment, the metadata structure parsing method of the present application comprises the following steps:
[0111] Step A10, receiving a natural language business requirement input by a user, and obtaining a context parameter at the time of receiving the natural language business requirement.
[0112] Step A20, performing word segmentation processing on the natural language business requirement based on the context parameter to obtain at least one keyword.
[0113] Step A30, finding field information corresponding to each keyword in the metadata database of the ERP system, encapsulating each field information to obtain a structured data package corresponding to the natural language business requirement.
[0114] Step A40, sending the structured data package to a preset large language model for processing to obtain an initial business logic execution code.
[0115] Step A50, correcting the initial business logic execution code according to a preset correction strategy to obtain a corrected business logic execution code.
[0116] Step A60, performing security detection on the corrected business logic execution code according to a preset security detection rule to obtain a detection result.
[0117] Step A70, in the case that the detection result is safe, generating a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code; in the case that the detection result is dangerous, issuing a second alarm information.
[0118] Step A80, running the test cases to obtain test results, in the case that each test result is consistent with the corresponding preset running result, determining that the corrected business logic execution code is legal, in the case that the corrected business logic execution code is legal, determining that the corrected business logic execution code is a target business logic execution code; in the case that the corrected business logic execution code is illegal, issuing a first alarm information.
[0119] The metadata structure analysis method of the present application transmits complex ERP system information in a manner understandable to the large model through metadata pre-analysis and custom function analysis technology. Metadata pre-analysis splits the input requirements and finely matches them with ERP metadata, and custom function analysis conveys the platform's custom functions and syntax knowledge to the large model, which enables enterprises to use the large model to achieve intelligent configuration without requiring employees to have deep ERP technical knowledge, thereby reducing the technical threshold for enterprises to configure ERP and enabling more enterprises to easily improve the efficiency of ERP systems with the help of AI. In addition, through detailed splitting and matching of input requirements, the large model can be provided with rich and accurate information, enabling the large model to analyze based on these high-quality information and more accurately understand enterprise requirements, thereby greatly improving the accuracy of identifying ERP-related information and reducing configuration errors and inefficiencies caused by understanding biases. Furthermore, the security detection of business logic execution code can ensure the security of operations in different application scenarios and avoid unauthorized behavior. It can be applied to expression generation, SQL statement generation, AI testing, and other scenarios. In different scenarios, metadata pre-analysis and custom function analysis support the large model to generate accurate results based on specific requirements, meet the diverse business needs of enterprises, and improve the comprehensive application capabilities of enterprise ERP systems.
[0120] It should be understood that, although each step in the flowchart involved in each embodiment as described above is displayed in sequence according to the direction of the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowchart involved in each embodiment as described above can include multiple steps or stages, which are not necessarily executed at the same time but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential but can be alternately or alternately executed with at least some of the other steps or steps or stages in other steps.
[0121] Based on the same inventive concept, the present application also provides a metadata structure analysis apparatus for implementing the above-mentioned metadata structure analysis method. The solution provided by the apparatus is similar to the implementation scheme described in the above method, so the specific limitations in one or more metadata structure analysis apparatus embodiments provided below can refer to the limitations of the metadata structure analysis method described above, which will not be repeated here.
[0122] In one embodiment, as Figure 7As shown, a metadata structure parsing device is provided, comprising a business requirement processing module 702, a data packet generation module 704, and an execution code generation module 706, wherein:
[0123] The business requirement processing module 702 is configured to receive a natural language business requirement input by a user, and perform word segmentation processing on the natural language business requirement to obtain at least one keyword.
[0124] The data packet generation module 704 is configured to search for field information corresponding to each keyword in a metadata database of an ERP system, and encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement.
[0125] The execution code generation module 706 is configured to send the structured data packet to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement.
[0126] In one embodiment, the business requirement processing module 702 is further configured to: obtain a system environment state at the time of receiving the natural language business requirement; the system environment state comprises a context parameter; and perform word segmentation processing on the natural language business requirement based on the context parameter.
[0127] In one embodiment, the data packet generation module 704 is further configured to: in a case where there is no field corresponding to a preset function syntax rule in the field information, encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement; and in a case where there is a field corresponding to a preset function syntax rule in the field information, encapsulate each field information and the preset function syntax rule to obtain a structured data packet corresponding to the natural language business requirement.
[0128] In one embodiment, the execution code generation module 706 is further configured to: send the structured data packet to a preset large language model for processing to obtain an initial business logic execution code; correct the initial business logic execution code according to a preset correction strategy to obtain a corrected business logic execution code; determine the legality of the corrected business logic execution code according to a preset legality determination rule, and in a case where the corrected business logic execution code is legal, determine that the corrected business logic execution code is the target business logic execution code; and in a case where the corrected business logic execution code is illegal, issue a first alarm information.
[0129] In one embodiment, the execution code generation module 706 is further configured to: generate a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code; run the test cases to obtain test results, and in a case where each test result is consistent with the corresponding preset running result, determine that the corrected business logic execution code is legal.
[0130] In an embodiment, the execution code generation module 706 is further configured to: perform security detection on the corrected business logic execution code according to preset security detection rules to obtain a detection result; in a case where the detection result is safe, generate a plurality of test cases and corresponding preset running results based on the corrected business logic execution code; and in a case where the detection result is dangerous, issue a second alarm information.
[0131] The modules in the metadata structure analysis apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be invoked and executed by the processor to perform operations corresponding to the modules.
[0132] In an embodiment, a computer device is provided, which can be a terminal. An internal structure diagram of the computer device can be as shown in FIG. 8. Figure 8 The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (near field communication), or other technologies. The computer program is executed by the processor to implement a metadata structure analysis method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball, or touchpad arranged on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0133] Those skilled in the art can understand that Figure 8 The structure shown in FIG. 8 is only a block diagram of part of the structure related to the scheme of the present application, and does not limit the computer device to which the scheme of the present application is applied. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] In an embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the steps in the above method embodiments.
[0135] In an embodiment, a computer readable storage medium is provided, having stored thereon a computer program, which, when executed by a processor, implements the steps of any of the above method embodiments.
[0136] In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of any of the above method embodiments.
[0137] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0138] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to a memory, database or other medium used in the embodiments provided by the present application can include at least one of a non-volatile and volatile memory. The non-volatile memory can include a read-only memory (ROM), a magnetic tape, a floppy disk, a flash memory, an optical storage, a high-density embedded non-volatile memory, a resistive memory (ReRAM), a magnetoresistive random access memory (MRAM), a ferroelectric memory (FRAM), a phase change memory (PCM), a graphene memory, etc. The volatile memory can include a random access memory (RAM) or an external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0139] Any combination of the technical features in the above embodiments can be made. For the sake of brevity, the foregoing description has not described all possible combinations of the technical features in the above embodiments. However, as long as the combination of the technical features does not contradict, it should be considered within the scope of the present disclosure.
[0140] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the patent scope of the present application. It should be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A metadata structure parsing method, characterized by, The method comprises: receiving a user input natural language business requirement, and performing word segmentation processing on the natural language business requirement to obtain at least one keyword; in the metadata database of the ERP system, finding field information corresponding to each of the keywords, and packaging each of the field information to obtain a structured data package corresponding to the natural language business requirement; sending the structured data package to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement.
2. The method of claim 1, wherein, The word segmentation processing on the natural language business requirement comprises: obtaining a system environment state when the natural language business requirement is received; the system environment state comprises a context parameter; based on the context parameter, performing word segmentation processing on the natural language business requirement.
3. The method of claim 1, wherein, The packaging of each of the field information to obtain a structured data package corresponding to the natural language business requirement comprises: in the case where there is no field corresponding to a preset function syntax rule in the field information, packaging each of the field information to obtain a structured data package corresponding to the natural language business requirement; in the case where there is a field corresponding to the preset function syntax rule in the field information, packaging each of the field information and the preset function syntax rule to obtain a structured data package corresponding to the natural language business requirement.
4. The method of claim 1, wherein, The sending of the structured data package to a preset large language model for processing to obtain a target business logic execution code corresponding to the natural language business requirement comprises: sending the structured data package to a preset large language model for processing to obtain an initial business logic execution code; correcting the initial business logic execution code according to a preset correction strategy to obtain a corrected business logic execution code; determining the legality of the corrected business logic execution code according to a preset legality determination rule, in the case where the corrected business logic execution code is legal, determining that the corrected business logic execution code is the target business logic execution code; in the case where the corrected business logic execution code is illegal, issuing a first alarm information.
5. The method of claim 4, wherein, The determining of the legality of the corrected business logic execution code according to a preset legality determination rule comprises: generating a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code; running the test cases to obtain test results, in the case where each of the test results is consistent with the corresponding preset running result, determining that the corrected business logic execution code is legal.
6. The method of claim 5, wherein, The generating of a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code comprises: performing security detection on the corrected business logic execution code according to a preset security detection rule to obtain a detection result; in the case where the detection result is safe, generating a plurality of test cases and their corresponding preset running results based on the corrected business logic execution code; in the case where the detection result is dangerous, issuing a second alarm information.
7. A metadata structure parsing device, characterized in that, The device comprises: a business requirement processing module configured to receive a natural language business requirement input by a user and perform word segmentation processing on the natural language business requirement to obtain at least one keyword; a data packet generation module configured to search for field information corresponding to each keyword in a metadata database of an ERP system and encapsulate each field information to obtain a structured data packet corresponding to the natural language business requirement; an execution code generation module configured to send the structured data packet to a preset large language model for processing to obtain target business logic execution code corresponding to the natural language business requirement.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.