Block diagram generation method and device, electronic equipment and storage medium
By obtaining and converting block diagram description code, the method of generating block diagram solves the problem of low block diagram generation efficiency, realizes convenient and efficient block diagram generation, and ensures the accuracy of generated code through error detection.
Patent Information
- Application Number
- CN202410989397.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
AI Technical Summary
During the block diagram generation process, as the graphic elements increase, manual drag and adjustment become cumbersome, resulting in low generation efficiency.
By obtaining the target block diagram description code, converting it into generated code, compiling it to generate block diagrams, improving efficiency.
In the case of a large number of graphic elements, it is easier to generate block diagrams using code than manually dragging, which significantly improves the efficiency of block diagram generation, and ensures the accuracy of generated codes through error detection and correction.
Smart Images

Figure CN118939241A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for generating a block diagram, an electronic device, and a storage medium. Background Art
[0002] A block diagram is a graphical method that uses graphic elements (such as rectangles, circles, diamonds, arrows, etc.) to represent the relationship between systems, processes, algorithms or concepts. Block diagrams are used to display the hierarchy of information or process steps.
[0003] In the related technology of block diagram generation, the block diagram is usually generated by dragging selected graphic elements and placing them in specific positions. If the generated block diagram contains a large number of graphic elements, the selected graphic elements need to be repeatedly dragged, resulting in low efficiency of block diagram generation. Summary of the invention
[0004] The present disclosure provides a method and device for generating a block diagram, an electronic device and a storage medium, the main purpose of which is to solve the problem of low efficiency in generating a block diagram.
[0005] According to a first aspect of the present disclosure, a method for generating a block diagram is provided, comprising:
[0006] When it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold, obtaining a target block diagram description code of the block diagram to be generated; the target block diagram description code describes the graphic elements through a code;
[0007] Converting the target block diagram description code into a target block diagram generation code;
[0008] The target block diagram generation code is compiled to obtain the block diagram to be generated.
[0009] Optionally, after obtaining the target block diagram description code of the block diagram to be generated, the method includes:
[0010] Determine whether there is an error in the target block diagram description code;
[0011] If it is determined that the target block diagram description code has an error, an alarm message of the error in the target block diagram description code is output, so that the target block diagram description code can be corrected based on the alarm message.
[0012] Optionally, determining whether there is an error in the target block diagram description code includes:
[0013] Obtaining the identification name of the graphic element in the target block diagram description code, and obtaining the coordinates of the graphic element in the target block diagram description code;
[0014] Determine whether there are at least two identical identification names among the identification names; and / or,
[0015] Determine whether the coordinates exceed a preset boundary range.
[0016] Optionally, determining that there is an error in the target block diagram description code includes at least one of determining that there are at least two identical identification names in the identification names and determining that the coordinates exceed the preset boundary range.
[0017] Optionally, converting the target block diagram description code into a target block diagram generation code includes:
[0018] Acquire variables in the target block diagram description code; the variables include at least one of the identification name of the graphic element, the coordinates of the graphic element, and the connection relationship between the graphic elements;
[0019] According to the pre-established mapping relationship between the block diagram description code and the block diagram generation code, searching for the block diagram generation code corresponding to the target block diagram description code;
[0020] And the variable is added to the block diagram generation code to obtain the target block diagram generation code.
[0021] According to a second aspect of the present disclosure, a block diagram generation device is provided, comprising:
[0022] An acquisition unit, configured to acquire a target block diagram description code of the block diagram to be generated when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold; the target block diagram description code describes the graphic elements through a code;
[0023] A conversion unit, used for converting the target block diagram description code into a target block diagram generation code;
[0024] The compiling unit is used to compile the target block diagram generation code to obtain the block diagram to be generated.
[0025] Optionally, the device further comprises:
[0026] A determination unit, configured to determine whether there is an error in the target block diagram description code after obtaining the target block diagram description code of the block diagram to be generated;
[0027] The output unit is used to output warning information of the error in the target block diagram description code when it is determined that the target block diagram description code has an error, so as to correct the target block diagram description code based on the warning information.
[0028] Optionally, the determining unit includes:
[0029] A first acquisition module, used for acquiring the identification name of the graphic element in the target block diagram description code, and acquiring the coordinates of the graphic element in the target block diagram description code;
[0030] a determination module, used to determine whether there are at least two identification names with the same name among the identification names; and / or,
[0031] Determine whether the coordinates exceed a preset boundary range.
[0032] Optionally, determining that there is an error in the target block diagram description code includes at least one of determining that there are at least two identical identification names in the identification names and determining that the coordinates exceed the preset boundary range.
[0033] Optionally, the conversion unit comprises:
[0034] A second acquisition module is used to acquire variables in the target block diagram description code; the variables include at least one of the identification name of the graphic element, the coordinates of the graphic element, and the connection relationship between the graphic elements;
[0035] A search module, used for searching the block diagram generation code corresponding to the target block diagram description code according to a pre-established mapping relationship between the block diagram description code and the block diagram generation code;
[0036] An adding module is used to add the variable to the block diagram generation code to obtain the target block diagram generation code.
[0037] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0038] at least one processor; and
[0039] a memory communicatively connected to the at least one processor; wherein,
[0040] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0041] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0042] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.
[0043] The block diagram generation method and device, electronic device and storage medium provided by the present disclosure, when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold, obtains the target block diagram description code of the block diagram to be generated; the target block diagram description code describes the graphic elements through code; the target block diagram description code is converted into a target block diagram generation code; the target block diagram generation code is compiled to obtain the block diagram to be generated. Compared with the related art, the embodiment of the present disclosure obtains the target block diagram description code of the block diagram to be generated, converts the target block diagram description code into a target block diagram generation code, and compiles the target block diagram generation code to obtain the block diagram to be generated. When the number of graphic elements in the block diagram to be generated is large, using code to generate the block diagram is more convenient than dragging the graphic elements to generate the block diagram, thereby improving the efficiency of block diagram generation.
[0044] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0046] Figure 1 A flowchart of a method for generating a block diagram provided by an embodiment of the present disclosure;
[0047] Figure 2 A flowchart of a method for processing errors in a target block diagram description code provided by an embodiment of the present disclosure;
[0048] Figure 3 A block diagram to be generated provided by an embodiment of the present disclosure;
[0049] Figure 4 Another block diagram to be generated provided by an embodiment of the present disclosure;
[0050] Figure 5 A schematic diagram of the structure of a block diagram generation device provided in an embodiment of the present disclosure;
[0051] Figure 6 A schematic diagram of the structure of a block diagram generation device provided in an embodiment of the present disclosure;
[0052] Figure 7 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0053] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0054] The following describes a method and apparatus for generating a block diagram, an electronic device, and a storage medium according to an embodiment of the present disclosure with reference to the accompanying drawings.
[0055] Figure 1 A flowchart of a method for generating a block diagram provided in an embodiment of the present disclosure is provided.
[0056] like Figure 1 As shown, the method is applied to a block diagram generation compiler, and the method comprises the following steps:
[0057] Step 101, when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold, obtain a target block diagram description code of the block diagram to be generated; the target block diagram description code describes the graphic elements through code.
[0058] The block diagram to be generated is a graphical representation that has not yet been created or generated. This representation usually uses a combination of graphics, lines, symbols and other elements to show a certain structure, process or information. The block diagram to be generated includes but is not limited to flow charts, network topology diagrams, organizational charts, Unified Modeling Language (UML) diagrams, data flow diagrams, entity-relationship (ER) diagrams, architecture diagrams, state diagrams, and timing diagrams.
[0059] The preset threshold value may be any value, for example, 10, but it should be clear that this statement is not intended to limit the value of the preset threshold value to 10, it may also be other values, and the embodiments of the present disclosure do not limit this.
[0060] Graphic elements are the basic units that make up the block diagram to be generated. Graphic elements include but are not limited to nodes, connecting lines, and text labels. Among them, nodes are basic graphic elements, which are used to represent a specific entity or concept. These entities or concepts have specific roles or positions in the entire diagram. For example, in a flowchart, a node can represent a specific step or operation. Each node is usually represented by a box or oval, with a description or label of the operation written inside. In an organizational chart, a node usually represents a specific department, position, or person. Each node may include information such as department name, position title, or person name. In a network topology diagram, a node can represent a device in the network, such as a router, switch, or computer. A node can display the name, IP address, or other key information of the device.
[0061] The target block diagram description code is a text that describes the block diagram in the form of program code. The target block diagram description code does not use a graphical interface to directly draw graphic elements, but defines the properties of each graphic element (including but not limited to the position, size, color, and text content of the graphic element) and the relationship between the graphic elements (including but not limited to connection relationships and hierarchical relationships) by writing code. The target block diagram description code provides a flexible way to generate complex block diagrams, especially when the number or complexity of graphic elements exceeds the ability to draw manually, wherein the target block diagram description code is obtained by manual programming.
[0062] For complex block diagrams containing a large number of graphic elements, it may be very difficult to draw directly, or even impossible to fully express all the details and logic. However, describing through code can handle these complexities more flexibly, such as dynamically generating graphic elements and layouts through programming structures such as loops and conditional statements.
[0063] For ease of understanding, an example is provided. Assume that there is a graphic element a, graphic elements b1,...b in the block diagram to be generated. 10 It needs to be connected to a through connecting lines respectively. Drawing by dragging requires 10 repeated operations, while it can be achieved through code with only one for loop statement.
[0064] Step 102: convert the target block diagram description code into a target block diagram generation code.
[0065] The target block diagram generation code is a code specifically used to generate a block diagram. Unlike the target block diagram description code, the target block diagram generation code usually includes but is not limited to control instructions for the display of specific graphic elements. These control instructions involve the call of graphics rendering libraries, drawing application programming interfaces (APIs) or other graphics processing technologies to ensure that the final generated block diagram can accurately reflect the intention in the original description code. The target block diagram composition code can be Java code or Python code, but it should be clear that this statement is not intended to limit the target block diagram composition code to only Java code or Python code, but can also be other codes that can generate block diagrams.
[0066] There are first fixed codes and variables in the target block diagram description code, and there are second fixed codes and an area to be filled in the target block diagram generation code. A mapping relationship between the first fixed code and the second fixed code is established, and then a mapping relationship between the target block diagram description code and the target block diagram generation code is established, and the variables in the target block diagram description code are added to the area to be filled corresponding to the target block diagram generation code.
[0067] The target block diagram generation code contains the control instructions for the display of specific graphic elements, which is relatively complex. The efficiency of directly programming the target block diagram generation code manually is low. The target block diagram description code is simpler than the target block diagram generation code, and the efficiency of manual programming is higher. By manually programming the target block diagram description code and then automatically converting the target block diagram description code into the target block diagram generation code, the programming efficiency of the target block diagram generation code can be improved.
[0068] Step 103, compile the target block diagram generation code to obtain the block diagram to be generated.
[0069] The target block diagram generation code is loaded into the block diagram generation compiler, and the block diagram generation compiler executes the loaded target block diagram generation code. In this process, the instructions in the target block diagram generation code will be executed one by one to generate or call functions in the drawing library to create graphic elements (such as nodes, connecting lines, shapes, etc.) and set the properties of the graphic elements (such as position, size, color, etc.). The drawing library or framework builds an image representation of the block diagram in memory according to the instructions in the generated code.
[0070] By compiling the target block diagram generation code, you can flexibly adjust and modify the target block diagram generation process, such as adding new graphic elements, adjusting the layout or modifying the style. Such flexibility makes it easier and more efficient to iterate and optimize the block diagram design.
[0071] The block diagram generation method provided by the present disclosure, when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold, obtains the target block diagram description code of the block diagram to be generated; the target block diagram description code describes the graphic elements through code; the target block diagram description code is converted into a target block diagram generation code; the target block diagram generation code is compiled to obtain the block diagram to be generated. Compared with the related art, the embodiment of the present disclosure obtains the target block diagram description code of the block diagram to be generated, converts the target block diagram description code into a target block diagram generation code, and compiles the target block diagram generation code to obtain the block diagram to be generated. When the number of graphic elements in the block diagram to be generated is large, it is more convenient to generate the block diagram using code than to generate the block diagram by dragging the graphic elements, thereby improving the efficiency of block diagram generation.
[0072] In practical applications, after obtaining the target block diagram description code of the block diagram to be generated, the target block diagram description code may have errors. In order to make the final generated block diagram to be generated accurate, it is necessary to process the target block diagram description code with errors, which can be implemented in but not limited to the following ways, such as Figure 2 As shown, Figure 2 A flowchart of a method for processing an error in a target block diagram description code provided by an embodiment of the present disclosure, the method comprising:
[0073] Step 201, determining whether there is an error in the target block diagram description code.
[0074] Since the target block diagram description code is obtained by manual programming, the target block diagram description code may contain errors. In order to make the final generated block diagram to be generated accurate, it is necessary to determine whether the target block diagram description code has errors. Each graphic element in the block diagram to be generated has a unique identification name and corresponding coordinates. If there are multiple identical identification names in the target block diagram description code, it is determined that there is an error in the target block diagram description code, and / or, if the coordinates of the graphic elements in the target block diagram description code exceed the preset boundary range, it is determined that there is an error in the target block diagram description code.
[0075] Check the target block diagram to see if there are any errors in the code to ensure that the code can perform the intended functions correctly.
[0076] Step 202: If it is determined that the target block diagram description code has an error, outputting an alarm message of the error in the target block diagram description code, so as to correct the target block diagram description code based on the alarm message.
[0077] By timely discovering and correcting errors in the code, the quality of the target block diagram description code can be significantly improved. This helps ensure the correctness, reliability and maintainability of the code, and lays a solid foundation for subsequent code conversion and block diagram generation.
[0078] For ease of understanding, an example is provided. Assuming that there are two identical identification names in the target block diagram description code, the alarm information includes information that there are errors in the two identification names. Based on the alarm information, the two identical identification names are corrected.
[0079] As a refinement of step 201, when executing the determination whether there is an error in the target block diagram description code, it can be implemented in the following manners, but not limited to, obtaining the identification name of the graphic element in the target block diagram description code, and obtaining the coordinates of the graphic element in the target block diagram description code; determining whether there are at least two identification names with the same name in the identification names; and / or determining whether the coordinates exceed a preset boundary range. This can ensure that the graphic elements in the target block diagram description code can be correctly identified and used in the software.
[0080] As a refinement of the above embodiment, the determining that there is an error in the target block diagram description code includes at least one of determining that there are at least two identical identification names in the identification names and determining that the coordinates exceed the preset boundary range.
[0081] As a refinement of step 102, when executing the conversion of the target block diagram description code into the target block diagram generation code, it can be implemented in the following manner but not limited to: obtaining variables in the target block diagram description code; the variables include at least one of the identification name of the graphic element, the coordinates of the graphic element, and the connection relationship between the graphic elements; according to the pre-established mapping relationship between the block diagram description code and the block diagram generation code, searching for the block diagram generation code corresponding to the target block diagram description code; and adding the variables to the block diagram generation code to obtain the target block diagram generation code. By treating the identification name, coordinates, and connection relationship of the graphic element as variables and adding them to the block diagram generation code, the generated code can be made clearer, easier to understand, and maintain. This helps with subsequent code review, testing, and debugging.
[0082] In one possible implementation of the embodiment of the present disclosure, in order to facilitate a better understanding of the target block diagram description code, a code example of the target block diagram description code is provided.
[0083] Node declaration:
[0084]
[0085]
[0086] Here are some examples:
[0087]
[0088] Set the node position:
[0089]
[0090] Here are some examples:
[0091] Position investor(1,10) / / Sets the investor's position to(1,10)
[0092] Side statement:
[0093]
[0094] Add the edge declaration:
[0095] 'AddEdge'edgeName=[Edge]'Link'nodeFront=[Node]'And'nodeEnd=[Node];
[0096] Node array declaration:
[0097] DefineArray:
[0098] 'Create"NodeList'name=ID'of"{'innerList+=[Node]+'}';
[0099] Iterate over the nodes array:
[0100]
[0101] Here are some examples:
[0102]
[0103] In order to facilitate a better understanding of the target block diagram generation code, a code example of a target block diagram generation code is provided.
[0104]
[0105]
[0106] In order to facilitate a better understanding of converting a target block diagram description code into a target block diagram generation code, an example is provided.
[0107] Target block diagram description code
[0108]
[0109] Target Block Diagram Code Generation
[0110]
[0111] In order to better understand the generated block diagram, Figure 3 , Figure 4 As shown, Figure 3 A block diagram to be generated provided by an embodiment of the present disclosure, Figure 4 Another block diagram to be generated is provided in an embodiment of the present disclosure.
[0112] Figure 3 , Figure 4 The corresponding target block diagram description code is as follows:
[0113]
[0114] In summary, the embodiments of the present disclosure can achieve the following effects:
[0115] The disclosed embodiment obtains the target block diagram description code of the block diagram to be generated, converts the target block diagram description code into the target block diagram generation code, and compiles the target block diagram generation code to obtain the block diagram to be generated. When the number of graphic elements in the block diagram to be generated is large, it is more convenient to generate the block diagram by code than to drag the graphic elements to generate the block diagram, thereby improving the efficiency of block diagram generation.
[0116] Corresponding to the above block diagram generation method, the present invention also provides a block diagram generation device. Since the device embodiment of the present invention corresponds to the above method embodiment, the details not disclosed in the device embodiment can be referred to the above method embodiment, and will not be repeated in the present invention.
[0117] Figure 5 A schematic diagram of a block diagram generation device provided in an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the device is applied to a block diagram generation compiler, comprising:
[0118] An acquisition unit 31 is configured to acquire a target block diagram description code of the block diagram to be generated when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold; the target block diagram description code describes the graphic elements through a code;
[0119] A conversion unit 32, used for converting the target block diagram description code into a target block diagram generation code;
[0120] The compiling unit 33 is used to compile the target block diagram generation code to obtain the block diagram to be generated.
[0121] The block diagram generation device provided by the present disclosure obtains the target block diagram description code of the block diagram to be generated when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold; the target block diagram description code describes the graphic elements through code; the target block diagram description code is converted into a target block diagram generation code; the target block diagram generation code is compiled to obtain the block diagram to be generated. Compared with the related art, the embodiment of the present disclosure obtains the target block diagram description code of the block diagram to be generated, converts the target block diagram description code into a target block diagram generation code, and compiles the target block diagram generation code to obtain the block diagram to be generated. When the number of graphic elements in the block diagram to be generated is large, using code to generate a block diagram is more convenient than dragging graphic elements to generate a block diagram, thereby improving the efficiency of block diagram generation.
[0122] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the device also includes:
[0123] A determination unit 34 is used to determine whether there is an error in the target block diagram description code after obtaining the target block diagram description code of the block diagram to be generated;
[0124] The output unit 35 is used to output warning information of the error in the target block diagram description code when it is determined that the target block diagram description code has an error, so as to correct the target block diagram description code based on the warning information.
[0125] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the determining unit 34 includes:
[0126] The first acquisition module 341 is used to acquire the identification name of the graphic element in the target block diagram description code, and acquire the coordinates of the graphic element in the target block diagram description code;
[0127] The determination module 342 is used to determine whether there are at least two identical identification names in the identification names; and / or,
[0128] Determine whether the coordinates exceed a preset boundary range.
[0129] Further, in a possible implementation of the present embodiment, the determining that there is an error in the target block diagram description code includes at least one of determining that there are at least two identical identification names in the identification names and determining that the coordinates exceed the preset boundary range.
[0130] Furthermore, in a possible implementation of this embodiment, as Figure 6 As shown, the conversion unit 32 includes:
[0131] The second acquisition module 321 is used to acquire variables in the target block diagram description code; the variables include at least one of the identification name of the graphic element, the coordinates of the graphic element, and the connection relationship between the graphic elements;
[0132] A search module 322, configured to search for a block diagram generation code corresponding to the target block diagram description code according to a pre-established mapping relationship between the block diagram description code and the block diagram generation code;
[0133] The adding module 323 is used to add the variable to the block diagram generation code to obtain the target block diagram generation code.
[0134] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.
[0135] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0136] Figure 7 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0137] like Figure 7 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 402 or a computer program loaded from a storage unit 408 to a RAM (Random Access Memory) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An I / O (Input / Output) interface 405 is also connected to the bus 404.
[0138] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0139] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the generation method of the block diagram. For example, in some embodiments, the generation method of the block diagram may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the generation method of the aforementioned block diagram in any other appropriate manner (for example, by means of firmware).
[0140] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0142] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0144] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0145] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0146] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0148] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating a block diagram, characterized in that: include: When it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold, obtaining a target block diagram description code of the block diagram to be generated; The target block diagram description code describes the graphic element through code; Converting the target block diagram description code into a target block diagram generation code; The target block diagram generation code is compiled to obtain the block diagram to be generated.
2. The method according to claim 1, characterized in that After obtaining the target block diagram description code of the block diagram to be generated, the method includes: Determine whether there is an error in the target block diagram description code; If it is determined that the target block diagram description code has an error, an alarm message of the error in the target block diagram description code is output, so that the target block diagram description code can be corrected based on the alarm message.
3. The method according to claim 2, characterized in that Determining whether the target block diagram description code has an error includes: Obtaining the identification name of the graphic element in the target block diagram description code, and obtaining the coordinates of the graphic element in the target block diagram description code; Determine whether there are at least two identical identification names among the identification names; and / or, Determine whether the coordinates exceed a preset boundary range.
4. The method according to claim 3, characterized in that The determining that there is an error in the target block diagram description code includes at least one of determining that there are at least two identical identification names in the identification names and determining that the coordinates exceed the preset boundary range.
5. The method according to claim 1, characterized in that The converting the target block diagram description code into a target block diagram generation code comprises: Acquire variables in the target block diagram description code; the variables include at least one of the identification name of the graphic element, the coordinates of the graphic element, and the connection relationship between the graphic elements; According to the pre-established mapping relationship between the block diagram description code and the block diagram generation code, searching for the block diagram generation code corresponding to the target block diagram description code; And the variable is added to the block diagram generation code to obtain the target block diagram generation code.
6. A block diagram generating device, characterized in that: include: An acquisition unit, configured to acquire a target block diagram description code of the block diagram to be generated when it is determined that the number of graphic elements in the block diagram to be generated exceeds a preset threshold; The target block diagram description code describes the graphic element through code; A conversion unit, used for converting the target block diagram description code into a target block diagram generation code; The compiling unit is used to compile the target block diagram generation code to obtain the block diagram to be generated.
7. The device according to claim 6, characterized in that The device also includes: A determination unit, configured to determine whether there is an error in the target block diagram description code after obtaining the target block diagram description code of the block diagram to be generated; The output unit is used to output warning information of the error in the target block diagram description code when it is determined that the target block diagram description code has an error, so as to correct the target block diagram description code based on the warning information.
8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.
