Data verification method and device, storage medium and program product
By analyzing the target project files in the low-code platform and verifying them based on the syntax object rule information, the problems of low verification efficiency and maintenance difficulties in the low-code platform are solved, and efficient and real-time data checksum maintenance are achieved.
Patent Information
- Application Number
- CN202510174530.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2045-02-18
AI Technical Summary
The prior art has low efficiency in the legality verification of resource reference and input information in low-code platforms, poor real-time performance, difficult maintenance and lack flexibility.
By obtaining the target project file and analyzing it based on the configuration information of the low-code platform, the syntax object and its attribute information are obtained, the files to be checked are determined, and the target verification result is determined based on the attribute information of the syntax object, the files to be checked and the syntax object rule information.
It improves verification efficiency, realizes real-time detection of resource references and input information, reduces maintenance costs, and improves the flexibility and scalability of data verification.
Smart Images

Figure CN119645423A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data verification technology, and in particular to a data verification method, device, storage medium and program product. Background Art
[0002] In the modern software development process, low-code platforms have received widespread attention because they can reduce development difficulty and improve development efficiency. Low-code platforms allow developers to quickly build applications through a visual interface and drag-and-drop method. However, low-code platforms also face some technical challenges, one of which is how to establish accurate and legal reference relationships between low-code resources, and how to effectively verify the legality of resource input information.
[0003] The prior art usually adopts the traditional method of parsing the engineering structure to handle resource reference and input information validity verification. Specifically, developers manually write verification codes to maintain the reference relationship between resources, thereby realizing resource reference and input information validity verification.
[0004] However, this processing method relies on verification code manually written by developers. Each parsing and checking requires a lot of time and computing resources, resulting in low verification efficiency, poor real-time performance, difficult maintenance and lack of flexibility. Summary of the invention
[0005] The purpose of this application is to provide a data verification method, device, storage medium and program product to address the deficiencies in the above-mentioned prior art, so as to solve the problems of low verification efficiency, poor real-time performance, difficult maintenance and lack of flexibility in the prior art.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows: In a first aspect, an embodiment of the present application provides a data verification method, the method comprising: Get the target project file; Based on the configuration information of the low-code platform, the target project file is parsed to obtain multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object, wherein the attribute information includes: the value of the grammatical object and the file to which the grammatical object belongs in the target project file; Determine at least one file to be checked in the target project file; According to the attribute information of each grammar object, each file to be checked and the grammar object rule information of the low-code platform, the target verification result of each file to be checked is determined, and the target verification result includes: multiple verification records, the grammar object rule information is used to indicate the correct usage rules of each grammar object provided by the low-code platform and the correct reference relationship between grammar objects, and each verification record includes: abnormal grammar object, the error type of the abnormal grammar object and the file to which the abnormal grammar object belongs.
[0007] In a second aspect, another embodiment of the present application provides a data verification device, the device comprising: Acquisition module, used to obtain target project files; A parsing module, for parsing the target project file based on the configuration information of the low-code platform, to obtain a plurality of grammatical objects corresponding to the target project file and attribute information of each grammatical object, wherein the attribute information includes: a value of the grammatical object and a file to which the grammatical object belongs in the target project file; A determination module, used for determining at least one file to be checked in the target project file; A verification module is used to determine the target verification result of each file to be checked based on the attribute information of each grammar object, each file to be checked and the grammar object rule information of the low-code platform, the target verification result includes: multiple verification records, the grammar object rule information is used to indicate the correct usage rules of each grammar object provided by the low-code platform, and each verification record includes: abnormal grammar object, the error type of the abnormal grammar object and the file to which the abnormal grammar object belongs.
[0008] In the third aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.
[0009] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.
[0010] In the fifth aspect, another embodiment of the present application provides a computer program product, which includes a computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of any method described in the first aspect above.
[0011] The beneficial effects of the present application are as follows: by acquiring the target project file and parsing the target project file based on the configuration information of the low-code platform, multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object are obtained, and at least one file to be checked in the target project file is determined, so that the target verification result of each file to be checked can be determined according to the attribute information of each grammatical object, each file to be checked and the grammatical object rule information of the low-code platform, the verification of the target project file is realized, the verification efficiency is improved, and the changes in resource references and input information can be detected in real time, thereby improving the real-time performance of data verification. At the same time, with the update of the low-code platform, the developers of the low-code platform only need to maintain the configuration information and grammatical object rule information, avoiding the need to manually update the relevant reference relationship every time the resources or components are modified, thereby reducing maintenance costs.
[0012] In addition, the data verification method provided by this application can also be encapsulated as an independent sub-process, so that the data verification process can run independently in the background, avoiding affecting the main functions of the low-code platform, and can adapt to the special needs of different low-code platforms, thereby improving the development efficiency of the low-code platform and improving the reliability, flexibility and scalability of data verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0014] Figure 1 A schematic diagram of a scenario of a data verification method provided in an embodiment of the present application; Figure 2 A schematic diagram of a flow chart of a data verification method provided in an embodiment of the present application; Figure 3 A schematic diagram of a flow chart for determining at least one file to be checked in the data verification method provided in an embodiment of the present application; Figure 4 A schematic diagram of a flow chart for determining a target verification result of each file to be checked in the data verification method provided in an embodiment of the present application; Figure 5 A schematic diagram of a flow chart for generating a syntax tree of a file to be checked in a data verification method provided in an embodiment of the present application; Figure 6 A schematic diagram of a flow chart for determining a target verification result of a file to be checked in a data verification method provided in an embodiment of the present application; Figure 7 A schematic diagram of a flow chart for obtaining multiple grammatical objects corresponding to a target project file and attribute information of each grammatical object in a data verification method provided in an embodiment of the present application; Figure 8 Another flow chart of obtaining multiple grammatical objects corresponding to a target project file and attribute information of each grammatical object in the data verification method provided in an embodiment of the present application; Fig. 9 A schematic diagram of a data verification device provided in an embodiment of the present application; Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0016] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0017] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0018] Existing technologies usually use the traditional method of parsing project structures to handle resource references and input information legitimacy verification. Specifically, developers manually write verification codes in a hard-coded manner to maintain the reference relationship between resources, so that when users modify the target project files on the low-code platform, the user's modifications can be verified by running the verification code, thereby achieving resource references and input information legitimacy verification.
[0019] However, this processing method relies on verification code manually written by developers. Each parsing and checking consumes a lot of time and computing resources, resulting in low verification efficiency. At the same time, when the referenced resources are deleted or modified, these changes cannot be detected in real time, resulting in poor real-time performance. In addition, the hard-coded association method complicates maintenance changes. Each time a resource or component is modified, the relevant reference relationship needs to be manually updated, which makes maintenance difficult and error-prone. In addition, the program logic of this processing method is relatively fixed, which is difficult to adapt to the special needs of different low-code platforms. It lacks flexibility and has poor scalability.
[0020] Based on the above problems, the embodiment of the present application proposes a data verification method, which obtains the target project file and parses the target project file based on the configuration information of the low-code platform to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object, and determines at least one file to be checked in the target project file, so that the target verification result of each file to be checked can be determined according to the attribute information of each grammatical object, each file to be checked and the grammatical object rule information of the low-code platform, and the verification of the target project file is realized, which improves the verification efficiency, and can detect modified or deleted resources in real time, improves the real-time performance of data verification, and at the same time, avoids the need to manually update the relevant reference relationship every time the resource or component is modified, and simplifies maintenance. In addition, the flexibility and scalability of data verification are also improved.
[0021] First, the relevant usage scenarios involved in the data verification method provided in the embodiment of the present application are explained.
[0022] It can be understood that a low-code platform is a software development tool that enables users to create applications with little or no handwriting code by providing a visual interface and drag-and-drop components. Figure 1 A schematic diagram of a scenario of a data verification method provided in an embodiment of the present application, referring to Figure 1As shown, the user can modify the application by dragging and dropping in the low-code platform, so that the target project file corresponding to the application is also adaptively adjusted. After the target project file is adjusted, the target project file is verified by executing the steps of the data verification method provided in the embodiment of the present application, and the obtained target verification result is pushed to the user, so that the user can obtain an application that runs normally.
[0023] Specifically, continue to refer to Figure 1 As shown, before executing the data verification method provided by the embodiment of the present application, the maintenance personnel or developers of the low-code platform can configure the configuration information and grammatical object rule information of the low-code platform in the low-code platform so that the low-code platform can execute the steps of the data verification method provided by the embodiment of the present application.
[0024] As an example, in the specific implementation process, the technical solution provided by the embodiment of the present application can be deployed in the form of a plug-in to a low-code platform, and run together with the operation of the low-code platform, so as to realize the verification of the target project files, and push the obtained target verification results to the user, so that the user can get a normally running application.
[0025] The data verification method provided in the embodiments of the present application is described in detail below in combination with multiple embodiments.
[0026] Figure 2 A flow chart of a data verification method provided in an embodiment of the present application, referring to Figure 2 As shown, the execution subject of the method can be any electronic device with processing capabilities, such as the above-mentioned low-code platform, and the method includes: S201, obtaining a target project file.
[0027] The target project file is used to store and manage various elements and configurations of the application, which may include configuration files, visual interface design files, and business logic files. Configuration files are used to define the basic settings, permission management, and data model of the application, visual interface design files are used to define the user interface of the application, and business logic files are used to define the business logic and process control of the application.
[0028] Specifically, the acquired target project file may be the target project file modified by the user this time, or may be the target project file modified by the user last time.
[0029] S202. Based on the configuration information of the low-code platform, the target project file is parsed to obtain multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object.
[0030] It can be understood that in the low-code platform, there are fixed basic elements available for users to use, such as user interface elements, data model elements, process control elements, integration and extension elements, and other auxiliary elements. Before executing the data verification method provided in the embodiment of the present application, the developer of the low-code platform can configure the fixed basic elements available for users in the low-code platform as the configuration information of the low-code platform in the low-code platform, so that the low-code platform can parse the target project file based on the configuration information of the low-code platform, and obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object. Among them, the configuration information of the low-code platform includes information such as the fixed basic elements available for users in the low-code platform, the attribute definition of each basic element, the relationship setting, and the life cycle management.
[0031] Optionally, the low-code platform can parse different resources and components in the target project file separately through configuration information, thereby obtaining multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object.
[0032] The multiple grammatical objects corresponding to the target project file include basic elements of the low-code platform used in the target project file and components composed of multiple basic elements. The attribute information of the grammatical object includes: the value of the grammatical object and the file to which the grammatical object belongs in the target project file.
[0033] Exemplarily, when the low-code platform parses the target project file through configuration information, it can first parse the global resources in the target project file, then divide the target project file into modules, and perform grammatical analysis and identification on the resources under each module respectively, so as to obtain multiple target elements and / or multiple components in the target project file, and map the obtained multiple target elements and / or multiple components with the configuration information of the low-code platform to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object.
[0034] Exemplarily, taking the target project file used to build a personnel information management system as an example, the multiple grammatical objects corresponding to the obtained target project file may include user interface elements such as title bar, personnel list, and add personnel button, and may also include data model elements such as personnel table, and may also include process control elements such as adding personnel, deleting personnel, and editing personnel, and may also include extension elements such as email sending and database connection, and may also include business components such as data validation and data submission.
[0035] For example, the values and attribute information of user interface elements such as the title bar, personnel list, and add personnel button may include the name, location, file, size, and trigger logic of the user interface elements. The values and attribute information of data model elements such as the personnel table may include the data type, length, and file. The values and attribute information of process control elements such as add personnel, delete personnel, and edit personnel, and extension elements such as email sending and database connection may include trigger conditions and files. The values and attribute information of business components such as data validation and data submission may include default values, validation rules, placeholders, and files.
[0036] S203: Determine at least one file to be checked in the target project file.
[0037] It can be understood that the target project file includes multiple files. In order to improve the verification efficiency, all or part of the target project files can be used as files to be checked according to the user's modification and the modified compilation result during the verification. The files to be checked are files that need to be verified.
[0038] Optionally, all files in the target project file modified by the user this time may be used as at least one file to be checked in the target project file. Optionally, a file in the target project file that is related to the current modification by the user may also be used as at least one file in the target project file to be checked.
[0039] Optionally, according to the compilation result of the target project file modified by the user, the file causing error information in the compilation result can be used as at least one file to be checked in the target project file.
[0040] S204. Determine the target verification result of each file to be checked based on the attribute information of each grammatical object, each file to be checked, and the grammatical object rule information of the low-code platform.
[0041] It can be understood that after obtaining each file to be checked, each file to be checked can be verified through the attribute information of each grammatical object and the grammatical object rule information of the low-code platform, so as to obtain the target verification result of each file to be checked.
[0042] Optionally, based on the attribute information of each grammar object and the grammar object rule information of the low-code platform, the baseline grammar rules between each grammar object can be determined, and the statements of each grammar object in each file to be checked can be matched with the baseline grammar rules, thereby realizing the verification of each file to be checked and obtaining the target verification results of each file to be checked.
[0043] Among them, the grammatical object rule information of the low-code platform is used to indicate the correct usage rules of each grammatical object provided by the low-code platform, which can be understood as the correct attribute rules, event rules, nested rules, constraint rules and interaction rules of each grammatical object provided by the low-code platform.
[0044] Exemplarily, taking the grammar object as a certain business component as an example, the grammar object rule information is used to indicate multiple conditions under which the business component can be executed normally.
[0045] For example, taking a business component BusinessComponent() as an example, the syntax object rule information of the business component BusinessComponent() is: the content of the business component BusinessComponent() is obtained based on the table BcByTable or based on the business service BcByBs, and the two configuration types can be distinguished by the "@_insrepoType" attribute, and different optional attributes (table or "@_insRepoBusinessService") are provided according to the configuration type. The values of these attributes are respectively limited by the keys in the TABLE_REFER and BS_REFER objects. The implementation of the syntax object rule information of the business component BusinessComponent() can refer to the following program code: type BcByTable = { "@_insrepoType": "TABLE", table?: keyof typeof TABLE_REFER } type BcByBs = { "@_insrepoType": "API", "@_insRepoBusinessService"?: keyof typeof BS_REFER } Interface BusinessComponent { content: BcByTable | BcByBs } The target verification result includes: a plurality of verification records, each of which includes: an abnormal grammatical object, an error type of the abnormal grammatical object, and a file to which the abnormal grammatical object belongs.
[0046] In this embodiment, the target project file is obtained and parsed based on the configuration information of the low-code platform to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object, and at least one file to be checked in the target project file is determined, so that the target verification result of each file to be checked can be determined according to the attribute information of each grammatical object, each file to be checked and the grammatical object rule information of the low-code platform, thereby realizing the verification of the target project file, improving the verification efficiency, and being able to detect changes in resource references and input information in real time, thereby improving the real-time performance of data verification. At the same time, with the update of the low-code platform, the developers of the low-code platform only need to maintain the configuration information and grammatical object rule information, avoiding the need to manually update the relevant reference relationship every time the resources or components are modified, thereby reducing maintenance costs.
[0047] In addition, the data verification method provided by this application can also be encapsulated as an independent sub-process, so that the data verification process can run independently in the background, avoiding affecting the main functions of the low-code platform, and can adapt to the special needs of different low-code platforms, thereby improving the development efficiency of the low-code platform and improving the reliability, flexibility and scalability of data verification.
[0048] It should be understood that the files to be checked may be all target project files or part of the target project files. During verification, based on the user's modifications and the modified compilation results, part of the target project files may be used as files to be checked, or all of the target project files may be used as files to be checked. An exemplary explanation is given below.
[0049] In one possible implementation, Figure 3 A schematic diagram of a flow chart for determining at least one file to be checked in the data verification method provided in the embodiment of the present application, referring to Figure 3 As shown, the above S203 includes: S301, compile the target project file to obtain a preliminary compilation result.
[0050] Optionally, after obtaining the target project file, the low-code platform can compile the target project file to obtain preliminary compilation results.
[0051] S302: judging the preliminary compilation result, if there is at least one preliminary abnormal syntax object in the preliminary compilation result, determining at least one file to be checked according to the at least one preliminary abnormal syntax object.
[0052] Optionally, after obtaining the preliminary compilation result, the low-code platform judges the preliminary compilation result. If there is at least one preliminary abnormal syntax object in the preliminary compilation result, at least one file to be checked is determined based on the at least one preliminary abnormal syntax object.
[0053] Exemplarily, the preliminary abnormal syntax object can be found from the log generated during compilation, so as to locate the file to be checked.
[0054] By compiling the target project file, a preliminary compilation result is obtained, and the preliminary compilation result is judged. If there is at least one preliminary abnormal syntax object in the preliminary compilation result, at least one file to be checked is determined according to the at least one preliminary abnormal syntax object, which can reduce the number of files to be checked, thereby improving the verification efficiency. Moreover, after obtaining the preliminary compilation result, the file to be checked can be determined, and the real-time performance of data verification can be improved.
[0055] In a possible implementation, the above S302 determines at least one file to be checked according to at least one preliminary abnormal syntax object, including: Traverse all sub-target project files in the target project file, and for the current sub-target project file that has been traversed, find out whether the current sub-target project file includes at least one preliminary abnormal syntax object. If so, take the current sub-target project file as the file to be checked.
[0056] Optionally, all sub-target project files in the target project file can be traversed, and for the current sub-target project file that has been traversed, string matching can be used to find out whether the current sub-target project file includes a preliminary exception syntax object. If so, the current sub-target project file will be used as the file to be checked.
[0057] Optionally, you can also use string matching to find out whether the current sub-target project file includes a preliminary exception grammar object, and determine whether the value of the preliminary exception grammar object is an abnormal value based on the grammar object rule information of the low-code platform. If the current sub-target project file includes a preliminary exception grammar object and the value of the preliminary exception grammar object is an abnormal value, the current sub-target project file will be used as the file to be checked.
[0058] In a possible implementation, only files related to user modification may be checked. When determining at least one file to be checked in the target project file in S203, the following steps may be performed: Determine the modification points in the target project file, and determine at least one file to be checked in the target project file based on the modification points, the configuration information of the low-code platform, and the grammatical object rule information of the low-code platform.
[0059] Optionally, after the user modifies the target project file, the relevant information of the modification point in the target project file can be determined, and based on the relevant information of the modification point, at least one grammatical object related to the modification point can be searched from the configuration information of the low-code platform and the grammatical object rule information of the low-code platform, and the sub-target project file corresponding to the grammatical object can be used as the file to be checked.
[0060] In a possible implementation, all target project files may be verified, and then determining at least one file to be checked in the target project files in S203 includes: taking all target project files as files to be checked.
[0061] Through the user's modification and the modified compilation results, part of the target project files can be used as files to be checked, or all of the target project files can be used as files to be checked, so that in the process of data verification, flexible adjustments can be made according to actual conditions, thereby improving the flexibility and scalability of the data verification process.
[0062] The above provides an exemplary description of the process of determining at least one file to be checked in the target project file. After the files to be checked are determined, an exemplary description is provided of determining the target verification results of each file to be checked based on the attribute information of each grammatical object, each file to be checked, and the grammatical object rule information of the low-code platform.
[0063] In one possible implementation, Figure 4 A schematic diagram of a flow chart for determining the target verification result of each file to be checked in the data verification method provided in the embodiment of the present application, referring to Figure 4 As shown, the above S204 includes: S401 : Generate a syntax tree of the file to be checked according to the attribute information of each syntax object and the code structure in the file to be checked.
[0064] Optionally, taking any file to be checked as an example, each syntax object can be used as an object rule when generating a syntax tree for the file to be checked, and the file to be checked can be parsed according to the code structure and each syntax object in the file to be checked. After a syntax object in the file to be checked is identified, a corresponding syntax tree node is created, and different syntax tree nodes are connected according to the code structure in the file to be checked, and the attribute information of each syntax object is added to the corresponding syntax tree node, thereby generating a syntax tree for the file to be checked.
[0065] The syntax tree is used to indicate the value of each syntax object in the file to be checked and the actual reference relationship between the syntax objects.
[0066] By generating a syntax tree of the file to be checked, the program code in the file to be checked can be represented in a structured manner, so that the file to be checked can be verified more accurately and the verification efficiency can be significantly improved.
[0067] S402: Determine a check template for each grammatical object in the file to be checked according to the grammatical object rule information.
[0068] Optionally, from all the grammatical objects, the grammatical objects existing in the file to be checked are screened according to the file name of the file to be checked.
[0069] Optionally, each grammatical object in the file to be checked is associated with a grammatical object rule corresponding to each grammatical object, so as to obtain a check template for each grammatical object in the file to be checked.
[0070] Among them, the inspection template is used to indicate the correct usage rules of the grammatical object, specifically, it may include the value range of the grammatical object, the attributes and types it can have, the nesting or combination method, the relevant information of the responsive events and event processing functions, specific business logic constraints and executable interactive behaviors.
[0071] Optionally, the execution order of S401 and S402 may be adjusted according to actual conditions, that is, S401 and S402 may be executed in parallel, or S402 may be executed first and then S401.
[0072] S403: Determine a target verification result of the file to be checked according to the syntax tree of the file to be checked and the checking template of each syntax object in the file to be checked.
[0073] Optionally, after obtaining the syntax tree of the file to be checked and the inspection template of each syntax object in the file to be checked, each node in the syntax tree of the file to be checked can be searched, and the searched nodes can be checked using the inspection template of the corresponding syntax object to obtain the target verification result of the node, thereby obtaining the target verification result of the file to be checked.
[0074] The syntax tree of the file to be checked is generated through the attribute information of each syntax object and the code structure in the file to be checked, and the inspection template of each syntax object in the file to be checked is determined through the syntax object rule information, so that the target verification result of the file to be checked can be determined according to the syntax tree of the file to be checked and the inspection template of each syntax object in the file to be checked, which can ensure the accuracy and reliability of the obtained target verification result. At the same time, the syntax object in the file to be checked can be quickly located through the syntax tree and the inspection template, which significantly improves the verification efficiency. In addition, the method of obtaining the target verification result through the syntax tree and the inspection template can also be integrated into the continuous integration / continuous deployment (CI / CD) process to realize automatic verification and error detection of the code, and it can be applied to any programming language and has a wide range of applicability.
[0075] In a possible implementation, the process of generating a syntax tree of a file to be checked is exemplarily described. Figure 5 A schematic diagram of a flow chart of generating a syntax tree of a file to be checked in a data verification method provided in an embodiment of the present application, referring to Figure 5 As shown, the above S401 includes: S501 . According to the files to which each grammar object belongs in the target project file, filter out at least one grammar object belonging to the file to be checked, and create a grammar tree node corresponding to each grammar object.
[0076] Optionally, since the attribute information of each grammar object includes the file to which each grammar object belongs in the target project file, then, depending on the different files to be checked, the grammar objects existing in the current file to be checked can be screened from all grammar objects by the file name of the current file to be checked.
[0077] Optionally, after filtering out each grammar object existing in the current file to be checked, each grammar object can be searched from the program code in the current file to be checked, and a corresponding grammar tree node can be created for each grammar object. Specifically, the grammar tree node corresponding to each grammar object can be obtained through a search algorithm and a node creation function.
[0078] Optionally, the value and attribute information of each grammar object may also be added to the grammar tree node corresponding to each grammar object.
[0079] S502: Based on the code structure in the file to be checked, determine the actual reference relationship between the grammatical objects of the file to be checked.
[0080] Optionally, after obtaining the syntax tree nodes corresponding to the syntax objects, the program code in the file to be checked can be traversed to obtain the actual reference relationship between the syntax objects in the file to be checked, wherein the actual reference relationship between the syntax objects is the syntax tree node.
[0081] S503: Generate a syntax tree of the file to be checked according to the syntax tree nodes corresponding to the syntax objects and the actual reference relationship between the syntax objects.
[0082] Optionally, the actual reference relationship between the syntax objects is used as the connection relationship between the syntax tree nodes, and the syntax tree of the file to be checked is generated according to the syntax tree nodes corresponding to the syntax objects and the connection relationship between the syntax tree nodes.
[0083] Exemplarily, the parent node of the syntax tree can be determined according to the connection relationship between the syntax tree nodes, and the parent-child relationship between the syntax tree nodes can be determined, so that the syntax tree nodes are connected to generate the syntax tree of the file to be checked.
[0084] By screening out at least one syntax object belonging to the file to be checked according to the file to which each syntax object belongs in the target project file, creating a syntax tree node corresponding to each syntax object, and determining the actual reference relationship between the syntax objects of the file to be checked based on the code structure in the file to be checked, it is possible to generate a syntax tree for the file to be checked based on the syntax tree nodes corresponding to each syntax object and the actual reference relationship between the syntax objects, which helps to discover potential syntax errors, code redundancy, performance bottlenecks and other problems, so that the file to be checked can be verified more accurately and the verification efficiency can be significantly improved.
[0085] In a possible implementation, when determining the check template for each grammatical object in the to-be-checked file according to the grammatical object rule information in S402, the process includes: Determine each grammar object in the file to be checked, and traverse each grammar object in the file to be checked. For the current grammar object traversed, find the current grammar rule information corresponding to the current grammar object from the grammar object rule information, and use the current grammar rule information as the inspection template of the current grammar object.
[0086] Optionally, from all grammar objects, the grammar objects existing in the file to be checked are screened through the file name of the file to be checked, and the grammar objects in the file to be checked are traversed. For the current grammar object traversed, the current grammar rule information corresponding to the current grammar object is searched from the grammar object rule information by string matching, and the current grammar rule information is used as the inspection template for the current grammar object, which can ensure the accuracy of the inspection templates of each grammar object obtained, thereby ensuring the accuracy of the target verification result obtained.
[0087] In a possible implementation, a process of determining a target verification result of a file to be checked is exemplarily described. Figure 6 A schematic diagram of a flow chart for determining a target verification result of a file to be checked in a data verification method provided in an embodiment of the present application, referring to Figure 6 As shown, the above S403 includes: S601 : Match the syntax tree of the file to be checked and the check template of each syntax object in the file to be checked to obtain an initial check result of the file to be checked.
[0088] Optionally, the syntax tree of the file to be checked is searched by depth-first traversal or breadth-first traversal, and the searched nodes are compared with the check templates of each syntax object in the file to be checked to determine the initial verification result of the node, thereby obtaining the initial verification result of the file to be checked.
[0089] The initial verification result may include multiple verification records, each of which includes: an abnormal grammatical object, an error type of the abnormal grammatical object, and a file to which the abnormal grammatical object belongs.
[0090] Exemplarily, the value and attribute information of each node in the syntax tree are matched with the value range of the syntax object in the inspection template, the attributes and types it can have, the nesting or combination method, the relevant information of the responsive events and event processing functions, the specific business logic constraints and the executable interactive behaviors, so as to obtain the initial verification result of the file to be checked.
[0091] Exemplarily, the initial verification result may be a set of abnormal verification records, each of which is used to indicate a file in which an exception occurs, a grammatical object causing the exception, and a reason for the exception.
[0092] S602: Generate a target verification result of the file to be checked according to the initial verification result of the file to be checked and a preset structured statement.
[0093] Optionally, the initial verification results of the file to be checked can be filled into preset structured statements respectively, so that the objects and their attributes in a specific engineering description language can be used to check or verify the positioning information in the file to be checked, thereby obtaining the target verification results of the file to be checked, and ensuring the consistency of the obtained target verification results with the file to be checked.
[0094] Exemplarily, the preset structured statement may be an engineering description language LanguageObject[type][id].conent. Specifically, LanguageObject is an object type in the engineering description language. The object type LanguageObject includes a category [type], an identifier [id], and an attribute content.
[0095] The above is an exemplary description of the processing procedure for determining the target verification results of each file to be checked. The following is a detailed description of the processing procedure based on the configuration information of the low-code platform, parsing the target project file, obtaining multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object.
[0096] In one possible implementation, Figure 7 A flow chart of obtaining multiple grammatical objects corresponding to a target engineering file and attribute information of each grammatical object in the data verification method provided in the embodiment of the present application, referring to Figure 7 As shown, the above S202 includes: S701. Based on the configuration information of the low-code platform, parse the target project file to generate multiple initial grammar objects corresponding to the target project file and attribute information of each initial grammar object.
[0097] Optionally, the low-code platform can parse different resources and components in the target project file separately through configuration information, thereby obtaining multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object.
[0098] Exemplarily, different parsing methods can be used according to the format and content of the target project file, and different resources and components in the target project file can be parsed respectively according to the configuration information and the parsing method, and the parsed data can be matched with the basic elements and the attribute definitions of the basic elements in the configuration information, so as to obtain multiple syntax objects corresponding to the target project file, and after obtaining each syntax object, the attribute information of each syntax object is generated according to the parsed data. Among them, the parsing method can include JavaScript Object Notation Parser (JSON parser for short) and eXtensible Markup Language Parser (XML parser for short).
[0099] S702: Perform post-processing on each initial grammatical object and the attribute information of each initial grammatical object to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object.
[0100] Optionally, the initial grammatical object and the attribute information of each initial grammatical object can be post-processed to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object. The post-processing can include type conversion, format conversion, exception handling, default value filling, object merging, object splitting, and object cleaning of the initial grammatical object and the attribute information of each initial grammatical object.
[0101] Through the configuration information based on the low-code platform, the target project file is parsed to generate multiple initial grammatical objects corresponding to the target project file and the attribute information of each initial grammatical object, and the initial grammatical objects and the attribute information of each initial grammatical object are post-processed to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object, which can ensure the accuracy of each grammatical object and the attribute information of each grammatical object, thereby ensuring the accuracy of the target verification result.
[0102] In one possible implementation, Figure 8 Another flow chart of obtaining multiple grammatical objects corresponding to a target engineering file and attribute information of each grammatical object in the data verification method provided in the embodiment of the present application, referring to Figure 8 As shown, in the above S702, each initial grammatical object and the attribute information of each initial grammatical object are post-processed to obtain multiple grammatical objects corresponding to the target project file and the attribute information of each grammatical object, including: S801. Perform conflict resolution on each initial grammatical object to obtain each initial grammatical object after conflict resolution.
[0103] It can be understood that after obtaining each initial grammar object, due to the ambiguity of the input data or the design defects of the parser, there may be conflicts between the initial grammar objects due to duplicate names or abnormal errors. Therefore, the initial grammar objects can be conflict-processed to obtain the initial grammar objects after conflict processing.
[0104] Optionally, each initial grammar object can be checked to determine whether there is a conflict between the current initial grammar objects and to determine the type of conflict. Based on the type of conflict, the initial grammar object causing the conflict is cleaned and converted to obtain the initial grammar objects after the conflict is resolved. This makes the initial grammar objects after the conflict is resolved clearer and improves the verification efficiency of the target project file.
[0105] S802: Create an index for each initial grammatical object after conflict resolution to obtain each grammatical object corresponding to the target project file.
[0106] Optionally, a keyword index may be created for each initial grammatical object after the conflict processing according to the difference in the name of each initial grammatical object, so as to obtain each grammatical object corresponding to the target project file.
[0107] Optionally, a property index may be created for each initial grammatical object after the conflict processing according to the difference in property information of each initial grammatical object, so as to obtain each grammatical object corresponding to the target project file.
[0108] Optionally, a sequence number index may be created for each initial grammatical object after the conflict processing according to the different orders of each initial grammatical object, so as to obtain each grammatical object corresponding to the target project file.
[0109] Exemplarily, a hash table may be introduced, and each initial grammatical object after conflict processing may be traversed to create an index for each initial grammatical object after conflict processing, so as to obtain each grammatical object corresponding to the target project file.
[0110] S803: Use the attribute information of each initial grammatical object as the attribute information of each grammatical object.
[0111] Optionally, after obtaining each grammar object, the attribute information of each corresponding initial grammar object is used as the attribute information of each grammar object.
[0112] By performing conflict processing on each initial grammatical object, each initial grammatical object after conflict processing is obtained, and indexing is created for each initial grammatical object after conflict processing, each grammatical object corresponding to the target project file is obtained, and the attribute information of each initial grammatical object is used as the attribute information of each grammatical object, which can ensure the accuracy of each grammatical object and the attribute information of each grammatical object, thereby ensuring the accuracy of the target verification result. At the same time, due to the existence of the index structure, each grammatical object can be quickly queried, thereby improving the verification efficiency of the target project file.
[0113] Based on the same inventive concept, a data verification device corresponding to the data verification method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned data verification method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0114] Fig. 9 A schematic diagram of a data verification device provided in an embodiment of the present application, referring to Fig. 9 As shown, the device includes: an acquisition module 901, a parsing module 902, a determination module 903 and a verification module 904; The acquisition module 901 is used to acquire the target project file; A parsing module 902 is used to parse the target project file based on the configuration information of the low-code platform to obtain multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object, wherein the attribute information includes: the value of the grammatical object and the file to which the grammatical object belongs in the target project file; A determination module 903 is used to determine at least one file to be checked in the target project file; Verification module 904 is used to determine the target verification result of each file to be checked based on the attribute information of each grammatical object, each file to be checked and the grammatical object rule information of the low-code platform. The target verification result includes: multiple verification records. The grammatical object rule information is used to indicate the correct usage rules of each grammatical object provided by the low-code platform. Each verification record includes: abnormal grammatical object, error type of abnormal grammatical object and the file to which the abnormal grammatical object belongs.
[0115] Optionally, the determination module 903 is specifically configured to: Compile the target project file to obtain preliminary compilation results; The preliminary compilation result is judged, and if there is at least one preliminary abnormal syntax object in the preliminary compilation result, at least one file to be checked is determined according to the at least one preliminary abnormal syntax object.
[0116] Optionally, the determination module 903 is specifically configured to: Traverse all sub-target project files in the target project file, and for the current sub-target project file that has been traversed, find out whether the current sub-target project file includes at least one preliminary abnormal syntax object. If so, take the current sub-target project file as the file to be checked.
[0117] Optionally, the verification module 904 is specifically configured to: Generate a syntax tree of the file to be checked according to the attribute information of each syntax object and the code structure in the file to be checked, where the syntax tree is used to indicate the value of each syntax object in the file to be checked and the actual reference relationship between the syntax objects; Determine the inspection template of each grammatical object in the to-be-inspected file according to the grammatical object rule information, wherein the inspection template is used to indicate the correct usage rule of the grammatical object and the correct reference relationship between the associated grammatical objects; According to the syntax tree of the file to be checked and the check template of each syntax object in the file to be checked, the target verification result of the file to be checked is determined.
[0118] Optionally, the verification module 904 is specifically configured to: According to the files to which each grammatical object belongs in the target project file, at least one grammatical object belonging to the file to be checked is screened out, and a grammatical tree node corresponding to each grammatical object is created; Based on the code structure in the file to be checked, determine the actual reference relationship between the grammatical objects of the file to be checked; A syntax tree of the file to be checked is generated according to the values of the syntax objects of the file to be checked and the actual reference relationship between the syntax objects in the syntax tree nodes corresponding to the syntax objects.
[0119] Optionally, the verification module 904 is specifically configured to: Determine each grammar object in the file to be checked, and traverse each grammar object in the file to be checked. For the current grammar object traversed, find the current grammar rule information corresponding to the current grammar object from the grammar object rule information, and use the current grammar rule information as the inspection template of the current grammar object.
[0120] Optionally, the verification module 904 is specifically configured to: Matching the syntax tree of the file to be checked and the check templates of each syntax object in the file to be checked to obtain an initial check result of the file to be checked; According to the initial verification result of the file to be checked and the preset structured statement, the target verification result of the file to be checked is generated.
[0121] Optionally, the parsing module 902 is specifically configured to: Based on the configuration information of the low-code platform, the target project file is parsed to generate multiple initial syntax objects corresponding to the target project file and attribute information of each initial syntax object; Post-processing is performed on each initial grammatical object and the attribute information of each initial grammatical object to obtain a plurality of grammatical objects corresponding to the target project file and the attribute information of each grammatical object.
[0122] Optionally, the parsing module 902 is specifically configured to: Performing conflict resolution on each initial grammatical object to obtain each initial grammatical object after conflict resolution; Creating indexes for each initial grammatical object after conflict resolution to obtain each grammatical object corresponding to the target project file; The attribute information of each initial grammatical object is used as the attribute information of each grammatical object.
[0123] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0124] The present application also provides an electronic device, such as Fig.10 As shown, Fig.10The electronic device structure diagram provided in the embodiment of the present application includes: a processor 1001, a memory 1002, and optionally, a bus 1003. The memory 1002 stores machine-readable instructions executable by the processor 1001 (for example, Fig. 9 In the device, the execution instructions corresponding to the acquisition module 901, the analysis module 902, the determination module 903 and the verification module 904 are obtained, etc.), when the electronic device is running, the processor 1001 communicates with the memory 1002 through the bus 1003, and when the machine-readable instructions are executed by the processor 1001, the steps of the above-mentioned data verification method are performed.
[0125] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned data verification method are executed.
[0126] An embodiment of the present application also provides a computer program product, which includes a computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of the above-mentioned data verification method.
[0127] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0128] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0129] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A data verification method, characterized in that: include: Get the target project file; Based on the configuration information of the low-code platform, the target project file is parsed to obtain multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object, wherein the attribute information includes: the value of the grammatical object and the file to which the grammatical object belongs in the target project file; Determine at least one file to be checked in the target project file; According to the attribute information of each grammar object, each file to be checked and the grammar object rule information of the low-code platform, the target verification result of each file to be checked is determined, and the target verification result includes: multiple verification records, the grammar object rule information is used to indicate the correct usage rules of each grammar object provided by the low-code platform, and each verification record includes: abnormal grammar object, the error type of the abnormal grammar object and the file to which the abnormal grammar object belongs.
2. The data verification method according to claim 1, characterized in that: The determining at least one file to be checked in the target project file comprises: Compiling the target project file to obtain a preliminary compilation result; The preliminary compilation result is judged, and if there is at least one preliminary abnormal syntax object in the preliminary compilation result, at least one file to be checked is determined according to the at least one preliminary abnormal syntax object.
3. The data verification method according to claim 2, characterized in that: The step of determining at least one file to be checked according to the at least one preliminary abnormal syntax object comprises: Traverse all sub-target project files in the target project file, and for the current sub-target project file traversed, find out whether the current sub-target project file includes at least one of the preliminary abnormal syntax objects. If so, use the current sub-target project file as the file to be checked.
4. The data verification method according to claim 1, characterized in that: Determining the target verification result of each file to be checked according to the attribute information of each grammatical object, each file to be checked and the grammatical object rule information of the low-code platform includes: Generate a syntax tree of the file to be checked according to the attribute information of each syntax object and the code structure in the file to be checked, wherein the syntax tree is used to indicate the value of each syntax object in the file to be checked and the actual reference relationship between the syntax objects; Determine, according to the grammatical object rule information, a check template for each grammatical object in the to-be-checked file, wherein the check template is used to indicate a correct usage rule for the grammatical object; A target verification result of the file to be checked is determined according to the syntax tree of the file to be checked and the checking template of each syntax object in the file to be checked.
5. The data verification method according to claim 4, characterized in that: The generating a syntax tree of the file to be checked according to the attribute information of each syntax object and the code structure in the file to be checked includes: According to the files to which each grammatical object belongs in the target project file, at least one grammatical object belonging to the file to be checked is screened out, and a grammatical tree node corresponding to each grammatical object is created; Determining the actual reference relationship between the grammatical objects of the file to be checked based on the code structure in the file to be checked; A syntax tree of the file to be checked is generated according to the syntax tree nodes corresponding to the syntax objects and the actual reference relationship between the syntax objects.
6. The data verification method according to claim 4, characterized in that: Determining the inspection template for each grammatical object in the to-be-inspected file according to the grammatical object rule information includes: Determine each grammar object in the file to be checked, and traverse each grammar object in the file to be checked. For the current grammar object traversed, search for current grammar rule information corresponding to the current grammar object from the grammar object rule information, and use the current grammar rule information as a checking template for the current grammar object.
7. The data verification method according to claim 4, characterized in that: The step of determining a target verification result of the file to be checked according to the syntax tree of the file to be checked and the checking template of each syntax object in the file to be checked includes: Matching the syntax tree of the file to be checked and the check templates of each syntax object in the file to be checked to obtain an initial check result of the file to be checked; A target verification result of the file to be checked is generated according to the initial verification result of the file to be checked and a preset structured statement.
8. The data verification method according to claim 1, characterized in that: The configuration information based on the low-code platform is used to parse the target project file to obtain multiple grammatical objects corresponding to the target project file and attribute information of each grammatical object, including: Based on the configuration information of the low-code platform, the target project file is parsed to generate a plurality of initial grammatical objects corresponding to the target project file and attribute information of each initial grammatical object; Post-processing is performed on each of the initial grammatical objects and the attribute information of each of the initial grammatical objects to obtain a plurality of grammatical objects corresponding to the target project file and the attribute information of each grammatical object.
9. The data verification method according to claim 8, characterized in that: The post-processing of each of the initial grammatical objects and the attribute information of each of the initial grammatical objects to obtain a plurality of grammatical objects corresponding to the target project file and the attribute information of each grammatical object includes: Performing conflict processing on each of the initial grammatical objects to obtain each of the initial grammatical objects after conflict processing; Creating an index for each of the initial grammatical objects after conflict resolution to obtain each grammatical object corresponding to the target project file; The attribute information of each of the initial grammar objects is used as the attribute information of each of the grammar objects.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the data verification method as described in any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data verification method according to any one of claims 1 to 9 are executed.
12. A computer program product, characterized in that The computer program product includes computer program code. When the computer program code is executed by a computing device, the computing device executes the steps of the data verification method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Code checking method and device
CN106371997A
Code error positioning method and device, electronic equipment and storage medium
CN113778854A
Application engineering file processing method and device, electronic equipment and readable medium
CN113946339A
Component optimization method and device suitable for low codes, equipment and medium
CN114691150A
Code checking method and device, computer equipment and storage medium
CN115328487A