Database verification method and device, electronic equipment and storage medium
By using Python-based auxiliary tools to parse and verify ARXML files and build an AUTOSAR temporary data model, the problem that ARXML files cannot be directly used in different tool chains is solved, achieving rapid verification and efficient development.
Patent Information
- Application Number
- CN202510653514.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-09-16
AI Technical Summary
In the development of in-vehicle Ethernet, due to the different understandings of the AUTOSAR standard by different tool chain manufacturers, the ARXML files generated by the demander cannot be used directly in the development tool chain, and manual verification is inefficient due to lack of experience.
An auxiliary tool based on the Python platform is designed. By loading the verification rule library code file, parsing the ARXML file into an XML node tree, building the AUTOSAR temporary data model, and using Python bytecode for legality verification, it outputs illegal information.
Improved the inspection efficiency of ARXML files. By building an AUTOSAR temporary data model, the dependencies of ARXML files can be quickly verified, thereby improving the development efficiency of the AUTOSAR platform.
Smart Images

Figure CN120653531A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of automotive software development, and in particular to a database verification method, device, electronic device, and storage medium. Background Art
[0002] The increasing use of in-vehicle Ethernet (IoE) in vehicles is driving higher demands for flexibility. In actual development, the user typically provides an ARXML (AUTOSAR XML) database containing SOME / IP (Scalable service-oriented Middleware over IP) information. Developers then use this database to import relevant tools for development. However, development toolchain vendors inevitably differ in their understanding and implementation of the AUTOSAR (AUTomotive Open System Architecture) standard. This results in the ARXML files generated by the user generally not being able to be directly used within the developer's toolchain. Furthermore, because the user's experience with the development and design of the SOME / IP database is unknown, the generated ARXML files are likely to differ from the actual desired service, requiring manual verification.
[0003] To address these issues, developers must rely on their understanding of the AUTOSAR specification to manually check the ARXML content, which is inefficient. Alternatively, they can use imported modules within different tools and, relying on error messages, iterate on the ARXML. However, even with toolchain prompts, developers still need relevant experience; otherwise, the checking process is inefficient. Summary of the Invention
[0004] In order to solve the above technical problems, the present application provides a database verification method, device, electronic device and storage medium.
[0005] According to a first aspect of the present application, a database verification method is provided, comprising:
[0006] Obtain and load a pre-built validation rule library code file, and compile each validation rule in the validation rule library code file into Python bytecode;
[0007] Obtain the ARXML file to be verified and user-defined data, and use the LXML library to parse the ARXML file into an XML node tree;
[0008] Constructing an AUTOSAR temporary data model according to the XML node tree; wherein the AUTOSAR temporary data model includes a key-value table for searching elements or nodes;
[0009] The AUTOSAR temporary data model and the user-defined data are verified for legitimacy using Python bytecode to obtain verification results of the ARXML file, and ARXML information corresponding to illegal verification results is output.
[0010] Optionally, constructing an AUTOSAR temporary data model according to the XML node tree includes:
[0011] Parse the XML node tree to obtain a first key-value lookup table where the key is a node type and the value is a list of elements containing the node type;
[0012] Parsing the XML node tree to obtain a second key-value lookup table in which the key is an AUTOSAR path and the value is an element under the AUTOSAR path;
[0013] Parsing the XML node tree to obtain a third key-value lookup table, where the key is the AUTOSAR path and the value is a node referencing an element under the AUTOSAR path;
[0014] The XML node tree, the first key-value lookup table, the second key-value lookup table, and the third key-value lookup table are constructed as an AUTOSAR temporary data model.
[0015] Optionally, the method further includes:
[0016] For the ARXML information corresponding to the illegal verification result, if the ARXML information is modifiable ARXML information, the ARXML information is modified to obtain a modified ARXML file.
[0017] Optionally, using Python bytecode to perform legality verification on the AUTOSAR temporary data model to obtain a verification result of the ARXML file includes:
[0018] Get the table corresponding to the ARXML file;
[0019] Parsing service information from the AUTOSAR temporary data model using Python bytecode, extracting the service information from the table, and comparing the service information parsed from the AUTOSAR temporary data model with the service information extracted from the table to obtain a comparison result;
[0020] If the comparison results are consistent, it is determined that the service information in the ARXML file is legal;
[0021] If the comparison results are inconsistent, it is determined that the service information in the ARXML file is illegal.
[0022] Optionally, constructing an AUTOSAR temporary data model according to the XML node tree includes:
[0023] Using Python bytecode, verify the syntax validity of the node information in the ARXML node tree;
[0024] In the absence of illegal node information, constructing an AUTOSAR temporary data model according to the node information in the ARXML node tree;
[0025] In the event that illegal node information appears, the illegal node information is output, and whether to terminate the process is determined based on the illegal node information.
[0026] Optionally, determining whether to terminate the process according to the illegal node information includes:
[0027] If the illegal node information is important node information, the ARXML file is determined to be illegal and the process is terminated;
[0028] If the illegal node information does not belong to important node information, an AUTOSAR temporary data model is constructed according to the legal node information in the ARXML node tree.
[0029] Optionally, using Python bytecode to perform validity verification on the AUTOSAR temporary data model and user-defined data to obtain a verification result of the ARXML file, including:
[0030] For the Python bytecode corresponding to each verification rule, when the AUTOSAR temporary data model and the user-defined data meet the verification trigger condition corresponding to the verification rule, obtaining target data from the AUTOSAR temporary data model and the user-defined data;
[0031] The target data is validated for validity using the Python bytecode corresponding to the validation rule to obtain a validation result for the target data.
[0032] According to a second aspect of the present application, a database verification device is provided, comprising:
[0033] A validation rule compilation module is used to obtain and load a pre-built validation rule library code file, and compile each validation rule in the validation rule library code file into Python bytecode;
[0034] An ARXML file parsing module, used to obtain the ARXML file to be verified and user-defined data, and parse the ARXML file into an XML node tree using the LXML library;
[0035] A temporary data model construction module, configured to construct an AUTOSAR temporary data model according to the XML node tree; wherein the AUTOSAR temporary data model includes a key-value table for searching elements or nodes;
[0036] A verification module, configured to verify the legitimacy of the AUTOSAR temporary data model and user-defined data using Python bytecode, and obtain a verification result of the ARXML file;
[0037] The verification result output module is used to output the ARXML information corresponding to the illegal verification result.
[0038] Optionally, the temporary data model construction module is specifically used to parse from the XML node tree a first key-value lookup table whose key is the node type and whose value is a list of elements containing the node type; parse from the XML node tree a second key-value lookup table whose key is the AUTOSAR path and whose value is an element under the AUTOSAR path; parse from the XML node tree a third key-value lookup table whose key is the AUTOSAR path and whose value is a node referencing an element under the AUTOSAR path; and construct the XML node tree, the first key-value lookup table, the second key-value lookup table and the third key-value lookup table into an AUTOSAR temporary data model.
[0039] Optionally, the database verification device further includes:
[0040] The ARXML information modification module is used to modify the ARXML information corresponding to the illegal verification result, if the ARXML information is modifiable ARXML information, to obtain a modified ARXML file.
[0041] Optionally, the verification module is specifically configured to verify the legitimacy of the AUTOSAR temporary data model through the following steps:
[0042] Get the table corresponding to the ARXML file;
[0043] Parsing service information from the AUTOSAR temporary data model using Python bytecode, extracting the service information from the table, and comparing the service information parsed from the AUTOSAR temporary data model with the service information extracted from the table to obtain a comparison result;
[0044] If the comparison results are consistent, it is determined that the service information in the ARXML file is legal;
[0045] If the comparison results are inconsistent, it is determined that the service information in the ARXML file is illegal.
[0046] Optionally, the temporary data model construction module is specifically used to use Python bytecode to verify the grammatical validity of the node information in the ARXML node tree; when no illegal node information appears, the AUTOSAR temporary data model is constructed according to the node information in the ARXML node tree; when illegal node information appears, the illegal node information is output, and whether to terminate the process is determined based on the illegal node information.
[0047] Optionally, the temporary data model construction module is specifically configured to determine whether to terminate the process according to the illegal node information through the following steps:
[0048] If the illegal node information is important node information, the ARXML file is determined to be illegal and the process is terminated;
[0049] If the illegal node information does not belong to important node information, an AUTOSAR temporary data model is constructed according to the legal node information in the ARXML node tree.
[0050] Optionally, the verification module is specifically configured to obtain target data from the AUTOSAR temporary data model and the user-defined data for the Python bytecode corresponding to each verification rule when the AUTOSAR temporary data model and the user-defined data meet the verification trigger condition corresponding to the verification rule; and perform legality verification on the target data using the Python bytecode corresponding to the verification rule to obtain a verification result of the target data.
[0051] According to a third aspect of the present application, an electronic device is provided, comprising: a processor, wherein the processor is configured to execute a computer program stored in a memory, wherein the computer program implements the method described in the first aspect when executed by the processor.
[0052] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0053] According to a fifth aspect of the present application, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute the method described in the first aspect.
[0054] The technical solution provided by the embodiments of the present application has the following advantages compared with the prior art:
[0055] Based on the Python platform, a tool has been designed for developing AUTOSAR basic software, SOME / IP, that implements verification of ARXML databases. During the verification process, an AUTOSAR temporary data model (an internal processing format for AUTOSAR models) is constructed. The AUTOSAR temporary data model includes a key-value table for searching elements or nodes. Using this AUTOSAR temporary data model as an intermediate format improves the efficiency of querying ARXML information, accelerating the execution of the validation input acquirer. Because the construction of the AUTOSAR temporary data model traverses the entire ARXML file, ARXML dependencies can be checked. In other words, the process of converting an ARXML file to this model also involves format verification. Rapid verification of ARXML files improves development efficiency based on the AUTOSAR platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0058] Figure 1 A schematic diagram of a database verification method in an embodiment of the present application;
[0059] Figure 2 A flowchart of the database verification method in an embodiment of the present application;
[0060] Figure 3 This is a structural diagram of a database verification device in an embodiment of the present application;
[0061] Figure 4 This is a structural diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0063] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application can also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present application, not all of the embodiments.
[0064] This application is based on the Python platform and designs an auxiliary tool for the ARXML database. By checking and verifying the syntax and semantics of ARXML files, the development efficiency based on the AUTOSAR platform can be improved. Figure 1 This is a schematic diagram of the database verification method in the embodiment of the present application. When the developer wants to verify the ARXML file, the auxiliary tool can be started to load the verification rules in the verification rule library code file. The ARXML file provided by the demander is obtained, and the ARXML file is parsed into an XML node tree. The AUTOSAR temporary data model is constructed according to the XML node tree. The verification rules are traversed to verify the AUTOSAR temporary data model and the user-defined data to obtain the verification results. When the verification fails, the verification visualization method can be executed to output the problems in a visual way, which can be a console output or a drawn graph. When the verification rule traversal is completed, the log information generated during the runtime is saved for subsequent analysis.
[0065] See also Figure 2 , Figure 2 This is a flowchart of the database verification method in an embodiment of the present application, which may include the following steps:
[0066] Step S202: Obtain and load a pre-built verification rule library code file, and compile each verification rule in the verification rule library code file into Python bytecode.
[0067] The validation rule base code file is compiled by the tool's user based on the actual ARXML validation needs, in a specified format. It is written in Python. The validation rules in the validation rule base enable customized validation processes. For example, ARXML files can be verified for compliance with the AUTOSAR specification, the internal specifications of specific AUTOSAR tools, and the requirements of the SOME / IP protocol itself. Each validation rule in the validation rule base code file is compiled into Python bytecode, which can then be used directly for subsequent validation, improving verification speed.
[0068] In some embodiments, a single validation rule may include: a validation trigger condition, validation rule content, and a validation visualization method. Alternatively, the validation rule may further include a validation modifier.
[0069] The verification trigger condition refers to the logic that triggers the verification rule. The input is the AUTOSAR temporary data model and user-defined global data. It is an executable logic. The return value is a Boolean value, indicating whether the verification is triggered.
[0070] The validation rule content is the core validation rule logic. After the validation rule is triggered, it obtains the data for verification from the data source. The data source can be the AUTOSAR temporary data model or user-defined input. Based on the defined logic, the validation data is judged for validity and a correct or invalid result is given.
[0071] The purpose of validation visualization is to help users intuitively understand validation results. After validation rules are executed and the results are obtained, the results are output in a visual way, which can be output to the console or as a graph. For example, the ARXML information corresponding to an illegal validation result can be output, along with the corresponding modification suggestions.
[0072] Validation modifiers are used to correct some ARXML errors after validation is completed. Therefore, validation rules can define a modifier to fix the errors.
[0073] In the embodiment of the present application, the verification logic can also be divided into multiple different modules to achieve flexible combination of the verification process, which can facilitate the management of the ever-changing verification requirements corresponding to different tools and demanders. Users can maintain different verification rules separately.
[0074] Step S204: Obtain the ARXML file to be verified and the user-defined data, and use the LXML library to parse the ARXML file into an XML node tree.
[0075] The ARXML file to be verified can be the ARXML file provided by the demander, and the developer should verify the ARXML file before development. User-defined data is data other than the ARXML file, such as table data, constants, and the definition of a software parameter.
[0076] The LXML library, written in Python, is primarily used for parsing and extracting data from HTML or XML formats. It's both feature-rich and user-friendly, allowing you to quickly locate specific elements or nodes using XPath syntax. Therefore, you can use the LXML library to parse ARXML files into an XML node tree. This XML node tree stores the original ARXML structure.
[0077] Step S206: constructing an AUTOSAR temporary data model according to the XML node tree.
[0078] The AUTOSAR temporary data model is an internal processing format designed to facilitate computer analysis and processing based on the AUTOSAR model. It includes a key-value table for looking up elements or nodes. Based on the ARXML infrastructure rules, attempts are made to parse common ARXML node information, such as ARPACKAGE, ARELEMENTS, and SHORTNAME, converting the structured ARXML model into a key-value lookup table.
[0079] In some embodiments, a first key-value lookup table can be parsed from an XML node tree, where the key is the node type and the value is a list of elements containing the node type. The first key-value lookup table is used to query elements of a specified top-level node type. A second key-value lookup table can be parsed from the XML node tree, where the key is the AUTOSAR path and the value is the element under the AUTOSAR path. The second key-value lookup table is used to query AUTOSAR elements corresponding to the specified AUTOSAR path. A third key-value lookup table can be parsed from the XML node tree, where the key is the AUTOSAR path and the value is a node referencing an element under the AUTOSAR path. The third key-value lookup table is used to query all nodes that reference the AUTOSAR element corresponding to the specified AUTOSAR path. The XML node tree, the first key-value lookup table, the second key-value lookup table, and the third key-value lookup table are constructed into an AUTOSAR temporary data model.
[0080] Since the process of building the AUTOSAR temporary data model traverses the entire ARXML file, it is possible to check the ARXML dependencies and use Python bytecode to verify the syntax validity of the node information in the ARXML node tree.
[0081] For example, some tool chains have a limit on the length of the string for SHORTNAME (node name), which cannot exceed 128. Then you can develop validation rules for this tool requirement, as follows:
[0082] Verification trigger condition: traverse the XML node tree and read the SHORTNAME node;
[0083] Verification rule: whether the length of the string in the SHORTNAME node exceeds 128;
[0084] Verification visualization method: If the verification fails, output the ARXML line number and content of the SHORTNAME.
[0085] If no illegal node information occurs, the AUTOSAR temporary data model can be constructed directly based on the node information in the ARXML node tree. If illegal node information occurs, for example, if the definition of the target node referenced by the referenced node cannot be found, the illegal node information is output and the process is determined to terminate based on the illegal node information.
[0086] Optionally, if the illegal node information belongs to important node information, the ARXML file is determined to be illegal and the process is terminated; if the illegal node information does not belong to important node information, the illegal node information can be ignored, and the AUTOSAR temporary data model is constructed according to the legal node information in the ARXML node tree.
[0087] Step S208 : Using Python bytecode, perform validity verification on the AUTOSAR temporary data model and the user-defined data, obtain the verification result of the ARXML file, and output the ARXML information corresponding to the illegal verification result.
[0088] The Python bytecode corresponding to each validation rule is traversed. For each validation rule, if the AUTOSAR temporary data model and user-defined data meet the validation trigger conditions corresponding to the validation rule, the target data is obtained from the AUTOSAR temporary data model and user-defined data. The target data is then validated using the Python bytecode corresponding to the validation rule to obtain the validation result of the target data.
[0089] For example, semantic validation can be performed on ARXML files. Demanders typically present service definitions in two formats: ARXML files and Excel spreadsheets. ARXML files follow strict formatting guidelines, while the format of Excel spreadsheets can be subjectively defined by the author, resulting in better readability. In theory, the information in both formats should be consistent, but in practice, inconsistent definitions often occur. Therefore, service definitions in both formats can be compared to identify discrepancies and intuitively output to users, facilitating subsequent verification of requirements and modification of these files.
[0090] The validation trigger condition is to execute the validation rule directly after reading it, and only once. The validation rule is as follows: obtain the table corresponding to the ARXML file; use Python bytecode to parse the service information from the AUTOSAR temporary data model and extract the service information from the table; compare the service information parsed from the AUTOSAR temporary data model with the service information extracted from the table to obtain a comparison result. If the comparison results are consistent, the service information in the ARXML file is determined to be legal; if the comparison results are inconsistent, the service information in the ARXML file is determined to be illegal. The verification visualization method outputs the comparison results as a user-readable report.
[0091] As mentioned above, the validation rules may also include a validation modifier. For ARXML information corresponding to an illegal validation result, if the ARXML information is modifiable ARXML information, the ARXML information is modified to obtain a modified ARXML file, and the XML node tree in the AUTOSAR temporary data model is saved as a copy of the ARXML file.
[0092] After completing verification according to all verification rules, release the resources used by the tool, such as the memory space occupied by the AUTOSAR temporary data model, and store the log information generated during the tool execution in the file system for subsequent analysis.
[0093] The database verification method of the embodiment of the present application is based on the Python platform and designs an auxiliary tool for the development of AUTOSAR basic software SOME / IP, which can check and verify the syntax and semantics of the ARXML database. During the verification process, an AUTOSAR temporary data model can be constructed, that is, an internal processing format of the AUTOSAR model. The AUTOSAR temporary data model includes a key-value table for finding elements or nodes. Using this AUTOSAR temporary data model as an intermediate format can improve the efficiency of querying ARXML information, that is, speed up the execution of the verification input acquirer. Since the process of building the AUTOSAR temporary data model traverses the entire ARXML file, the dependencies of ARXML can be checked. That is, the process of converting the ARXML file into the model is also a process of format verification. By quickly verifying the ARXML file, the development efficiency based on the AUTOSAR platform can be improved.
[0094] Corresponding to the above method embodiment, the present application embodiment also provides a database verification device, see Figure 3 , the database verification device 300 includes:
[0095] The verification rule compilation module 302 is used to obtain and load the pre-built verification rule library code file and compile each verification rule in the verification rule library code file into Python bytecode;
[0096] ARXML file parsing module 304, used to obtain the ARXML file to be verified and user-defined data, and parse the ARXML file into an XML node tree using the LXML library;
[0097] A temporary data model construction module 306 is used to construct an AUTOSAR temporary data model according to the XML node tree; wherein the AUTOSAR temporary data model includes a key-value table for searching elements or nodes;
[0098] The verification module 308 is used to verify the legitimacy of the AUTOSAR temporary data model and user-defined data using Python bytecode to obtain a verification result of the ARXML file;
[0099] The verification result output module 310 is used to output ARXML information corresponding to illegal verification results.
[0100] Optionally, the temporary data model construction module 306 is specifically configured to parse from the XML node tree a first key-value lookup table whose key is the node type and whose value is a list of elements containing the node type; parse from the XML node tree a second key-value lookup table whose key is the AUTOSAR path and whose value is an element under the AUTOSAR path; parse from the XML node tree a third key-value lookup table whose key is the AUTOSAR path and whose value is a node referencing an element under the AUTOSAR path; and construct the XML node tree, the first key-value lookup table, the second key-value lookup table, and the third key-value lookup table into an AUTOSAR temporary data model.
[0101] Optionally, the database verification device 300 further includes:
[0102] The ARXML information modification module is used to modify the ARXML information corresponding to the illegal verification result, if the ARXML information is modifiable ARXML information, to obtain a modified ARXML file.
[0103] Optionally, the verification module 308 is specifically configured to verify the validity of the AUTOSAR temporary data model through the following steps:
[0104] Get the table corresponding to the ARXML file;
[0105] Use Python bytecode to parse service information from the AUTOSAR temporary data model and extract service information from the table. Compare the service information parsed from the AUTOSAR temporary data model with the service information extracted from the table to obtain a comparison result.
[0106] If the comparison results are consistent, the service information in the ARXML file is confirmed to be legal;
[0107] If the comparison results are inconsistent, it is determined that the service information in the ARXML file is illegal.
[0108] Optionally, the temporary data model construction module is specifically used to use Python bytecode to verify the grammatical validity of node information in the ARXML node tree; when no illegal node information appears, the AUTOSAR temporary data model is constructed according to the node information in the ARXML node tree; when illegal node information appears, the illegal node information is output, and based on the illegal node information, it is determined whether to terminate the process.
[0109] Optionally, the temporary data model building module 306 is specifically configured to determine whether to terminate the process according to the illegal node information through the following steps:
[0110] If the illegal node information is important node information, the ARXML file is determined to be illegal and the process is terminated;
[0111] If the illegal node information does not belong to important node information, the AUTOSAR temporary data model is constructed according to the legal node information in the ARXML node tree.
[0112] Optionally, the verification module 308 is specifically configured to obtain target data from the AUTOSAR temporary data model and the user-defined data for the Python bytecode corresponding to each verification rule when the AUTOSAR temporary data model and the user-defined data meet the verification trigger condition corresponding to the verification rule; and perform legality verification on the target data using the Python bytecode corresponding to the verification rule to obtain a verification result of the target data.
[0113] The specific details of each module or unit in the above device have been described in detail in the corresponding method, so they will not be repeated here.
[0114] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0115] An embodiment of the present application further provides an electronic device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the above-mentioned database verification method in this example implementation.
[0116] Reference Figure 4 , Figure 4 This is a structural diagram of an electronic device in an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0117] like Figure 4 As shown, the electronic device may include: a processor 402 , a communication interface 404 , a memory 406 , and a communication bus 408 .
[0118] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .
[0119] The communication interface 404 is used to communicate with other electronic devices or servers.
[0120] The processor 402 is configured to execute the program 410 , and specifically may execute the relevant steps in the above method embodiment.
[0121] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0122] Processor 402 may be a central processing unit, a specific integrated circuit, or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0123] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0124] The program 410 may be specifically configured to enable the processor 402 to execute the steps in the above-mentioned database verification method embodiment.
[0125] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the aforementioned method embodiments and will not be repeated here.
[0126] 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 above-mentioned database verification method is implemented.
[0127] It should be noted that the computer-readable storage medium shown in this application can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device or device. The program code contained on the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency, etc., or any suitable combination thereof.
[0128] In an embodiment of the present application, a computer program product is further provided. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned database verification method.
[0129] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0130] The foregoing description is intended only to provide specific embodiments of the present application, which will enable those skilled in the art to understand and implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments described herein, but is intended to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A database verification method, characterized in that: include: Obtain and load a pre-built validation rule library code file, and compile each validation rule in the validation rule library code file into Python bytecode; Obtain the ARXML file to be verified and user-defined data, and use the LXML library to parse the ARXML file into an XML node tree; Constructing an AUTOSAR temporary data model according to the XML node tree; wherein the AUTOSAR temporary data model includes a key-value table for searching elements or nodes; The AUTOSAR temporary data model and the user-defined data are verified for legitimacy using Python bytecode to obtain verification results of the ARXML file, and ARXML information corresponding to illegal verification results is output.
2. The method according to claim 1, characterized in that According to the XML node tree, an AUTOSAR temporary data model is constructed, including: Parse the XML node tree to obtain a first key-value lookup table where the key is a node type and the value is a list of elements containing the node type; Parsing the XML node tree to obtain a second key-value lookup table in which the key is an AUTOSAR path and the value is an element under the AUTOSAR path; Parsing the XML node tree to obtain a third key-value lookup table, where the key is the AUTOSAR path and the value is a node referencing an element under the AUTOSAR path; The XML node tree, the first key-value lookup table, the second key-value lookup table, and the third key-value lookup table are constructed as an AUTOSAR temporary data model.
3. The method according to claim 1, characterized in that The method further comprises: For the ARXML information corresponding to the illegal verification result, if the ARXML information is modifiable ARXML information, the ARXML information is modified to obtain a modified ARXML file.
4. The method according to claim 1, wherein Using Python bytecode, the legality of the AUTOSAR temporary data model is verified to obtain the verification result of the ARXML file, including: Get the table corresponding to the ARXML file; Parsing service information from the AUTOSAR temporary data model using Python bytecode, extracting the service information from the table, and comparing the service information parsed from the AUTOSAR temporary data model with the service information extracted from the table to obtain a comparison result; If the comparison results are consistent, it is determined that the service information in the ARXML file is legal; If the comparison results are inconsistent, it is determined that the service information in the ARXML file is illegal.
5. The method according to claim 1, characterized in that According to the XML node tree, an AUTOSAR temporary data model is constructed, including: Using Python bytecode, verify the syntax validity of the node information in the ARXML node tree; In the absence of illegal node information, constructing an AUTOSAR temporary data model according to the node information in the ARXML node tree; In the event that illegal node information appears, the illegal node information is output, and whether to terminate the process is determined based on the illegal node information.
6. The method according to claim 5, characterized in that The determining whether to terminate the process according to the illegal node information includes: If the illegal node information is important node information, the ARXML file is determined to be illegal and the process is terminated; If the illegal node information does not belong to important node information, an AUTOSAR temporary data model is constructed according to the legal node information in the ARXML node tree.
7. The method according to claim 1, characterized in that Using Python bytecode, the AUTOSAR temporary data model and user-defined data are verified for legitimacy, and the verification results of the ARXML file are obtained, including: For the Python bytecode corresponding to each verification rule, when the AUTOSAR temporary data model and the user-defined data meet the verification trigger condition corresponding to the verification rule, obtaining target data from the AUTOSAR temporary data model and the user-defined data; The target data is validated using the Python bytecode corresponding to the validation rule to obtain a validation result of the target data.
8. A database verification device, characterized in that: The device comprises: A validation rule compilation module is used to obtain and load a pre-built validation rule library code file, and compile each validation rule in the validation rule library code file into Python bytecode; An ARXML file parsing module, used to obtain the ARXML file to be verified and user-defined data, and parse the ARXML file into an XML node tree using the LXML library; A temporary data model construction module is used to construct an AUTOSAR temporary data model according to the XML node tree; wherein the AUTOSAR temporary data model includes a key-value table for searching elements or nodes; A verification module, configured to verify the legitimacy of the AUTOSAR temporary data model and user-defined data using Python bytecode, and obtain a verification result of the ARXML file; The verification result output module is used to output the ARXML information corresponding to the illegal verification result.
9. An electronic device, characterized in that: include: A processor, wherein the processor is configured to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.