Mapping method and system based on bilingual binding engine
By using a mapping method based on a dual semantic binding engine, the problems of high architectural coupling, lack of synchronization mechanism, and insufficient semantic understanding in the OTX development system are solved, achieving accurate mapping and real-time synchronization between graphics and code, and improving the scalability and reliability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-03-10
AI Technical Summary
Existing OTX development systems suffer from problems such as high architectural coupling, lack of synchronization mechanisms, insufficient semantic understanding, difficulty in synchronizing graphics and code, and fragmented data management, resulting in difficulties in system maintenance and poor scalability.
A mapping method based on a dual semantic binding engine is adopted. By performing deep analysis on image elements and source code files, a bidirectional mapping between graphic feature vectors and code feature vectors is established, realizing accurate mapping and real-time synchronization between graphic elements and code elements.
It improves the accuracy of converting graphical operations to code, supports real-time synchronous updates of modified code elements to graphical elements, ensures the real-time performance and reliability of bidirectional mapping, and reduces system maintenance costs.
Smart Images

Figure CN121635866A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of OTX development technology, specifically to a mapping method and system based on a dual semantic binding engine. Background Technology
[0002] The Open Test Sequence Exchange Format (OTX) provides an XML-based standardized description for the writing and exchange of automotive diagnostic test sequences. However, this standard only defines the data exchange format for the sequences and does not specify how its development environment should be built.
[0003] The current development of OTX sequences faces the following technical bottlenecks: High degree of architectural coupling: The graphical editing layer is directly coupled with the OTX code layer, which leads to difficulties in system maintenance and poor scalability.
[0004] Lack of synchronization mechanism: Most existing tools only support one-way graphics-to-code generation and cannot achieve two-way real-time synchronization.
[0005] Insufficient semantic understanding: Lack of deep understanding of OTX semantics makes it difficult to achieve intelligent editing assistance and error checking.
[0006] The graphical editing layer is directly bound to the OTX code layer. Graphical operations directly generate code snippets, while code modifications are difficult to reverse-engineer into graphics. This tight dependency means that modifications to either layer can easily cause desynchronization or logical errors in the other.
[0007] Most tools only support one-way conversion from graphics to code. Once engineers optimize or fix at the code level, the graphical view fails to update automatically and quickly becomes unusable, making graphical editing unreliable in iterative development.
[0008] Existing solutions are mostly based on the traditional MVC pattern or a simple code generator architecture, which cannot effectively solve the above problems.
[0009] Lack of a unified data model: Information such as graphical status, code text, and execution status are managed in a scattered manner, lacking a single, authoritative source of facts. This leads to complex internal system states and high costs for function expansion and maintenance.
[0010] A search revealed existing patents (such as CN117631655A) that disclose a secure communication method for vehicle diagnostics, mentioning a "visual operation model of a web page." However, the core of this patent's invention lies in using this visual model as an input interface to achieve the specific security function of automatic injection of communication keys. It merely treats graphical editing as a means to achieve its goal and does not reveal how to construct a robust, scalable graphical OTX development system architecture capable of handling complex diagnostic logic and maintaining long-term consistency between graphics and code. This existing technology completely fails to address the fundamental architectural problems mentioned above, such as "tight coupling," "semantic understanding," "synchronization mechanisms," and "unidirectional data flow."
[0011] Therefore, there is an urgent need in this field for a new system architecture to address the aforementioned technical bottlenecks and provide an efficient, reliable, and easily scalable foundation for graphical OTX development. Summary of the Invention
[0012] To address the problems existing in the prior art, this invention provides a mapping method and system based on a dual semantic binding engine, which performs deep understanding of image elements and source code files, establishes a bidirectional mapping from graphic feature vectors to code feature vectors, and facilitates modification and updates.
[0013] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0014] According to a first aspect of this application, a mapping method based on a dual semantic binding engine is provided, comprising: The image elements are parsed to obtain the first semantic information; The source code file is parsed to obtain second semantic information, wherein the source code file includes several code elements; A graphical feature vector is constructed based on the first semantic information, and a code feature vector is constructed based on the second semantic information. The dimensions of the graphical feature vector and the code feature vector are aligned, and a bidirectional mapping is constructed. The bidirectional mapping includes a first mapping from the graphical feature vector to the code element and a second mapping from the code feature vector to the image element.
[0015] In some embodiments of this application, based on the foregoing scheme, the step of parsing image elements to obtain first semantic information includes: Traverse the image elements, classify them according to the preset encoding system, and output the image element attribute list; Analyze the connections between image elements and construct a list of image element connection relationships; Parse the constraints of image elements and output a structured constraint semantic table of image elements; First semantic information is generated based on the image element attribute list, the image element connection relationship list, and the image element structured constraint semantic table.
[0016] In some embodiments of this application, based on the foregoing scheme, the step of parsing the source code file to obtain second semantic information, wherein the source code file includes several code elements, including: Extract the AST nodes from the source code file and output the semantic annotation results of the AST nodes; Construct an AST node type relationship graph based on AST nodes; Obtain the business logic semantic processing label table from the source code file; Based on the semantic annotation results of AST nodes, the relationship diagram of AST node types, and the label table of business logic semantic processing, second semantic information is generated.
[0017] In some embodiments of this application, based on the foregoing scheme, the step of extracting AST nodes from the source code file and outputting the semantic annotation results of the AST nodes includes: Extract the AST nodes from the source code file; Traverse the AST nodes and identify the type of AST node; Obtain the control complexity or data dependencies of AST nodes; The business logic semantic processing tag table is obtained from the source code file, including: Get code elements from source code files; Obtain the preset business model, error handling logic, and performance optimization strategy for each code element; A business logic semantic processing tag table is established based on the preset business patterns, error handling logic, and performance optimization strategies of all code elements.
[0018] In some embodiments of this application, based on the foregoing scheme, a graph feature vector is constructed based on first semantic information, and a code feature vector is constructed based on second semantic information. The dimensions of the graph feature vector and the code feature vector are aligned, including: Based on the first semantic information, the category ratio, connectivity value, constraint value and topological feature value of the image elements are obtained; Generate graphic feature vectors based on the category proportion, connectivity value, constraint value, and topological feature value of image elements; Based on the second semantic information, we can obtain syntactic complexity, type usage, business pattern weight, and code quality. Code feature vectors are generated based on syntactic complexity, type usage, business model weight, and code quality.
[0019] In some embodiments of this application, based on the foregoing scheme, the construction of the bidirectional mapping, which includes a first mapping from graphic feature vectors to code elements and a second mapping from code feature vectors to image elements, includes: Calculate the cosine similarity, structural similarity, and semantic similarity between the graphic feature vector and the code feature vector, and then sum the weighted cosine similarity, structural similarity, and semantic similarity to obtain the similarity score; Extract the graphic feature vector, traverse the code elements in the source code file, calculate the similarity between the graphic feature vector and each code element, select the code element with the highest score as the graphic feature vector matching result, record the first confidence score, and establish the first mapping between the graphic feature vector and the code element with the highest score. Extract code feature vectors, traverse image elements, calculate the similarity between code feature vectors and each image element, select the code element with the highest score as the image feature vector matching result, record the second confidence score, and establish a second mapping between code feature vectors and the image element with the highest score.
[0020] In some embodiments of this application, based on the foregoing scheme, the following further methods are also included: Identify and resolve conflicts between the first and second mappings, specifically as follows: Check for type conflicts, data flow conflicts, control flow conflicts, and business logic conflicts, and output a conflict list, which includes the conflict type, location, and description. The conflict is scored by weighting and summing the impact scope, repair difficulty, and business impact, and then sorted according to the conflict score to output the sorted conflict list. For conflicts with conflict scores greater than or equal to the first preset conflict threshold, generate solutions that modify the graphical logic and adjust the code business model. For conflicts with a conflict score less than the first preset conflict threshold, if the conflict is a type conflict, generate conversion code; if the conflict is a data flow conflict, adjust the data flow direction; if the conflict is a control flow conflict, modify the control flow; if the conflict is a business logic conflict, modify the business logic.
[0021] According to a second aspect of this application, a mapping system based on a dual semantic binding engine is provided, comprising: The conversion module is used to parse image elements and obtain the first semantic information; An extraction module is used to parse source code files and obtain second semantic information, wherein the source code file includes several code elements; The mapping module is used to construct a graphic feature vector based on first semantic information and a code feature vector based on second semantic information. The dimensions of the graphic feature vector and the code feature vector are aligned to construct a bidirectional mapping. The bidirectional mapping includes a first mapping from the graphic feature vector to the code element and a second mapping from the code feature vector to the image element.
[0022] According to a third aspect of this application, a computer-readable storage medium is provided that stores a computer program thereon, the computer program including executable instructions that, when executed by a processor, implement the method described above.
[0023] According to a fourth aspect of this application, an electronic device is provided, comprising: One or more processors; A memory for storing executable instructions of the processor, which, when executed by the one or more processors, cause the one or more processors to implement the method described above.
[0024] The beneficial effects of this application are as follows: (1) The mapping method and system based on dual semantic binding engine provided in this application achieves accurate mapping between graphic elements and code elements by establishing a refined semantic annotation system and intelligent recognition algorithm, and deeply understanding OTX semantics, thereby improving the accuracy of graphic operation to code conversion.
[0025] (2) This application provides a mapping method and system based on a dual semantic binding engine. The innovative reverse mapping algorithm completely solves the technical problem of code-to-graphic conversion, realizes real-time synchronous update of code element modification to graphic element, supports incremental reverse mapping, updates only the changed parts, and improves performance.
[0026] (3) The mapping method and system based on the dual semantic binding engine provided in this application establishes a multi-level synchronization guarantee mechanism to ensure the real-time performance and reliability of bidirectional mapping.
[0027] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit this application. Attached Figure Description
[0028] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and are intended to explain the invention, but do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a flowchart of a mapping method based on a dual semantic binding engine according to the present invention; Figure 2This is a schematic diagram of a mapping system based on a dual semantic binding engine according to the present invention; Figure 3 This is a schematic diagram of an electronic device according to the present invention. Detailed Implementation
[0029] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0030] It should be understood that the terms "comprising" and other similar expressions in the specification, claims, and accompanying drawings of this invention are intended to cover a non-exclusive inclusion, such as a process, method, system, or apparatus that includes a series of steps or units and is not limited to the listed steps or units. Furthermore, "first" and "second" are used to distinguish different objects and are not intended to describe a specific order.
[0031] According to the first aspect of this application, please refer to Figure 1 This embodiment provides a mapping method based on a dual semantic binding engine, including: Step S1: Parse the image elements to obtain the first semantic information.
[0032] In this embodiment, parsing the image elements to obtain the first semantic information includes: Iterate through the image elements and output the list of image element attributes; Analyze the connections between image elements and construct a list of image element connection relationships; Parse the constraints of image elements and output a structured constraint semantic table of image elements; First semantic information is generated based on the image element attribute list, the image element connection relationship list, and the image element structured constraint semantic table.
[0033] In this embodiment, the image elements are traversed, and a list of image element attributes is output, including: Iterate through the image elements and build a list of image element attributes based on the image element's category, unique coded label, and image element attributes.
[0034] In this embodiment, the category of image elements is obtained according to a preset encoding system, which includes control flow, data flow, service call, and combined elements.
[0035] In this embodiment, each image element is given a unique coded label, for example, the start node is marked as 0x01.
[0036] In this embodiment, image element attributes are obtained, such as the parameter type of the data input node and the ID of the diagnostic service.
[0037] In one specific embodiment, a row of data in the image element attribute list is [{'id': 'n1', 'type1':0x01, 'attr': {'name': 'Start'}}, where id represents the category of the image element, type1 represents a unique coded label, and attr represents the image element attribute.
[0038] In this embodiment, the connection relationship includes the image element types of the starting point and the ending point, the connection line type, and the connection constraints.
[0039] In this embodiment, the analyze_connection_semantics function is called to determine the image element types of the starting point and the ending point.
[0040] In this embodiment, the connection type is marked, and the connection type includes control flow, data flow, service call, and dependency.
[0041] In this embodiment, the constraints of the connection are recorded, including the data stream transmission format and the control stream triggering conditions.
[0042] Based on the image element types of the starting point and the ending point, a list of connection relationships is established by determining the connection semantics, connection line type, and connection constraints. For example, a row of data in the connection relationship list is [{'src': 'n1', 'dst':'n2', 'type2': 'control_flow', 'constraint': 'on_start'}], where src represents the category of the image element at the starting point, dst represents the category of the image element at the ending point, type2 represents the connection line type, and constraint represents the connection constraints.
[0043] In this embodiment, the constraints include constraint splitting attributes, logical expressions, and constraint relationship networks, wherein the constraint splitting attributes are inputs, outputs, performance, or services.
[0044] In one specific embodiment, a row of data in the image element structured constraint semantic table is {'input_constraints': [{'param': 'speed', 'range': [0, 200]}], 'performance_constraints': {'timeout': 500ms}}, where 'input_constraints' is the input in the constraint split attribute, 'range' is the value range of the logical expression, and 'performance_constraints' is the performance constraint in the constraint relationship network.
[0045] Step S2: Parse the source code file to obtain the second semantic information, wherein the source code file includes several code elements.
[0046] In this embodiment, the source code is Python or C++ code, and this embodiment is not limited to this.
[0047] In this embodiment, the parsing of the source code file to obtain the second semantic information, wherein the source code file includes several code elements, including: For the source code file, call the compiler front-end tool to extract the AST nodes and output the semantic annotation results of the AST nodes; Construct an AST node type relationship graph based on AST nodes; Obtain the business logic semantic processing label table from the source code file; Based on the semantic annotation results of AST nodes, the relationship diagram of AST node types, and the label table of business logic semantic processing, second semantic information is generated.
[0048] In this embodiment, the source code file is processed to extract AST nodes, and the semantic annotation results of the AST nodes are output, including: Extract the AST nodes from the source code file; Use OTXASTVisitor to traverse the AST nodes and identify the type of the AST nodes; Obtain the control complexity or data dependencies of AST nodes; Based on the type of AST node and the control complexity or data dependency of AST node, output the semantic annotation results of AST node.
[0049] In this embodiment, the AST node is of type control flow and data operation.
[0050] In one specific embodiment, the semantic annotation result of an AST node is {'node_type':'data_operation','dependencies':['var1→var2']}], where node_type is the type of AST node, data_operation is the data operation, dependencies are the data dependencies, and 'var1→var2' indicates that variable var1 depends on variable var2.
[0051] In this embodiment, an AST node type relationship graph is constructed based on AST nodes, including: An AST node type relationship graph is established based on the type relationships between related pairs of AST nodes. The type relationships include inheritance relationships, conversion rules, etc., which are not limited in this embodiment.
[0052] In this embodiment, the business logic semantic processing tag table is obtained based on the source code file, including: The code elements of the source code file are obtained. These code elements include function calls, flow code elements, etc., but this embodiment does not limit them. Obtain the preset business model, error handling logic, and performance optimization strategy for each code element; A business logic semantic processing tag table is established based on the preset business patterns, error handling logic, and performance optimization strategies of all code elements.
[0053] Step S3: Construct a graphic feature vector based on the first semantic information and a code feature vector based on the second semantic information. Align the dimensions of the graphic feature vector and the code feature vector and construct a bidirectional mapping. The bidirectional mapping includes a first mapping from the graphic feature vector to the code element and a second mapping from the code feature vector to the image element.
[0054] In this embodiment, constructing the graph feature vector based on the first semantic information includes: Based on the first semantic information, the category ratio, connectivity value, constraint value and topological feature value of the image elements are obtained; Graphical feature vectors are generated based on the category proportion, connectivity value, constraint value, and topological feature value of image elements.
[0055] In this embodiment, the category ratio of image elements is the proportion of the number of image elements in each category to the total number of image elements.
[0056] In this embodiment, the construction of code feature vectors based on the second semantic information includes: Based on the second semantic information, we can obtain syntactic complexity, type usage, business pattern weight, and code quality. Code feature vectors are generated based on syntactic complexity, type usage, business model weight, and code quality.
[0057] In this embodiment, the dimensions of the graphic feature vector and the code feature vector are aligned to facilitate the calculation of the similarity between the graphic feature vector and the code feature vector.
[0058] In this embodiment, step S3 further includes using DynamicWeightOptimizer to adjust the weights of each feature in the graphic feature vector and the code feature vector, reducing the weight of features with low accuracy and increasing the weight of features with high accuracy, to ensure that the combined weights of each feature in the graphic feature vector are 1, and to ensure that the combined weights of each feature in the code feature vector are 1.
[0059] In this embodiment, a bidirectional mapping is constructed, which includes a first mapping from graphic feature vectors to code elements and a second mapping from code feature vectors to image elements, including: The function `calculate_multimodal_similarity` is called to calculate the cosine similarity, structural similarity, and semantic similarity between the graphic feature vector and the code feature vector. The cosine similarity, structural similarity, and semantic similarity are weighted and summed to obtain the similarity score. The similarity score ranges from 0 to 1, with a score closer to 1 indicating a higher degree of matching. Call GraphicToCodeMapper.map() to extract the graphic feature vector, traverse the code elements in the source code file, calculate the similarity between the graphic feature vector and each code element, select the code element with the highest score as the graphic feature vector matching result, record the first confidence score, and establish the first mapping between the graphic feature vector and the code element with the highest score. Call CodeToGraphicMapper.map() to extract code feature vectors, traverse image elements, calculate the similarity between code feature vectors and each image element, select the code element with the highest score as the graph feature vector matching result, record the second confidence score, and establish a second mapping between code feature vectors and the image element with the highest score.
[0060] In this embodiment, the method further includes identifying and repairing conflicts between the first and second mappings.
[0061] In this embodiment, identifying the conflict between the first mapping and the second mapping includes: Call ConflictDetector.detect_conflicts() to check for type conflicts, data flow conflicts, control flow conflicts, and business logic conflicts, and output a list of conflicts, including the conflict type, location, and description. Call `calculate_conflict_score()` to score conflicts based on their impact scope (local / modal code element / system), fix difficulty, and business impact. Sort the conflicts by their scores and output the sorted list of conflicts.
[0062] In this embodiment, the conflict is repaired as follows: For conflicts with a conflict score greater than or equal to the first preset conflict threshold, call InteractiveResolver.present_solutions() to generate solutions that modify the graphical logic and adjust the business model of the code; For conflicts with a conflict score less than the first preset conflict threshold, AutoConflictResolver.resolve() is called. If the conflict is a type conflict, conversion code is generated; if the conflict is a data flow conflict, the data flow direction is adjusted; if the conflict is a control flow conflict, the control flow is modified; if the conflict is a business logic conflict, the business logic is modified.
[0063] According to the second aspect of this application, such as Figure 2 As shown, this embodiment provides a mapping system based on a dual semantic binding engine, the system comprising: The conversion module is used to parse image elements and obtain the first semantic information; An extraction module is used to parse source code files and obtain second semantic information, wherein the source code file includes several code elements; The mapping module is used to construct a graphic feature vector based on the first semantic information, construct a code feature vector based on the second semantic information, and construct a bidirectional mapping. The bidirectional mapping includes a first mapping from the graphic feature vector to the code element and a second mapping from the code feature vector to the image element.
[0064] In this embodiment, an identification module is also included, which is used to identify conflicts in the first mapping and the second mapping and to repair the conflicts.
[0065] Specifically, this embodiment corresponds one-to-one with the above method embodiments. The functions of each module code element have been described in detail in the corresponding method embodiments, so they will not be repeated here.
[0066] According to a third aspect of this application, this embodiment provides a computer-readable storage medium having a computer program stored thereon, the computer program including executable instructions that, when executed by a processor, implement the method described above.
[0067] The present invention can implement all or part of the processes in the above methods, or it can be accomplished by a computer program instructing related hardware. 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. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or system capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0068] According to the fourth aspect of this application, such as Figure 3 As shown, an electronic device is provided, comprising: One or more processors; Memory is used to store executable instructions for the processor, which, when executed by one or more processors, cause one or more processors to implement the methods described above.
[0069] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and a bus connecting different system components (including memory and processor).
[0070] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of a computer system, connecting all parts of the computer system through various interfaces and lines.
[0071] Memory can be used to store computer programs and / or modular code elements. The processor implements various functions of the computer system by running or executing the computer programs and / or modular code elements stored in the memory, and by accessing data stored in the memory. Memory can primarily include a program storage area and a data storage area. The program storage area can store the operating system and at least one application program required for a function (e.g., sound playback, image playback, etc.); the data storage area can store data created based on the use of the mobile phone (e.g., audio data, video data, etc.). Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital cards (SD cards), flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0072] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, servers, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and memory) containing computer-usable program code.
[0073] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), servers, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.
[0074] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0075] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0076] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0077] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0078] 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 the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for mapping based on a bi-semantic binding engine, characterized in that, The method comprises the following steps: parsing the image elements to obtain first semantic information; parsing the source code file to obtain second semantic information, wherein the source code file comprises a plurality of code elements; constructing a graphical feature vector based on the first semantic information and a code feature vector based on the second semantic information, wherein the dimensions of the graphical feature vector and the code feature vector are aligned, and a bidirectional mapping is constructed, wherein the bidirectional mapping comprises a first mapping of the graphical feature vector to the code elements and a second mapping of the code feature vector to the image elements.
2. The method of claim 1, wherein, The method of parsing the image elements to obtain the first semantic information comprises the following steps: traversing the image elements, classifying the image elements according to a preset coding system, and outputting an image element attribute list; analyzing the connection relationship between the image elements to construct an image element connection relationship list; analyzing the constraints of the image elements to output an image element structured constraint semantic table; generating the first semantic information based on the image element attribute list, the image element connection relationship list, and the image element structured constraint semantic table.
3. The method of claim 1, wherein, The method of parsing the source code file to obtain the second semantic information, wherein the source code file comprises a plurality of code elements, comprises the following steps: extracting an AST node from the source code file and outputting an AST node semantic annotation result; constructing an AST node type relationship graph based on the AST node; obtaining a business logic semantic processing tag table based on the source code file; generating the second semantic information based on the AST node semantic annotation result, the AST node type relationship graph, and the business logic semantic processing tag table.
4. The method of claim 3, wherein, The method of extracting an AST node from the source code file and outputting an AST node semantic annotation result comprises the following steps: extracting an AST node from the source code file; traversing the AST node to identify the type of the AST node; obtaining the control complexity or data dependency relationship of the AST node; The method of obtaining a business logic semantic processing tag table based on the source code file comprises the following steps: obtaining the code elements of the source code file; obtaining the preset business mode, error handling logic, and performance optimization strategy of each code element; establishing a business logic semantic processing tag table based on the preset business mode, error handling logic, and performance optimization strategy of all code elements.
5. The method of claim 1, wherein, The method of constructing a graphical feature vector based on the first semantic information and a code feature vector based on the second semantic information, wherein the dimensions of the graphical feature vector and the code feature vector are aligned, comprises the following steps: obtaining the category proportion, connection value, constraint value, and topological feature value of the image elements based on the first semantic information; generating a graphical feature vector based on the category proportion, connection value, constraint value, and topological feature value of the image elements; obtaining the syntax complexity, type usage degree, business mode weight, and code quality based on the second semantic information; generating a code feature vector based on the syntax complexity, type usage degree, business mode weight, and code quality.
6. The method of claim 1, wherein, The method of constructing a bidirectional mapping, wherein the bidirectional mapping comprises a first mapping of the graphical feature vector to the code elements and a second mapping of the code feature vector to the image elements, comprises the following steps: Calculate the cosine similarity, structural similarity and semantic similarity between the graph feature vector and the code feature vector, and obtain a similarity score by weighted sum of the cosine similarity, structural similarity and semantic similarity; Extract the graph feature vector, traverse the code elements in the source code file, calculate the similarity between the graph feature vector and each code element, select the code element with the highest score as the matching result of the graph feature vector, record the first confidence, and establish a first mapping between the graph feature vector and the code element with the highest score. Extract the code feature vector, traverse the image elements, calculate the similarity between the code feature vector and each image element, select the code element with the highest score as the matching result of the graph feature vector, record the second confidence, and establish a second mapping between the code feature vector and the image element with the highest score.
7. The method of claim 1, wherein, Also includes: Identify conflicts in the first mapping and the second mapping, and repair the conflicts, specifically: Check type conflicts, data flow conflicts, control flow conflicts, and business logic conflicts, output a conflict list, and the conflict list includes conflict type, location, and description; Weighted sum of impact range, repair difficulty value and business impact degree to score the conflicts, sort them according to the conflict score, and output the sorted conflict list; For conflicts with a conflict score greater than or equal to a first preset conflict threshold, generate a solution to modify the graphical logic and adjust the code business mode; For conflicts with a conflict score less than the first preset conflict threshold, if the conflict is a type conflict, generate a converted code; If the conflict is a data flow conflict, adjust the data flow direction; If the conflict is a control flow conflict, modify the control flow; if the conflict is a business logic conflict, modify the business logic.
8. A mapping system based on a bi-semantic binding engine, characterized in that, Includes: A conversion module for parsing image elements and obtaining first semantic information; An extraction module for parsing a source code file and obtaining second semantic information, wherein the source code file includes a plurality of code elements; A mapping module for constructing a graph feature vector based on the first semantic information and a code feature vector based on the second semantic information, aligning the dimensions of the graph feature vector and the code feature vector, and constructing a bidirectional mapping including a first mapping of the graph feature vector to the code element and a second mapping of the code feature vector to the image element.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program includes executable instructions that, when executed by a processor, implement the method of any one of claims 1-7.
10. An electronic device, comprising: Includes: One or more processors; A memory for storing executable instructions of the processor, which, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
Citation Information
Patent Citations
Secure communication method, device and equipment for vehicle diagnosis and storage medium
CN117631655A