Code labeling method, apparatus, device, medium, and program product
By leveraging the mapping relationship between business architecture and information technology architecture in large enterprise information systems, the comment information in information technology code is replaced with the annotation information of business architecture, thus solving the problem of unclear business scope in the code and improving code quality and acceptance efficiency.
Patent Information
- Application Number
- CN202210649876.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-09
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-06-09
AI Technical Summary
In large enterprise information systems, due to the high coupling between interfaces, programs, and code, developers often lack a clear understanding of the business scope when writing code, making it difficult to guarantee code quality and posing potential security risks.
By acquiring information technology code, code comment information is extracted based on preset comment extraction rules. Then, by utilizing the mapping relationship between business architecture and information technology architecture, the code comment information is replaced with code annotation information that reflects the business architecture, thus clarifying the scope of the code on the business side.
It improves the efficiency and accuracy of business acceptance of code, helps with later code modification and business testing operations, and ensures code quality.
Smart Images

Figure CN115033279B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information technology, specifically to business architecture and internet financial technology, and more specifically to a code annotation method, apparatus, device, medium, and program product. Background Technology
[0002] Currently, the information systems of large enterprises are complex in structure. During production operation, due to the high coupling between interfaces, programs, and code, developers often do not have a clear understanding of the business scope affected by the code, making it difficult to guarantee the quality of the code and creating potential security risks for the information system.
[0003] Therefore, ensuring that the code clearly corresponds to the business scope is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] In view of the above problems, this disclosure provides code annotation methods, devices, equipment, media and program products to improve the efficiency and accuracy of business acceptance.
[0005] According to a first aspect of this disclosure, a code annotation method is provided, the method being implemented based on a business architecture and an information technology architecture, wherein the business architecture includes multiple business sub-models at different levels, and the information technology architecture includes multiple information service sub-models at different granularities. The method includes: acquiring information technology code; extracting code annotation information from the information technology code based on preset annotation extraction rules, wherein the code annotation information reflects the information technology architecture; acquiring a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes mapping relationships between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes mapping relationships between business sub-models at different levels in the business architecture; and replacing the code annotation information with code annotation information based on the first mapping relationship and the second mapping relationship, wherein the code annotation information reflects the business architecture.
[0006] According to an embodiment of this disclosure, the preset annotation extraction rule includes: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location.
[0007] According to embodiments of this disclosure, the business architecture includes business sub-models at different levels, including: between adjacent levels, the business sub-model at an upper level includes multiple different business sub-models at lower levels, wherein the first mapping relationship includes: the correspondence between the information service sub-model in the information technology architecture and the business sub-model at any level in the business architecture; the second mapping relationship includes: multiple business chain relationships, wherein the business chain relationship is from the highest level business sub-model to the business sub-model at any level.
[0008] According to embodiments of this disclosure, the first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: obtaining the corresponding first information service sub-model based on the code comment information; obtaining the first business sub-model based on the first information service sub-model and the first mapping relationship, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and obtaining the first business chain relationship corresponding to the first business sub-model based on the first business sub-model.
[0009] According to embodiments of this disclosure, the first mapping relationship further includes a many-to-many mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship further includes: obtaining a third mapping relationship, the third mapping relationship including a mapping relationship between the second business sub-model and the second information service sub-model, wherein the second business sub-model includes a business sub-model at the adjacent upper level of the first business sub-model; and replacing the code comment information with code annotation information based on the third mapping relationship and the second mapping relationship.
[0010] According to an embodiment of this disclosure, replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: matching the code comment information with a business chain relationship in a preset corpus through the first mapping relationship and the second mapping relationship to obtain a first business chain relationship; and extracting the code annotation information based on the first business chain relationship.
[0011] According to embodiments of this disclosure, the business architecture includes a process model, a product model, and an entity model; the process model includes a business domain, the business domain includes a value stream, the value stream includes activities, and the activities include tasks; the product includes a product line, the product line includes a product group, the product group includes a base product, and the base product includes a marketable product; the entity includes a business object, and the business object includes a core entity, a lifecycle, subordinate entities, business object relationships, and constraints.
[0012] A second aspect of this disclosure provides a code annotation device, implemented based on a business architecture and an information technology architecture. The business architecture includes multiple business sub-models at different levels, and the information technology architecture includes multiple information service sub-models at different granularities. The device includes: a code acquisition module, a code annotation extraction module, a mapping relationship acquisition module, and a code annotation module. The code acquisition module is used to acquire information technology code. The code annotation extraction module is used to extract code annotation information from the information technology code based on preset annotation extraction rules, wherein the code annotation information reflects the information technology architecture. The mapping relationship acquisition module is used to acquire a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes mapping relationships between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes mapping relationships between business sub-models at different levels in the business architecture. The code annotation module is used to replace the code annotation information with code annotation information based on the first mapping relationship and the second mapping relationship, wherein the code annotation information reflects the business architecture.
[0013] According to an embodiment of this disclosure, the preset annotation extraction rule includes: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location.
[0014] According to embodiments of this disclosure, the business architecture includes business sub-models at different levels, including: between adjacent levels, the business sub-model at an upper level includes multiple different business sub-models at lower levels, wherein the first mapping relationship includes: the correspondence between the information service sub-model in the information technology architecture and the business sub-model at any level in the business architecture; the second mapping relationship includes: multiple business chain relationships, wherein the business chain relationship is from the highest level business sub-model to the business sub-model at any level.
[0015] According to embodiments of this disclosure, the first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: obtaining the corresponding first information service sub-model based on the code comment information; obtaining the first business sub-model based on the first information service sub-model and the first mapping relationship, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and obtaining the first business chain relationship corresponding to the first business sub-model based on the first business sub-model.
[0016] According to embodiments of this disclosure, the first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The code annotation module is further configured to: obtain the corresponding first information service sub-model based on the code annotation information; obtain the first business sub-model based on the first information service sub-model and the first mapping relationship, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and obtain the first business chain relationship corresponding to the first business sub-model based on the first business sub-model.
[0017] According to embodiments of this disclosure, the first mapping relationship further includes a many-to-many mapping relationship between the business sub-model and the information service sub-model. The code annotation module is also used to obtain a third mapping relationship, which includes the mapping relationship between the second business sub-model and the second information service sub-model, wherein the second business sub-model includes a business sub-model at the upper level adjacent to the first business sub-model.
[0018] According to an embodiment of this disclosure, the device further includes an information display module, wherein the information display module is configured to obtain location mapping data based on the code annotation information and the code comment location, wherein the location mapping data is relational data; and to establish a code annotation information pop-up window based on the location mapping data.
[0019] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the code annotation method described above.
[0020] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the code annotation method described above.
[0021] A fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described code annotation method. Attached Figure Description
[0022] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0023] Figure 1A The diagram illustrates an application scenario of the code annotation method according to an embodiment of the present disclosure.
[0024] Figure 1B A schematic diagram of a business architecture according to an embodiment of the present disclosure is shown.
[0025] Figure 1C An information technology architecture diagram according to an embodiment of the present disclosure is illustrated schematically.
[0026] Figure 2 A flowchart illustrating a code annotation method according to an embodiment of the present disclosure is shown schematically. Figure 3 A flowchart illustrating another method of code annotation according to an embodiment of this disclosure is shown schematically.
[0027] Figure 4 The flowchart illustrating the method for creating a code annotation information pop-up window according to an embodiment of the present disclosure is shown.
[0028] Figure 5 A schematic diagram illustrating a full flowchart of code annotation according to an embodiment of the present disclosure is shown.
[0029] Figure 6 The illustration shows a code-annotated display diagram of an embodiment of the present disclosure.
[0030] Figure 7 A schematic block diagram of a code annotation apparatus according to an embodiment of the present disclosure is shown.
[0031] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing a code annotation method according to an embodiment of the present disclosure. Detailed Implementation
[0032] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0033] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0034] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0035] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0036] The following explains the technical terms used in the embodiments of this disclosure:
[0037] Information Technology (IT) mainly involves the design, development, installation, and implementation of information systems and application software through the application of computer science and communication technologies.
[0038] Business architecture: Business architecture is a top-down, structured model that describes a company's business. It includes textual descriptions and relationships of process models, product models, and entity models currently used by the company.
[0039] Information technology architecture: The information technology-based architecture that corresponds to the business architecture. It is a top-down, structured model that describes the enterprise's business through code. Information technology architecture includes multiple information service sub-models with different granularities.
[0040] Information service sub-model: Corresponds to the business sub-models at different levels in the business architecture, to distinguish different granularities of representation.
[0041] To address the technical problems existing in the prior art, embodiments of this disclosure provide a code annotation method, comprising: acquiring information technology code; extracting code annotation information from the information technology code based on preset annotation extraction rules, wherein the code annotation information reflects the information technology architecture; acquiring a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes mapping relationships between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes mapping relationships between business sub-models at different levels in the business architecture; and replacing the code annotation information with code annotation information based on the first mapping relationship and the second mapping relationship, wherein the code annotation information reflects the business architecture.
[0042] In the embodiments disclosed herein, the replacement between code comment information and code annotation information is achieved by using a first mapping relationship between the business sub-model and the information technology architecture as a bridge. This clarifies the scope of the code on the business side, which is beneficial for subsequent business change operations involving code modification or business testing operations.
[0043] Figure 1A The diagram illustrates an application scenario of the code annotation method according to an embodiment of the present disclosure.
[0044] like Figure 1A As shown, application scenario 100 according to this embodiment may include terminal devices 101, 102, and 103, network 104, and server 105. Network 104 is used as a medium to provide a communication link between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0045] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0046] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0047] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0048] It should be noted that the code annotation method provided in this embodiment can generally be executed by server 105. Correspondingly, the code annotation device provided in this embodiment can generally be located in server 105. The code annotation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the code annotation device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.
[0049] It should be understood that Figure 1A The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0050] According to embodiments of this disclosure, the business architecture includes business sub-models at different levels, including: between adjacent levels, the business sub-model at an upper level includes multiple different business sub-models at lower levels.
[0051] Figure 1B A schematic diagram of a business architecture according to an embodiment of the present disclosure is shown.
[0052] like Figure 1B The business architecture described herein is a top-down, structured model that describes an enterprise's business. The business architecture includes a process model, a product model, and an entity model. The process model includes business domains, which in turn include value streams, which include activities, and activities include tasks. The products include product lines, which include product groups, which include base products, and base products include marketable products. The entities include business objects, which include core entities, lifecycles, subordinate entities, business object relationships, and constraints.
[0053] A process model refers to a process description that divides business operations in different business areas based on the planning, execution, and monitoring value streams. Each value stream is divided into different activities, and each activity is broken down into tasks. Tasks are further broken down into steps according to business rules and conditions. There are five levels in total (Business Area - Value Stream - Activity - Mission - Step).
[0054] A process model can be understood as a model that views business from a process perspective, and it can be applied to business areas across different industries. Taking banking as an example, in a process model:
[0055] Business areas generally include, but are not limited to: personal deposits, financial products, self-investment, and personal loans.
[0056] Value stream generally includes, but is not limited to: business plan, business preparation, and customer service.
[0057] Activities generally include, but are not limited to: issuing credit cards, establishing management systems, withdrawing credit card funds, and repaying credit card debts.
[0058] Missions generally include, but are not limited to: identifying customers, monitoring real-time fraud risks, processing credit card withdrawal requests, and settling foreign exchange.
[0059] It is understandable that in business architecture, process models and different levels within process models can be seen as dividing the business into different levels of granularity from a process perspective.
[0060] The Entity Model records the business content of each business object. Each business object contains a core entity, a lifecycle (the state of the core entity), subordinate entities (describe the attribute information of the core entity), relationships between business objects, and constraints.
[0061] An entity model can be understood as a model that views business from the perspective of entities, and it can be applied to business areas in different industries. Taking banking business as an example, in the entity model:
[0062] Taking banking business as an example, the business objects in the entity model generally include, but are not limited to: account information, participant information, participant lifecycle, and medium information.
[0063] A product model is a standard structure that defines a company's products, including the relationships between product lines, product groups, basic products, and selling products.
[0064] A product model can be understood as a way of looking at business from a product perspective, and it can be applied to business areas in different industries.
[0065] Taking banking business as an example, product models generally include, but are not limited to: credit cards, charge cards, quasi-credit cards, international debit cards, etc.
[0066] Figure 1C An information technology architecture diagram according to an embodiment of the present disclosure is illustrated schematically.
[0067] like Figure 1C The information technology architecture includes multiple different information service sub-models. Each information service sub-model may include multiple code segments, but only one comment information.
[0068] It should be noted that, in Figure 1C The document does not specify the structural relationships between different information service sub-models within the information technology architecture, but this does not mean that structural relationships do not exist between them. Further details will not be provided here.
[0069] The following will be based on Figure 1A The scene described Figure 1B The described business architecture and Figure 1C The described information technology architecture, through Figures 2-6 The code annotation method of the disclosed embodiments is described in detail.
[0070] Figure 2 A flowchart illustrating a code annotation method according to an embodiment of the present disclosure is shown schematically.
[0071] like Figure 2 As shown, the code annotation method of this embodiment includes operations S210 to S240, and the code annotation method can be executed by the server 105.
[0072] It should be noted that the method is implemented based on business architecture and information technology architecture. The business architecture includes multiple business sub-models at different levels, and the information technology architecture includes multiple information service sub-models at different granularities.
[0073] In operation S210, information technology codes are obtained.
[0074] In operation S220, based on preset annotation extraction rules, the code annotation information in the information technology code is extracted, wherein the code annotation information reflects the information technology architecture.
[0075] According to an embodiment of this disclosure, the preset annotation extraction rule includes: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location.
[0076] Specifically, the preset characters mentioned above can be common comment characters such as spaces or punctuation characters. The code comment location includes at least paragraph numbers and line numbers. For example, "\\" can be used as the preset character to locate the line number of the code comment, and then the paragraph number-line number of the code comment can be extracted. The code comment of that line can be directly extracted by the paragraph number-line number.
[0077] Optionally, the code comment location and code comment are stored in a preset relational database in a key-value relationship.
[0078] In operation S230, a first mapping relationship and a second mapping relationship are obtained, wherein the first mapping relationship includes the mapping relationship between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes the mapping relationship between business sub-models at different levels in the business architecture.
[0079] According to embodiments of this disclosure, the first mapping relationship includes: the correspondence between the information service sub-model in the information technology architecture and the business sub-model at any level in the business architecture; the second mapping relationship includes: multiple business chain relationships, wherein the business chain relationship is from the highest level business sub-model to any level business sub-model.
[0080] Understandably, software developers typically program based on development requirements, which only reflect the information service sub-model of the information technology architecture (or IT architecture). Therefore, the acquired IT code already contains code comments reflecting the IT architecture. However, the IT architecture is built upon a mapping relationship with the business architecture, and unlike the business architecture, it lacks a rigorous hierarchical structure and top-down description. Therefore, to more clearly define the business scope of the code, it is necessary to transform the description of the IT architecture side of the code (i.e., code comments) into a description of the business architecture side of the code (i.e., code annotations).
[0081] Taking banking operations as an example, according to the business architecture design, the activity of "issuing credit cards" (belonging to the credit card domain) needs to call tasks such as "identifying individual customers" (belonging to the customer management domain), "creating new individual customer information" (belonging to the customer management domain), "calculating individual credit limits" (belonging to the personal loan domain), and "creating bank cards" (belonging to the credit card domain). The first mapping relationship is the information service sub-model in the information technology architecture corresponding to the business sub-models (tasks in this embodiment) in the business architecture such as "identifying individual customers," "creating new individual customer information," "calculating individual credit limits," and "creating bank cards."
[0082] It is understandable that business chain relationships are hierarchical, top-down chain relationships. These relationships are considered different if they contain different business sub-models. For example, in a business architecture, ABCD belongs to one business chain relationship, and ABC also belongs to another. Although both business chain relationships include A, B, and C, they are still considered two separate business chain relationships.
[0083] Specifically, for business chain relationships within a process model, it could be, for example, ProcessModel-BusinessArea-ValueStream-Activity-Mission [Note: Process model comments only go up to the task level, not the step level]. For instance, if a part of the code functions as Process Model-BusinessArea-BusinessPlan-IssueCreditcard-IdentifyCustomers, the comment would be ProcessModel-BusinessArea-BusinessPlan-IssueCreditcard-IdentifyCustomers.
[0084] Specifically, for business chain relationships involving the product model, it can be, for example, ProductModel-ProductLine-ProductGroup-BasicProduct-SellingProduct. For example, if a part of the code has the function of product model-retail product line-personal consumption-small consumption-credit card, then the comment would be ProductModel-RetailProductLine-PersonalConsumption-SmallConsumption-Creditcard.
[0085] Specifically, for business chain relationships involving the Entity Model, it could be, for example, Entity Model-BusinessObject. If a part of the code functions as an Entity Model-Account, then the annotation would be EntityModel-Account. It should be noted that information such as the core entities, lifecycles, subordinate entities, relationships between business objects, and constraints within the business object are not reflected in the annotations. Instead, this information can be recorded in a relational database and linked to a pre-defined corpus (or annotation corpus).
[0086] It should be noted that the code annotation information for the above business architecture is in English, but this does not mean that the code annotation information is limited to English in the embodiments of this disclosure. Similarly, the language of code comments is not limited.
[0087] According to embodiments of this disclosure, the code comments include at least: code description, code version, and comment time. It is understood that the code description is based on an information technology architecture; generally, in practice, the code description may come from a pre-defined list of development requirements, which will not be elaborated further here.
[0088] It is understood that, in the embodiments of this disclosure, for the first mapping relationship, in most cases, there is a one-to-one correspondence between the business sub-models in the business architecture and the information service sub-models in the information technology architecture. However, this does not mean that there is only a one-to-one correspondence between the business sub-models in the business architecture and the information service sub-models in the information technology architecture. Alternatively, one business sub-model in the business architecture can correspond to multiple information service sub-models in the information technology architecture, multiple business sub-models in the business architecture can correspond to one information service sub-model in the information technology architecture, or multiple business sub-models in the business architecture can correspond to multiple information service sub-models in the information technology architecture.
[0089] In operation S240, based on the first mapping relationship and the second mapping relationship, the code comment information is replaced with code annotation information, wherein the code annotation information reflects the business architecture.
[0090] According to an embodiment of this disclosure, replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: matching the code comment information with a business chain relationship in a preset corpus through the first mapping relationship and the second mapping relationship to obtain a first business chain relationship; and extracting the code annotation information based on the first business chain relationship.
[0091] In the embodiments of this disclosure, the replacement between code comment information and code annotation information is completed by using a first mapping relationship between the business sub-model and the information technology architecture as a bridge. This clarifies the scope of the code on the business side, which is beneficial for subsequent business changes or software testing operations involving code modifications.
[0092] Figure 3 A flowchart illustrating another method of code annotation according to an embodiment of this disclosure is shown schematically.
[0093] like Figure 3 As shown, another code annotation method in this embodiment includes operations S310 to S330.
[0094] In operation S310, the corresponding first information service sub-model is obtained based on the code comment information.
[0095] In operation S320, a first business sub-model is obtained based on the first information service sub-model and the first mapping relationship. The first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship.
[0096] In operation S330, based on the first business sub-model, the first business chain relationship corresponding to the first business sub-model is obtained.
[0097] Specifically, a code comment corresponds to a piece of information technology code, and a piece of information technology code corresponds to an information service sub-model. Then, based on the information service sub-model corresponding to the aforementioned code comment, the corresponding first business sub-model is obtained through a first mapping relationship. Based on the one-to-one correspondence between this business sub-model and the business chain relationship in a pre-defined corpus, the first business chain relationship is found.
[0098] The first mapping relationship includes a one-to-one correspondence between the business sub-model and the information service sub-model, a one-to-many correspondence between the business sub-model and the information service sub-model, a many-to-one correspondence between the business sub-model and the information service sub-model, and a many-to-many correspondence between the business sub-model and the information service sub-model.
[0099] According to an embodiment of this disclosure, when the business sub-model and the information service sub-model have a one-to-one correspondence, obtaining the corresponding first business sub-model in the business architecture based on the code comment information and the first mapping relationship includes: obtaining the first business sub-model based on the information service sub-model corresponding to the code comment information through the first mapping relationship.
[0100] According to embodiments of this disclosure, when there is a one-to-many correspondence between the business sub-model and the information service sub-model, obtaining the corresponding first business sub-model in the business architecture based on the code annotation information and the first mapping relationship includes: obtaining the first business sub-model based on the information service sub-model corresponding to the code annotation information through the first mapping relationship. It should be noted that since code annotation is initiated by the information technology architecture side, other information service sub-models in a first mapping relationship between one business sub-model and multiple information service sub-models will not be discussed here.
[0101] According to embodiments of this disclosure, when there is a many-to-one correspondence between the business sub-model and the information service sub-model, obtaining the corresponding first business sub-model in the business architecture based on the code comment information and the first mapping relationship includes: based on the information service sub-model corresponding to the code comment information, obtaining multiple first business sub-models related to the first mapping relationship through the first mapping relationship. It should be noted that when there are multiple first business sub-models (e.g., N), the code annotation information obtained by replacing the code comment information is also multiple (same as above, N).
[0102] According to embodiments of this disclosure, the first mapping relationship further includes a many-to-many mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship further includes: obtaining a third mapping relationship, the third mapping relationship including a mapping relationship between the second business sub-model and the second information service sub-model, wherein the second business sub-model includes a business sub-model at the adjacent upper level of the first business sub-model; and replacing the code comment information with code annotation information based on the third mapping relationship and the second mapping relationship.
[0103] According to embodiments of this disclosure, the method further includes: adding a label identifier, which is used to identify a many-to-many relationship in the first mapping relationship. For example, the label identifier can be added as a pop-up window, so that when a user views the label identifier, they can know that a many-to-many relationship exists in the first mapping relationship.
[0104] For example, on the business architecture side, when "Identify Customers" and "Review Partners" in "Process Model - Business Domain - Business Plan - Credit Card Issuance - Customer Identification" and "Process Model - Business Domain - Business Plan - Credit Card Issuance - Partner Review" have multiple corresponding information service sub-models (e.g., two business sub-models corresponding to three information service sub-models), i.e., there is a many-to-many mapping relationship between them, then "Process Model - Business Domain - Business Plan - Credit Card Issuance" and its corresponding information service sub-models can be further obtained. It should be noted that, typically, for the first mapping relationship, only the business sub-models at the "task" level in the business architecture and the information service sub-models in the information technology architecture have a many-to-many relationship. Therefore, when obtaining the third mapping relationship at the next higher level, it is not necessary to consider whether the third mapping relationship has a many-to-many aspect.
[0105] In the embodiments disclosed herein, by combining a first mapping relationship between the business architecture and the information technology architecture and a second mapping relationship within the business architecture, code annotation replacement is achieved, resulting in a business chain relationship. This realizes the conversion of comments / annotations between different architectures.
[0106] Figure 4 The flowchart illustrating the method for creating a code annotation information pop-up window according to an embodiment of the present disclosure is shown.
[0107] like Figure 4 As shown, the method for creating a code annotation information pop-up window in this embodiment includes operations S410 to S420.
[0108] In operation S410, location mapping data is obtained based on the code annotation information and the code comment location, wherein the location mapping data is relational data.
[0109] In operation S420, a code annotation information pop-up window is created based on the location mapping data.
[0110] Figure 5 A schematic diagram illustrating a full flowchart of code annotation according to an embodiment of the present disclosure is shown.
[0111] like Figure 5 As shown, the code annotation method in this embodiment includes operations S510 to S560.
[0112] In operating S510, a corpus is built based on the business architecture.
[0113] It is understood that the corpus may be established prior to implementing the embodiments of this disclosure.
[0114] In operating the S520, obtain the information technology code.
[0115] In the S530 operation, the comment information and code comment location are extracted from the code.
[0116] In operation S540, the annotation information and the code annotation location are stored in a relational database in key-value format.
[0117] In operation S550, based on the first mapping relationship and the second mapping relationship, the business chain relationship in the corpus is matched to obtain the first business chain relationship.
[0118] In operation S560, the code annotations are used to locate the business chain relationship, and the data is displayed in a preset format.
[0119] According to embodiments of this disclosure, the preset format includes at least a file and a floating window.
[0120] Figure 6 The illustration shows a code-annotated display diagram of an embodiment of the present disclosure.
[0121] like Figure 6 As shown, the business chain relationship, taking "Entity Model-Account" as an example, displays the matched information in the form of files and pop-up windows, making it easier for developers and testers to better understand the business architecture involved in this code segment. The replaced code is labeled "Entity Model-Account," and the "Entity Model-Account" in the pop-up window provides its Chinese explanation.
[0122] Based on the above code annotation method, this disclosure also provides a code annotation device. The following will be combined with... Figure 7 The device is described in detail.
[0123] Figure 7 A schematic block diagram of a code annotation apparatus according to an embodiment of the present disclosure is shown.
[0124] like Figure 7 As shown, the code annotation device 700 of this embodiment includes: a code acquisition module 710, a code comment extraction module 720, a mapping relationship acquisition module 730, and a code annotation module 740.
[0125] in,
[0126] The code acquisition module 710 is used to acquire information technology codes;
[0127] The code comment extraction module 720 is used to extract the code comment information in the information technology code based on preset comment extraction rules, wherein the code comment information is used to reflect the information technology architecture;
[0128] The mapping relationship acquisition module 730 is used to acquire a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes the mapping relationship between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes the mapping relationship between business sub-models at different levels in the business architecture; and
[0129] The code annotation module 740 is used to replace the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship, wherein the code annotation information reflects the business architecture.
[0130] In the embodiments of this disclosure, the replacement between code comment information and code annotation information is completed by using a first mapping relationship between the business sub-model and the information technology architecture as a bridge. This clarifies the scope of the code on the business side, which is beneficial for subsequent business change operations involving code modification or business testing operations.
[0131] According to an embodiment of this disclosure, the preset annotation extraction rule includes: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location.
[0132] According to embodiments of this disclosure, the business architecture includes business sub-models at different levels, including: between adjacent levels, the business sub-model at an upper level includes multiple different business sub-models at lower levels, wherein the first mapping relationship includes: the correspondence between the information service sub-model in the information technology architecture and the business sub-model at any level in the business architecture; the second mapping relationship includes: multiple business chain relationships, wherein the business chain relationship is from the highest level business sub-model to the business sub-model at any level.
[0133] According to embodiments of this disclosure, the first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: obtaining the corresponding first information service sub-model based on the code comment information; obtaining the first business sub-model based on the first information service sub-model and the first mapping relationship, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and obtaining the first business chain relationship corresponding to the first business sub-model based on the first business sub-model.
[0134] According to embodiments of this disclosure, the first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The code annotation module is further configured to: obtain the corresponding first information service sub-model based on the code annotation information; obtain the first business sub-model based on the first information service sub-model and the first mapping relationship, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and obtain the first business chain relationship corresponding to the first business sub-model based on the first business sub-model.
[0135] According to embodiments of this disclosure, the first mapping relationship further includes a many-to-many mapping relationship between the business sub-model and the information service sub-model. The code annotation module is also used to obtain a third mapping relationship, which includes the mapping relationship between the second business sub-model and the second information service sub-model, wherein the second business sub-model includes a business sub-model at the upper level adjacent to the first business sub-model.
[0136] According to embodiments of this disclosure, the code annotation module 740 is further configured to match the code annotation information with a business chain relationship in a preset corpus through a first mapping relationship and a second mapping relationship to obtain a first business chain relationship; and to extract the code annotation information based on the first business chain relationship. According to embodiments of this disclosure, the device further includes an information display module, wherein the information display module is configured to obtain location mapping data based on the code annotation information and the code annotation location, wherein the location mapping data is relational data; and to establish a code annotation information pop-up window based on the location mapping data.
[0137] According to embodiments of this disclosure, any multiple modules among the code acquisition module 710, the code annotation extraction module 720, the mapping relationship acquisition module 730, and the code annotation module 740 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the code acquisition module 710, the code annotation extraction module 720, the mapping relationship acquisition module 730, and the code annotation module 740 can be at least partially implemented as hardware circuits, such as field-programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems-on-a-chip, systems-on-a-substrate, systems-on-package, application-specific integrated circuits (ASICs), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuits, or implemented in software, hardware, and firmware, or in any appropriate combination of any of these three implementation methods. Alternatively, at least one of the code acquisition module 710, the code comment extraction module 720, the mapping relationship acquisition module 730, and the code annotation module 740 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.
[0138] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing a code annotation method according to an embodiment of the present disclosure.
[0139] like Figure 8 As shown, an electronic device 800 according to an embodiment of this disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage portion 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0140] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0141] According to embodiments of this disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0142] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0143] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803 described above.
[0144] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the code annotation methods provided in the embodiments of this disclosure.
[0145] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0146] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0147] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0148] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0149] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0150] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0151] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A code annotation method, characterized in that, The method is implemented based on a business architecture and an information technology architecture. The business architecture includes multiple business sub-models at different levels, and the information technology architecture includes multiple information service sub-models with different granularities. The method includes: Obtain information technology codes; Based on preset annotation extraction rules, the code annotation information in the information technology code is extracted, wherein the code annotation information reflects the information technology architecture; Obtain a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes the mapping relationship between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes the mapping relationship between business sub-models at different levels in the business architecture; and Based on the first mapping relationship and the second mapping relationship, the code comment information is replaced with code annotation information, wherein the code annotation information reflects the business architecture; The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: tracing the information service sub-model in the code comment information to the corresponding business sub-model through the first mapping relationship; and generating code annotation information corresponding to the business architecture based on the business sub-model through the second mapping relationship. The preset annotation extraction rules include: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location; wherein the code annotation information corresponds one-to-one with the information service sub-model.
2. The method according to claim 1, characterized in that, in, The business architecture includes business sub-models at different levels, including: between adjacent levels, a higher-level business sub-model includes multiple different lower-level business sub-models. in, The first mapping relationship includes: the correspondence between the information service sub-model in the information technology architecture and the business sub-model at any level in the business architecture; The second mapping relationship includes: multiple business chain relationships, which are from the highest-level business sub-model to any level of business sub-model.
3. The method according to claim 2, characterized in that, in, The first mapping relationship includes at least a one-to-one or many-to-one mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: Based on the code comment information, obtain the corresponding first information service sub-model; Based on the first information service sub-model and the first mapping relationship, a first business sub-model is obtained, wherein the first business sub-model and the first information service sub-model have a one-to-one or many-to-one relationship; and Based on the first business sub-model, obtain the first business chain relationship corresponding to the first business sub-model.
4. The method according to claim 3, characterized in that, in, The first mapping relationship also includes a many-to-many mapping relationship between the business sub-model and the information service sub-model. The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship also includes: Obtain a third mapping relationship, which includes the mapping relationship between the second business sub-model and the second information service sub-model, wherein the second business sub-model includes a business sub-model at the upper level adjacent to the first business sub-model; and Based on the third mapping relationship and the second mapping relationship, the code comment information is replaced with code annotation information.
5. The method according to claim 3, characterized in that, The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: The code comment information is matched with the business chain relationships in a preset corpus using a first mapping relationship and a second mapping relationship to obtain the first business chain relationship; and Based on the first business chain relationship, the code annotation information is extracted.
6. The method according to any one of claims 2 to 4, characterized in that, After replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship, the method further includes: Based on the code annotation information and the code comment location, position mapping data is obtained, wherein the position mapping data is relational data; and Based on the location mapping data, a code annotation information pop-up window is created.
7. A code annotation device, characterized in that, The device is implemented based on a business architecture and an information technology architecture. The business architecture includes multiple business sub-models at different levels, and the information technology architecture includes multiple information service sub-models with different granularities. The device includes: a code acquisition module, a code comment extraction module, a mapping relationship acquisition module, and a code annotation module. in, The code acquisition module is used to acquire information technology codes; The code comment extraction module is used to extract the code comment information in the information technology code based on preset comment extraction rules, wherein the code comment information is used to reflect the information technology architecture; The mapping relationship acquisition module is used to acquire a first mapping relationship and a second mapping relationship, wherein the first mapping relationship includes the mapping relationship between multiple business sub-models and information service sub-models at different levels in the business architecture, and the second mapping relationship includes the mapping relationship between business sub-models at different levels in the business architecture; and The code annotation module is used to replace the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship, wherein the code annotation information reflects the business architecture; The step of replacing the code comment information with code annotation information based on the first mapping relationship and the second mapping relationship includes: tracing the information service sub-model in the code comment information to the corresponding business sub-model through the first mapping relationship; and generating code annotation information corresponding to the business architecture based on the business sub-model through the second mapping relationship. The preset annotation extraction rules include: detecting preset characters in the information technology code to obtain code annotation location; and extracting the code annotation information based on the code annotation location; wherein the code annotation information corresponds one-to-one with the information service sub-model.
8. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Code resource management method and device, electronic equipment and medium
CN112181376A
