Contract template verification method and device, equipment and medium
By using the template engine's syntax and semantic validation, combined with requirement rules, a template reference relationship graph and semantic model are generated, solving the problems of missed detections and poor generalization ability in contract template validation, and achieving efficient multi-dimensional validation and generalization capabilities.
Patent Information
- Application Number
- CN202611226864.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-11-03
AI Technical Summary
In existing technologies, contract template verification methods suffer from missed detections, poor generalization ability, and verification rules scattered across various project scripts, making them difficult to reuse. This results in errors being discovered only during the signing process, leading to high repair costs.
Syntax error validation is performed by calling the template engine, a template reference relationship graph is generated, the target semantic model is obtained and a consistency comparison is performed, multi-dimensional validation is performed by applying the required rules, and the results of each dimension are integrated to generate a structured validation result.
It enables the detection of multiple errors during the editing and submission stages, reduces the production accident rate, improves the generalization ability of the verification, and reduces the problem of missing detection of valid but non-compliant contractual requirements.
Smart Images

Figure CN123031685A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for verifying contract templates. Background Technology
[0002] Contracts, agreements, and other texts are often generated in batches using templates combined with data sources (including business objects, dictionaries, context variables, etc.). To avoid errors, the generated contract templates need to be validated. However, traditional validation methods have the following shortcomings: (1) Relying solely on runtime rendering: Errors are often only exposed during the signing or printing process, resulting in high repair costs.
[0003] (2) Simple syntax validation is insufficient: FTL (FreeMarker) may still have semantic problems such as "the field does not exist", "the type does not match the display" and "the conditional branch contradicts the business rules" even when the syntax is valid.
[0004] (3) Strong coupling with specific contracts: The validation rules are scattered in the scripts of each project, making it difficult to generalize and reuse them across different product lines and different contract types.
[0005] (4) The requirements are not in line with the template: the constraints on the terms, required fields and enumeration values are not structured and enter the verification link, which makes the template run but does not meet the contract requirements.
[0006] Therefore, there is an urgent need for a generalizable contract template verification scheme that can systematically discover grammatical and semantic problems without relying on full-volume real business data each time. Summary of the Invention
[0007] In view of the above, it is necessary to provide a contract template verification method, device, equipment and medium, which aims to solve the problems of missed detection and poor generalization ability in the contract template verification process.
[0008] A contract template verification method, the contract template verification method comprising: In response to a verification command for a target contract template in the editing and submission stage, the template engine is invoked to perform syntax error verification on the target contract template, and the syntax error verification result is obtained. Parse the variable reference paths in the target contract template to generate a template reference relationship graph; Obtain the target semantic model of the configured target contract template, and perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result; Obtain the semantically represented target contract template and the requirement rules; The requirement rules are applied to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain the requirement rule verification result. The results of the syntax error verification, the semantic error verification, and the requirement rule verification are fused together to obtain the verification result of the target contract template.
[0009] A contract template verification device, the contract template verification device comprising: The verification unit is used to respond to the verification instruction for the target contract template in the editing and submission stage, call the template engine to perform syntax error verification on the target contract template, and obtain the syntax error verification result; The generation unit is used to parse the variable reference paths in the target contract template to generate a template reference relationship graph; The comparison unit is used to obtain the target semantic model of the configured target contract template, and to perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result. The acquisition unit is used to acquire the semantically coded target template representation of the target contract template, and to acquire the requirement rules; The verification unit is further configured to apply the requirement rules to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain requirement rule verification results; The fusion unit is used to fuse the syntax error verification result, the semantic error verification result, and the requirement rule verification result to obtain the verification result of the target contract template.
[0010] A computer device, the computer device comprising: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the contract template verification method.
[0011] A computer-readable storage medium storing at least one instruction, which is executed by a processor in a computer device to implement the contract template verification method.
[0012] As can be seen from the above technical solutions, on the one hand, calling the template engine to perform syntax error checks on the target contract template, comparing the consistency between the template reference relationship graph and the target semantic model to obtain the semantic error check results, and applying requirement rules to the target template representation, target semantic model, and template reference relationship graph to execute requirement rule checks can comprehensively cover multi-dimensional checks, reduce the missed detection rate, and achieve separation and decoupling of checks in each dimension, making it easier to locate problems; on the other hand, performing contract template checks during the editing and submission stages can reduce the production accident rate; and on the other hand, by configuring the target semantic model and requirement rules, there is no need to rewrite the check code every time, which also effectively improves the generalization ability. Attached Figure Description
[0013] Figure 1 This is a flowchart of a preferred embodiment of the contract template verification method of the present invention.
[0014] Figure 2 This is a functional block diagram of a preferred embodiment of the contract template verification device of the present invention.
[0015] Figure 3 This is a schematic diagram of the structure of a computer device that implements the contract template verification method of the present invention. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0017] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the contract template verification method of the present invention. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.
[0018] The contract template verification method is applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0019] The computer device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), interactive network television (IPTV), smart wearable device, etc.
[0020] The computer equipment may also include network equipment and / or user equipment. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.
[0021] The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0022] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0023] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0024] The network in which the computer device is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).
[0025] S10, in response to the verification instruction for the target contract template in the editing and submission stage, the template engine is invoked to perform syntax error verification on the target contract template and obtain the syntax error verification result.
[0026] In this embodiment, the contract template is validated during the editing and submission stages, which can detect most problems before it is put into use, thereby reducing the production accident rate.
[0027] In this embodiment, the step of calling the template engine to perform syntax error validation on the target contract template and obtaining the syntax error validation result includes: Establish a source code location mapping for each character segment in the target contract template; The target contract template is parsed to generate a representation of the target template; Without performing full business rendering, the system detects whether there are structural and language-level errors in the target contract template based on the target template representation, and locates the error information based on the source code position of each character fragment to obtain the syntax error verification result.
[0028] Specifically, the text of the target contract template can be standardized to a unified encoding and a unified line break character, and a source code position mapping can be established for each character segment.
[0029] The target template representation can be in the form of an abstract syntax tree or an equivalence block tree. Each tree node includes at least a node type, the original text range, parent-child relationships, conditional expressions, loop variables, and a list of variable references.
[0030] Specifically, without performing full business rendering or using only stub data, the system detects whether there are structural and language-level errors in the target contract template based on the target template representation. This includes: (1) Structural errors: unclosed labels, illegal nested instructions, mismatched parentheses in expressions, etc.
[0031] (2) Language-level errors: illegal instruction name, illegal placeholder spelling.
[0032] The located error information can include file, line number, column number, or segment, so that it can be highlighted in the editing terminal.
[0033] The above embodiments enable syntax error verification before business rendering.
[0034] S11, parse the variable reference paths in the target contract template to generate a template reference relationship diagram.
[0035] The variable reference path may take the form of: abc, loop item attribute, etc.
[0036] The template reference relationship graph can be in the form of a relationship tree, used to represent the reference relationships between various templates.
[0037] In this embodiment, after parsing the variable reference path in the target contract template, the method further includes: When the target contract template is a template engine file that supports code reuse mechanism, the target contract template is used as the main template to establish a template dependency index with the referenced template; When a missing dependency template or version mismatch is detected based on the template dependency index, the dependency class error verification result is output.
[0038] The template engine file is a template that contains include / import / macro.
[0039] Through the above embodiments, it is also possible to directly detect whether there are dependency class errors after parsing the variable reference paths in the target contract template.
[0040] S12, obtain the target semantic model of the configured target contract template, and perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result.
[0041] In this embodiment, before obtaining the target semantic model of the configured target contract template, the method further includes: Retrieve the standard field structure of the configured semantic model; Call the data source adapter to read the metadata fields of the target contract template; An initial semantic model is generated based on the metadata fields and the standard field structure of the semantic model. The initial semantic model is subjected to conflict detection, and inconsistent types of the same path in different sources are merged to obtain the target semantic model.
[0042] The standard field structure of the semantic model may include field path, Chinese field name, data type, formatting capability, whether it is required, whether it is allowed to be empty, enumeration dictionary, source system, applicable contract type, applicable version, obsolete status, and alternative fields.
[0043] The data source adapter can support various data structures such as Java, JSON Schema, OpenAPI (OpenAPI Specification), database table structure, and configuration center dictionary.
[0044] The data source for the target contract template may include interface models, database metadata, domain object patterns, configuration tables, etc.
[0045] The metadata fields may include field identifier, business meaning, data type, whether it is nullable, enumerated values, unit / precision, associated entity, etc.
[0046] In generating the initial semantic model based on the metadata fields and the standard field structure of the semantic model, template references also need to be normalized, i.e., loop aliases, macro parameters, local variables, default value expressions, and built-in function calls need to be processed. For example, `<#list order.items as item>${item.amount}`< / #list> Normalize it to "order.items[].amount" and record that "amount" is in the list context.
[0047] When the same path has inconsistent types in different sources, it is marked as a model conflict.
[0048] The above embodiments can decouple the semantic model from specific contract types and extend it by registering different data source adapters, rather than rewriting the validation code for each contract, thereby improving generalization ability.
[0049] In this embodiment, the step of comparing the template reference relationship graph with the target semantic model to obtain the semantic error verification result includes: For each reference relationship in the template reference relationship graph, if no corresponding field is matched in the target semantic model, or if the matched field is an invalid field and no alternative field is configured, a field inconsistency error is determined to be detected; and / or When there is a field type in the target semantic model that logically conflicts with the target contract template, a field type incompatibility error is detected; and / or When there are hard-coded constants in the target contract template that exceed the range of the enumeration dictionary defined by the target semantic model, it is determined that the risk of taking values outside the enumeration has been detected. The semantic error verification result is generated based on the field inconsistency error, the field type incompatibility error, and the risk of taking values outside the enumeration.
[0050] For example: when a date field is detected to be formatted as an amount, it is determined that a field type incompatibility error has been detected; when a hard-coded conflict with a dictionary is detected in the template, it is determined that a risk of taking values outside the enumeration has been detected.
[0051] The above embodiments enable semantic error verification of contract templates.
[0052] S13, obtain the semantic representation of the target contract template and obtain the requirement rules.
[0053] In this embodiment, the target template representation can be a parsed structured representation, such as an abstract syntax tree or an equivalence block tree.
[0054] The target template representation may include template identifier, version, file path, AST (Abstract Syntax Tree) node set, variable reference set, template dependency set, and source code location mapping, etc.
[0055] In this embodiment, the requirement rules may include mandatory / mutually exclusive clauses, conditional triggering, role visibility, version differences, etc.
[0056] In this embodiment, the requirement rules can be expressed in a declarative structure, including at least rule number, scope of application, triggering conditions, inspection object, expected result, error level, and repair suggestions.
[0057] For example, when "Guarantee Method = Guarantee", the contract template must contain a "Guarantee Liability Clause"; when "Contract Role = Supplier", the internal rate field that is only for the funding party must not be displayed.
[0058] The requirement rules are loosely coupled with the contract templates and can be bound through metadata. The same engine can serve multiple types of contracts, thereby improving generalization capabilities.
[0059] S14, apply the requirement rules to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain the requirement rule verification result.
[0060] In this embodiment, applying the requirement rules to the target template representation, the target semantic model, and the template reference graph to perform requirement rule verification and obtain the requirement rule verification result includes: Transform the aforementioned requirement rules into a set of executable constraint rules; Obtain the business scenario parameters corresponding to the target contract template; The target template representation, the target semantic model, the template reference relationship graph, and the business scenario parameters are combined into a context; Based on the context, a subset of rules that fit the target contract template is selected from the set of executable constraint rules; The required rule validation result is obtained by performing rule validation on the target template representation based on the rule subset.
[0061] The executable constraint rule set can be associated with template ID, version, and business line.
[0062] This allows different template versions to be bound to different rule subsets by template ID, business line, contract type, and version number, and written into the rule library to support subsequent inheritance and overriding, so that general contract rules can be reused by specific product lines.
[0063] The step of performing rule validation on the target template representation based on the rule subset to obtain the requirement rule validation result includes: Iterate through each conditional branch represented by the target template to verify whether each conditional branch has a corresponding bound paragraph, and obtain the branch coverage integrity verification result; and / or Detect whether disabled variable references appear within the restricted scenario branches in the target template representation to obtain the field visibility constraint verification result; and / or Extract each term from the target template representation and compare each term with the requirement business dictionary to obtain the term consistency verification result; The requirement rule verification result is obtained by integrating the branch coverage integrity verification result, the field visibility constraint verification result, and the terminology consistency verification result.
[0064] For example: if a clause requires that "paragraph Y must appear when condition X is true", then check whether there is a corresponding structural node or condition branch covering it in the contract template; if a requirement rule stipulates that a certain field is prohibited from being displayed in a specific scenario, then check whether the corresponding variable is referenced in that scenario branch; check the consistency of cross-paragraph terms and variables, such as whether they are aligned with the requirement dictionary.
[0065] In this process, the rule engine can be used to first filter applicable rules, then perform structure matching, condition coverage analysis and field constraint comparison, and finally form a traceable rule hit record.
[0066] The above embodiments enable the validation of requirement rules for contract templates.
[0067] S15, the syntax error verification result, the semantic error verification result, and the requirement rule verification result are fused to obtain the verification result of the target contract template.
[0068] In this embodiment, the syntax error verification results, the semantic error verification results, and the requirement rule verification results can be merged and deduplicated, and errors can be classified and sorted to finally generate structured verification results.
[0069] The structured verification results can be highlighted with error information using a template editor.
[0070] The error classification of the structured verification results may include syntax blocking, semantic warnings, and requirement suggestions, which facilitates the configuration of CI (Continuous Integration Quality) access control policies.
[0071] For example: For syntax blocking, which corresponds to errors such as template not being parsed, required fields not existing, key clauses missing, and sensitive fields prohibited from being displayed in the publishing scenario, template publishing is blocked by default; For semantic warnings, which correspond to errors such as fields that may be empty, types that can be implicitly converted but pose a display risk, and clause text that is not completely consistent with the requirement dictionary, manual review can be prompted; For requirement suggestions, which correspond to errors such as non-standard field naming, suggested adjustment of clause positions, and the existence of duplicate variable references that can be merged, publishing is not blocked.
[0072] The structured validation result may include fields such as error type, error level, error code, error description, location information, associated fields, hit rules, suggested handling methods, and whether to block publication.
[0073] This embodiment uses a three-layer progression of syntax, semantics, and requirement rules. The semantic layer connects to heterogeneous data sources through a generalized adapter, which not only verifies whether the data can be parsed, but also verifies whether the reference exists in the semantic model and whether the type / enumeration is reasonable. At the same time, it converts non-code requirements into executable rules and performs joint verification with the semantic template structure, reducing the problem of missing detections of legal but non-compliant contract requirements.
[0074] The above embodiments enable the generation of structured verification results that are easy to trace and audit.
[0075] In this embodiment, approximate analysis of static data flow and control flow can also be performed, such as simple path analysis of <#if> structures and <#list> structures, to reduce false alarms for dead branches and null reference types.
[0076] In this embodiment, difference verification can also be performed, and template version diff (comparing the content differences between different versions (or different states) of the same template file to identify which lines have been added, deleted, or modified) and semantic impact range prompts can be provided.
[0077] In this embodiment, template content hash, data source model version, and rule set version can also be used as cache keys to perform incremental analysis only on template fragments, field models, or rules that have changed.
[0078] In this embodiment, the contract template verification can be performed when saving the template editor, before code submission, in the CI / CD (Continuous Integration / Continuous Deployment) pipeline, at the contract template release approval node, and in batch inspection tasks, thereby achieving multi-entry integration.
[0079] As can be seen from the above technical solutions, on the one hand, calling the template engine to perform syntax error checks on the target contract template, comparing the consistency between the template reference relationship graph and the target semantic model to obtain the semantic error check results, and applying requirement rules to the target template representation, target semantic model, and template reference relationship graph to execute requirement rule checks can comprehensively cover multi-dimensional checks, reduce the missed detection rate, and achieve separation and decoupling of checks in each dimension, making it easier to locate problems; on the other hand, performing contract template checks during the editing and submission stages can reduce the production accident rate; and on the other hand, by configuring the target semantic model and requirement rules, there is no need to rewrite the check code every time, which also effectively improves the generalization ability.
[0080] like Figure 2 The diagram shown is a functional block diagram of a preferred embodiment of the contract template verification device of the present invention. The contract template verification device 11 includes a verification unit 110, a generation unit 111, a comparison unit 112, an acquisition unit 113, and a fusion unit 114. The module / unit referred to in this invention refers to a series of computer program segments that can be executed by a processor and perform a fixed function, and are stored in memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0081] The verification unit 110 is used to respond to the verification instruction for the target contract template in the editing and submission stage, call the template engine to perform syntax error verification on the target contract template, and obtain the syntax error verification result. The generation unit 111 is used to parse the variable reference path in the target contract template to generate a template reference relationship diagram; The comparison unit 112 is used to obtain the target semantic model of the configured target contract template, and to perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result. The acquisition unit 113 is used to acquire the semantically coded target template representation of the target contract template, and to acquire the requirement rules; The verification unit 110 is further configured to apply the requirement rules to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain requirement rule verification results; The fusion unit 114 is used to fuse the syntax error verification result, the semantic error verification result and the requirement rule verification result to obtain the verification result of the target contract template.
[0082] As can be seen from the above technical solutions, on the one hand, calling the template engine to perform syntax error checks on the target contract template, comparing the consistency between the template reference relationship graph and the target semantic model to obtain the semantic error check results, and applying requirement rules to the target template representation, target semantic model, and template reference relationship graph to execute requirement rule checks can comprehensively cover multi-dimensional checks, reduce the missed detection rate, and achieve separation and decoupling of checks in each dimension, making it easier to locate problems; on the other hand, performing contract template checks during the editing and submission stages can reduce the production accident rate; and on the other hand, by configuring the target semantic model and requirement rules, there is no need to rewrite the check code every time, which also effectively improves the generalization ability.
[0083] like Figure 3 The diagram shown is a schematic representation of the computer device used to implement the contract template verification method of the present invention.
[0084] The computer device 1 may include a memory 12, a processor 13, and a bus (the arrow in the figure represents the bus), and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a contract template verification program.
[0085] Those skilled in the art will understand that the schematic diagram is merely an example of computer device 1 and does not constitute a limitation on computer device 1. Computer device 1 can be either a bus topology or a star topology. Computer device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, computer device 1 may also include input / output devices, network access devices, etc.
[0086] It should be noted that the computer device 1 described is merely an example. Other existing or future electronic products that are adaptable to this invention should also be included within the scope of protection of this invention and are incorporated herein by reference.
[0087] The memory 12 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the computer device 1, such as a portable hard drive of the computer device 1. In other embodiments, the memory 12 can be an external storage device of the computer device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device 1. Furthermore, the memory 12 can include both internal and external storage units of the computer device 1. The memory 12 can be used not only to store application software and various types of data installed on the computer device 1, such as the code of a contract template verification program, but also to temporarily store data that has been output or will be output.
[0088] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the computer device 1, connecting various components of the computer device 1 via various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing contract template verification programs) and calls data stored in the memory 12 to perform various functions of the computer device 1 and process data.
[0089] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-described embodiments of the contract template verification method, for example... Figure 1 The steps are shown.
[0090] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into a verification unit 110, a generation unit 111, a comparison unit 112, an acquisition unit 113, and a fusion unit 114.
[0091] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the contract template verification method described in the various embodiments of this invention.
[0092] If the modules / units integrated in the computer device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0093] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.
[0094] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.
[0095] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0096] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 3 The bus is represented by only one straight line, but this does not mean that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.
[0097] Although not shown, the computer device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 13 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0098] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the computer device 1 and other computer devices.
[0099] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the computer device 1 and to display a visual user interface.
[0100] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0101] It will be understood by those skilled in the art that Figure 3The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0102] Combination Figure 1 The memory 12 in the computer device 1 stores multiple instructions to implement a contract template verification method, and the processor 13 can execute the multiple instructions to achieve the following: In response to a verification command for a target contract template in the editing and submission stage, the template engine is invoked to perform syntax error verification on the target contract template, and the syntax error verification result is obtained. Parse the variable reference paths in the target contract template to generate a template reference relationship graph; Obtain the target semantic model of the configured target contract template, and perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result; Obtain the semantically represented target contract template and the requirement rules; The requirement rules are applied to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain the requirement rule verification result. The results of the syntax error verification, the semantic error verification, and the requirement rule verification are fused together to obtain the verification result of the target contract template.
[0103] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0104] It should be noted that all the data involved in this case was legally obtained.
[0105] If any AI models, software tools, or components not belonging to this company appear in the embodiments of this invention, they are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this invention has been obtained by an entity authorized (with the knowledge and consent) or fully authorized by all parties through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0106] Unless otherwise specified, the network models used in this embodiment are all general models with a general structure, and are trained and fine-tuned using data related to this embodiment, so as to be applicable to this embodiment.
[0107] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0108] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0109] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0110] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0111] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0112] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0113] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this invention can also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for verifying contract templates, characterized in that, The contract template verification method includes: In response to a verification command for a target contract template in the editing and submission stage, the template engine is invoked to perform syntax error verification on the target contract template, and the syntax error verification result is obtained. Parse the variable reference paths in the target contract template to generate a template reference relationship graph; Obtain the target semantic model of the configured target contract template, and perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result; Obtain the semantically represented target contract template and the requirement rules; The requirement rules are applied to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain the requirement rule verification result. The results of the syntax error verification, the semantic error verification, and the requirement rule verification are fused together to obtain the verification result of the target contract template.
2. The contract template verification method as described in claim 1, characterized in that, The step of calling the template engine to perform syntax error validation on the target contract template and obtaining the syntax error validation results includes: Establish a source code location mapping for each character segment in the target contract template; The target contract template is parsed to generate a representation of the target template; Without performing full business rendering, the system detects whether there are structural and language-level errors in the target contract template based on the target template representation, and locates the error information based on the source code position of each character fragment to obtain the syntax error verification result.
3. The contract template verification method as described in claim 1, characterized in that, After parsing the variable reference paths in the target contract template, the method further includes: When the target contract template is a template engine file that supports code reuse mechanism, the target contract template is used as the main template to establish a template dependency index with the referenced template; When a missing dependency template or version mismatch is detected based on the template dependency index, the dependency class error verification result is output.
4. The contract template verification method as described in claim 1, characterized in that, Before obtaining the target semantic model of the configured target contract template, the method further includes: Retrieve the standard field structure of the configured semantic model; Call the data source adapter to read the metadata fields of the target contract template; An initial semantic model is generated based on the metadata fields and the standard field structure of the semantic model. The initial semantic model is subjected to conflict detection, and inconsistent types of the same path in different sources are merged to obtain the target semantic model.
5. The contract template verification method as described in claim 1, characterized in that, The consistency comparison between the template reference graph and the target semantic model to obtain the semantic error verification result includes: For each reference relationship in the template reference relationship graph, if no corresponding field is matched in the target semantic model, or if the matched field is an invalid field and no alternative field is configured, a field inconsistency error is determined to be detected; and / or When there is a field type in the target semantic model that logically conflicts with the target contract template, a field type incompatibility error is detected; and / or When there are hard-coded constants in the target contract template that exceed the range of the enumeration dictionary defined by the target semantic model, it is determined that the risk of taking values outside the enumeration has been detected. The semantic error verification result is generated based on the field inconsistency error, the field type incompatibility error, and the risk of taking values outside the enumeration.
6. The contract template verification method as described in claim 1, characterized in that, The step of applying the requirement rules to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification, and obtaining the requirement rule verification results, includes: Transform the aforementioned requirement rules into a set of executable constraint rules; Obtain the business scenario parameters corresponding to the target contract template; The target template representation, the target semantic model, the template reference relationship graph, and the business scenario parameters are combined into a context; Based on the context, a subset of rules that fit the target contract template is selected from the set of executable constraint rules; The required rule validation result is obtained by performing rule validation on the target template representation based on the rule subset.
7. The contract template verification method as described in claim 6, characterized in that, The step of performing rule validation on the target template representation based on the rule subset to obtain the requirement rule validation result includes: Iterate through each conditional branch represented by the target template to verify whether each conditional branch has a corresponding bound paragraph, and obtain the branch coverage integrity verification result; and / or Detect whether disabled variable references appear within the restricted scenario branches in the target template representation to obtain the field visibility constraint verification result; and / or Extract each term from the target template representation and compare each term with the requirement business dictionary to obtain the term consistency verification result; The requirement rule verification result is obtained by integrating the branch coverage integrity verification result, the field visibility constraint verification result, and the terminology consistency verification result.
8. A contract template verification device, characterized in that, The contract template verification device includes: The verification unit is used to respond to the verification instruction for the target contract template in the editing and submission stage, call the template engine to perform syntax error verification on the target contract template, and obtain the syntax error verification result; The generation unit is used to parse the variable reference paths in the target contract template to generate a template reference relationship graph; The comparison unit is used to obtain the target semantic model of the configured target contract template, and to perform a consistency comparison between the template reference relationship graph and the target semantic model to obtain the semantic error verification result. The acquisition unit is used to acquire the semantically coded target template representation of the target contract template, and to acquire the requirement rules; The verification unit is further configured to apply the requirement rules to the target template representation, the target semantic model, and the template reference relationship graph to perform requirement rule verification and obtain requirement rule verification results; The fusion unit is used to fuse the syntax error verification result, the semantic error verification result, and the requirement rule verification result to obtain the verification result of the target contract template.
9. A computer device, characterized in that, The computer device includes: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the contract template verification method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, which is executed by a processor in a computer device to implement the contract template verification method as described in any one of claims 1 to 7.
