Service calling method, device and readable storage medium

Through the proposed business call method, SQL statements in the recommendation system are obtained and processed, converted into domain models or domain services, and domain topological relationships are established, and the problems of high learning and iteration costs and maintenance difficulties caused by the diversity of subsystems in the existing recommendation system are solved, and efficient business execution and maintenance are achieved.

CN114328584BActive Publication Date: 2025-04-15KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111637558.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-04-15
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

Due to the numerous subsystems and different technical stacks, the existing recommendation systems have high learning and iteration costs, the separation between the systems and the maintenance costs are high, making it difficult to effectively connect each system to improve the efficiency of recommendation iterations.

Method used

A business call method is proposed, by obtaining the SQL collection of the business to be executed, extracting the dependencies between SQL statements, building a topological relationship, splitting the business into a sub-business, converting the SQL statement into a domain model or domain service, and mapping it into the topological relationship to form a domain topological relationship to execute the business.

Benefits of technology

It realizes automatic conversion and adaptation between SQL statements to domain models or domain services, reduces costs and improves business execution efficiency. By establishing topological relationships between sub-businesses, the call relationship between sub-businesses can be visually seen, reducing maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328584B_ABST
    Figure CN114328584B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention propose a service calling method, device and readable storage medium. The method includes: obtaining a SQL set of the service to be executed, extracting the dependency relationship between each SQL statement in the SQL set, and constructing a topological relationship between the SQL statements in the SQL set according to the dependency relationship; splitting the SQL set according to a preset service segmentation rule to obtain SQL statements contained in each sub-service of the service; converting each SQL statement into a domain model or domain service of the business domain to which the service belongs according to the data operation type of each SQL statement; mapping the domain model or / and domain service contained in each sub-service to the topological relationship between the SQL statements in the SQL set to obtain the domain topological relationship of the service; and executing the service according to the domain topological relationship. The embodiments of the present invention reduce the service calling cost and improve the service calling efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to a service calling method, a device and a readable storage medium. Background Art

[0002] As one of the important distribution scenarios of client traffic, recommendation is responsible for displaying appropriate materials to users. In order to achieve effective and rapid distribution of materials, the high-speed iteration capability of recommendation engineering is the cornerstone to support the effective distribution of recommended materials.

[0003] The existing recommendation system consists of more than 20 subsystems and auxiliary systems, including data import layer, data layer, model layer, computing layer, application layer, etc. Each subsystem's technology stack may be implemented by one or more technology stacks such as Java, Python, Shell, Spark, etc., and each submodule has different technology selections. In order to provide effective recommendation service capabilities, systems (such as task scheduling platforms, HTTP systems, RPC systems, etc.) use multiple calling methods to connect the entire recommendation system, which will result in the following defects:

[0004] First, due to the large number of subsystems, and the different subsystem technology stacks and technical solutions, the learning cost and iteration cost are high. To complete a recommendation iteration, developers must not only have hard skills in various technology stacks, but also be familiar with the implementation solutions of different subsystems in order to iteratively develop the recommendation system.

[0005] Second, the systems are disconnected, and the calling relationship between systems cannot be intuitively seen, resulting in high maintenance costs. Since systems may use a third-party scheduling platform for scheduling, this will lead to disconnection between systems. The relationship between systems can only be traced through documents or word of mouth. If the documents are not complete, there may be a risk of system faults.

[0006] Therefore, how to provide a universal expression method to effectively connect various systems, shield the internal technology stack and technical implementation solutions of the system, present a recommendation strategy from a full-link perspective, and improve the iteration efficiency of recommendations has become a major difficulty in recommendation iteration. Summary of the invention

[0007] The embodiments of the present invention provide a service calling method, a device and a readable storage medium to reduce the service calling cost.

[0008] The technical solution of the embodiment of the present invention is achieved as follows:

[0009] A service calling method, the method comprising:

[0010] Obtaining a SQL set of the business to be executed, extracting dependencies between SQL statements in the SQL set, and constructing a topological relationship between SQL statements in the SQL set according to the dependencies;

[0011] According to the preset business segmentation rule, the SQL set is split to obtain SQL statements contained in each sub-business of the business;

[0012] According to the data operation type of each SQL statement contained in each sub-business of the business, convert each SQL statement into a domain model or domain service of the business domain to which the business belongs;

[0013] According to the SQL statements contained in each sub-business of the business and the domain models or domain services converted from the SQL statements, the domain models and / or domain services contained in each sub-business are mapped to the topological relationship between the SQL statements in the SQL set to obtain the domain topological relationship of the business;

[0014] The service is executed according to the domain topology relationship.

[0015] After obtaining the SQL statements included in each sub-business of the business and before converting each SQL statement into a domain model or domain service of the business domain to which the business belongs, further comprising:

[0016] Each SQL statement is parsed separately to obtain SQL basic elements contained in the SQL statement, and each basic element contained in the SQL statement is mapped to a corresponding domain basic element according to a mapping relationship between predefined SQL basic elements and domain basic elements in the business domain to which the business belongs.

[0017] The SQL basic elements include one or any combination of the following:

[0018] Data operation type, table information, column information, custom parameters, functions, input source, and output source.

[0019] The step of converting each SQL statement into a domain model or domain service of the business domain to which the business belongs according to the data operation type of each SQL statement included in each sub-business of the business includes:

[0020] If the data operation type of the SQL statement is CREATE, the SQL statement is determined to be a DDL statement, and a domain model is created according to the domain basic elements to which the basic elements contained in the DDL statement are mapped;

[0021] If the data operation type of the SQL statement is a predefined data operation type of a DML statement, the SQL statement is determined to be a DML statement, and the domain service type adapted by the DML statement is determined based on the adaptation relationship between the predefined data operation type of the DML statement and the domain service type in the business domain to which the business belongs, and a domain service of the corresponding type is created based on the domain basic elements to which the basic elements contained in the DML statement are mapped.

[0022] The execution of the business includes:

[0023] Initialize services in various fields according to the pre-defined initialization process of services in various fields;

[0024] For any domain service, if it is determined based on the domain topology relationship that a domain model needs to be called when the domain service is started, the domain service loads the domain model.

[0025] After the domain service loads the domain model, the process further includes:

[0026] If validation rules are set for one or more columns in the domain model, the domain service validates the one or more columns according to the validation rules.

[0027] After the domain service loads the domain model, the process further includes:

[0028] If a storage method is defined in the domain model, the data in the domain model is read and written according to the storage method.

[0029] After initializing the services in each field, the following is further included:

[0030] For a domain service, if the domain basic elements of the domain service include functions, the adaptation function of the function is queried in the technology stack of the domain service to obtain the column data targeted by the function, the column data is calculated using the adaptation function to obtain the calculation result, and the mapping relationship between the function and the adaptation function is recorded.

[0031] A computer program product includes a computer program or instructions, which, when executed by a processor, implements the steps of the service calling method as described in any one of the above items.

[0032] A non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to execute the steps of any of the above service calling methods.

[0033] An electronic device comprising: a processor and a memory,

[0034] The memory stores a computer program, and the computer program is configured to implement the steps of any of the above service calling methods when executed by the processor.

[0035] The embodiment of the present invention can automatically complete the conversion and adaptation of each SQL statement to a domain model or a domain service, and only requires one conversion and adaptation, which reduces costs and improves business execution efficiency; in addition, by establishing a topological relationship between each sub-business, the calling relationship between the sub-businesses can be intuitively seen, which facilitates maintenance and reduces maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0037] Figure 1 A flow chart of a service calling method provided by an embodiment of the present invention;

[0038] Figure 2 A flow chart of a service calling method provided by another embodiment of the present invention;

[0039] Figure 3 An example diagram of the topological relationship between SQL statements in an SQL set provided by an embodiment of the present invention;

[0040] Figure 4 for Figure 3 An example diagram of a business domain topology relationship corresponding to the topological relationship between the SQL statements in the SQL set shown;

[0041] Figure 5 A flow chart of a method for executing services according to domain topology relationships provided by an embodiment of the present invention;

[0042] Figure 6 A schematic diagram of the structure of a service calling device provided by an embodiment of the present invention;

[0043] Figure 7 An exemplary structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0046] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0047] An embodiment of the present invention provides a business calling method, in which a SQL (Structured Query Language) set of a business to be executed is obtained, a dependency relationship between SQL statements in the SQL set is extracted, and a topological relationship between SQL statements in the SQL set is constructed according to the dependency relationship; the SQL set is split according to a preset business segmentation rule to obtain SQL statements included in each sub-business of the business; according to a data operation type of each SQL statement included in each sub-business of the business, each SQL statement is converted into a domain model or domain service of a business domain to which the business belongs; according to the SQL statements included in each sub-business of the business and the domain model or domain service converted from each SQL statement, the domain model or / and domain service included in each sub-business is mapped to the topological relationship between SQL statements in the SQL set to obtain the domain topological relationship of the business; and according to the domain topological relationship, the business is executed. The embodiment of the present invention can automatically complete the conversion and adaptation of each SQL statement to a domain model or a domain service, and only requires one conversion and adaptation, which reduces costs and improves business execution efficiency; in addition, by establishing a topological relationship between each sub-business, the calling relationship between the sub-businesses can be intuitively seen, which facilitates maintenance and reduces maintenance costs.

[0048] Figure 1 A flowchart of a service calling method provided by an embodiment of the present invention, wherein the specific steps are as follows:

[0049] Step 101: Obtain an SQL set of a business to be executed, extract the dependency relationship between the SQL statements in the SQL set, and construct a topological relationship between the SQL statements in the SQL set according to the dependency relationship.

[0050] Step 102: split the SQL set according to the preset business segmentation rule to obtain the SQL statements included in each sub-business of the business.

[0051] Step 103: According to the data operation type of each SQL statement included in each sub-business of the business, convert each SQL statement into a domain model or domain service of the business domain to which the business belongs.

[0052] Step 104: Based on the SQL statements contained in each sub-business of the business and the domain models or domain services converted from each SQL statement, the domain models and / or domain services contained in each sub-business are mapped to the topological relationship between the SQL statements in the SQL set to obtain the domain topological relationship of the business.

[0053] Step 105: Execute the service according to the domain topology relationship.

[0054] The above-mentioned embodiment can automatically complete the conversion and adaptation of each SQL statement to the domain model or domain service, and only requires one conversion and adaptation, which reduces costs and improves business execution efficiency; in addition, by establishing the topological relationship between each sub-business, the calling relationship between the sub-businesses can be intuitively seen, which facilitates maintenance and reduces maintenance costs.

[0055] In an optional embodiment, between steps 102 and 103, it further includes: parsing each SQL statement separately to obtain SQL basic elements contained in the SQL statement, and mapping each basic element contained in the SQL statement to a corresponding domain basic element according to a mapping relationship between pre-defined SQL basic elements and domain basic elements in the business domain to which the business belongs.

[0056] In an optional embodiment, the SQL basic elements include one or any combination of the following: data operation type, table information, column information, custom parameters, functions, input sources, and output sources.

[0057] In an optional embodiment, step 103 specifically includes: if the data operation type of the SQL statement is CREATE, then the SQL statement is determined to be a DDL (Data Definition Language) statement, and a domain model is created according to the domain basic elements to which the basic elements contained in the DDL statement are mapped; if the data operation type of the SQL statement is a data operation type of a predefined DML (Data Manipulation Language) statement, then the SQL statement is determined to be a DML statement, and according to the adaptation relationship between the data operation type of the predefined DML statement and the domain service type in the business domain to which the business belongs, the domain service type adapted by the DML statement is determined, and a domain service of a corresponding type is created according to the domain basic elements to which the basic elements contained in the DML statement are mapped.

[0058] In an optional embodiment, executing the business in step 105 includes: initializing each domain service according to a pre-defined initialization process for each domain service; for any domain service, if it is determined based on the domain topology relationship that a domain model needs to be called when the domain service is started, then the domain service loads the domain model.

[0059] In an optional embodiment, after the domain service loads the domain model, the process further includes: if a validation rule is set for one or more columns in the domain model, the domain service validates the one or more columns according to the validation rule.

[0060] In an optional embodiment, after the domain service loads the domain model, the process further includes: if a storage method is defined in the domain model, recording the storage method, and performing read and write operations on the data in the domain model according to the storage method.

[0061] In an optional embodiment, after initializing each domain service, it further includes: for a domain service, if the domain basic elements of the domain service include a function, then query the adaptation function of the function in the technology stack of the domain service, obtain the column data targeted by the function, use the adaptation function to calculate the column data, obtain the calculation result, and record the mapping relationship between the function and the adaptation function.

[0062] The above embodiment realizes the adaptation of the function in the DML statement to the function in the domain service, thereby shielding the technology stack. After that, the domain service can directly use the adapted function to process the column data, that is, only one adaptation is required, which reduces the cost and improves the business execution efficiency.

[0063] Figure 2 A flow chart of a service calling method provided by another embodiment of the present invention, wherein the specific steps are as follows:

[0064] Step 201: receiving an input SQL set for implementing a first service, extracting dependencies between SQL statements in the SQL set, and constructing a topological relationship between SQL statements in the SQL set according to the dependencies.

[0065] If there is data interaction between two SQL statements, such as SQL statement X needs to output data to SQL statement Y, then the execution of SQL statement Y depends on the data output by SQL statement X, that is, there is a dependency relationship between SQL statements Y and X.

[0066] Figure 3 An example diagram of the topological relationship between SQL statements in a SQL set is given, such as Figure 3 As shown in the figure, each circle represents an SQL statement, and the arrow represents the direction of data exchange (input / output) between SQL statements. Figure 3 As shown in the figure, A and B are DDL statements, C, D, and E are DML SELECT statements, and F is a DML INSERT INTO statement. The direction of the arrows is the flow of data. For example, the arrow between AC and AB points to C, which means that C needs to load A and B and obtain the column data defined in A and B; the arrow between CD points to D, which means that C needs to output the execution results to D; similarly, D and E need to output the execution results to F.

[0067] Step 202: split the SQL set according to the preset service segmentation rule of the first service to obtain SQL statements included in each sub-service of the first service.

[0068] The business segmentation rules of the first business define the sub-businesses included in the first business and the SQL statements corresponding to the implementation of each sub-business. For example, the business segmentation rules of the first business define the sub-businesses corresponding to the implementation of the first business and define the SQL statements that need to be used in sequence to implement each sub-business. Then, the SQL set is split according to the business segmentation rules of the first business.

[0069] Step 203: parse each SQL statement contained in each sub-business of the first business respectively to obtain SQL basic elements contained in the SQL statement, and convert each basic element contained in the SQL statement into a corresponding domain basic element according to a mapping relationship between pre-defined SQL basic elements and domain basic elements in the business domain to which the first business belongs.

[0070] SQL statements are mainly divided into two categories: DDL statements and DML statements. DML statements are further divided into multiple types according to different operation types, such as SELECT statements, INSERT INTO statements, etc.

[0071] The basic elements of a DDL statement mainly include any combination of data operation type, table information (a table represents a process or business), column information, and custom parameters (such as storage type, storage address, storage port, etc.).

[0072] The basic elements of DML statements mainly include: any combination of data operation type, column information, function, input source, output source, etc.

[0073] For example, a DDL statement is as follows:

[0074]

[0075] The basic elements of this DDL statement are:

[0076] 1. Data operation type: CREATE

[0077] That is, the CREATE in the DDL statement.

[0078] 2. Table name: ershou_loupan

[0079] That is, ershou_loupan in the DDL statement.

[0080] 3. Column name and corresponding column data format

[0081] There are three column names and corresponding column data formats in this DDL statement:

[0082] The first column name: loupan_id, its corresponding column data format: string;

[0083] The second column name: loupan_name string, its corresponding column data format: area double;

[0084] The third column name is area, and its corresponding column data format is double.

[0085] 4. Custom parameters

[0086] Custom parameters include parameter name and parameter value. The custom parameters in this DDL statement are storage parameters, as follows:

[0087] 1) Storage Type

[0088] The storage type in the DDL statement is redis, that is, type = 'redis' (that is, the parameter name is type, the parameter value is redis, and the following parameters are similar and will not be repeated);

[0089] 2)Storage host address

[0090] The storage address in the DDL statement is: 127.0.0.1, that is, redis_host = '127.0.0.1';

[0091] 3) Storage Port

[0092] The storage port in the DDL statement is: 1234, that is, port = '1234';

[0093] 4) Key prefix

[0094] The key prefix in the DDL statement is: er_, that is, key_prefix = 'er_';

[0095] 5) Compression method

[0096] The compression method in the DDL statement is lzo (Lempel-Ziv-Oberhumer), that is, compose = 'lzo'.

[0097] A DML SELECT statement is as follows:

[0098] SELECT loupan_id,seg(loupan_name)from ershou_loupan

[0099] The basic elements of the DML SELECT statement are:

[0100] 1. Data operation type: SELECT

[0101] That is, the SELECT in the DML SELECT statement.

[0102] 2. Column name: loupan_id

[0103] That is, loupan_id in the DML SELECT statement.

[0104] 3. Function: seg(), and the name of the column the function operates on: loupan_name

[0105] That is, seg(loupan_name) in the DML SELECT statement.

[0106] 4. Input source: ershou_loupan

[0107] That is, fromershou_loupan in the DML SELECT statement.

[0108] A DML INSERT INTO statement is as follows:

[0109] INSERT INTO recall_ershou_loupan SELECT loupan_id,seg(loupan_name)from ershou_loupan

[0110] The basic elements of the DML INSERT INTO statement are:

[0111] 1. INSERT data operation type: INSERT INTO

[0112] That is, the INSERT INTO in this DML INSERT INTO statement.

[0113] 2. Output source: ershou_loupan

[0114] That is, recall_ershou_loupan in the DML INSERT INTO statement.

[0115] 3. Data operation type: SELECT

[0116] That is, the SELECT in the DML INSERT INTO statement.

[0117] 4. Column name: loupan_id

[0118] That is, loupan_id in this DML INSERT INTO statement.

[0119] 5. Function: seg(), and the name of the column the function operates on: loupan_name

[0120] That is, seg(loupan_name) in the DML INSERT INTO statement, where seg() is the word segmentation function.

[0121] 6. Input source: ershou_loupan

[0122] That is, fromershou_loupan in this DML INSERT INTO statement.

[0123] The mapping relationship between the SQL basic elements and the domain basic elements in the business domain to which the first business belongs, for example: the table name is mapped to the entity, where the input source and the output source, if they are table names, are also mapped to entities; the column name is mapped to the value object, and the column data is mapped to the value; the name of the custom parameter is mapped to the value object, and the value of the custom parameter is mapped to the value; in addition, statements such as group by can be mapped to aggregation; data operation types and functions are not mapped first, the data operation type is used to determine whether the SQL statement is converted into a domain model or a domain service (see step 204 below), and the function must be adapted to the function supported by the domain service (see step 503 below).

[0124] Step 204: for each SQL statement included in each sub-business of the first business, determine whether the SQL statement is a DML statement or a DDL statement according to the data operation type of the SQL statement. If it is a DML statement, execute step 205; if it is a DDL statement, execute step 206.

[0125] For example, if the operation type included in the SQL statement is CREATE, it is determined to be a DDL statement; if the operation type included in the SQL statement is SELECT or INSERT, etc., it is determined to be a DML statement.

[0126] Step 205: Determine the domain service type adapted by the SQL statement based on the adaptation relationship between the data operation type of the pre-defined DML statement and the domain service type in the business domain to which the business belongs, create a domain service of the corresponding type based on the domain basic elements mapped from the basic elements contained in the DML statement, save the metadata of the domain service, and go to step 207.

[0127] Domain services include: call service, RPC (Remote Procedure Call) service, HTTP (Hyper Text Transfer Protocol) service, etc. For example: if it is determined that the domain service type adapted by a DML statement is RPC service, then create the RPC service.

[0128] Meta information of domain services, such as the name and storage address of the domain service.

[0129] It should be noted that if the data operation type of the DML statement is not found in the adaptation relationship between the pre-defined data operation type of the DML statement and the domain service type in the business domain to which the business belongs, it is determined that a custom domain service should be created. At this time, the corresponding custom domain service is created according to the custom parameters (with()) in the DML statement.

[0130] Step 206: Create a domain model based on the domain basic elements mapped from the basic elements included in the DDL statement, and save the meta information of the domain model.

[0131] Meta information of the domain model, such as the name and storage address of the domain model.

[0132] Step 207: When step 205 or step 206 is executed for all DML statements and DDL statements, the domain models and / or domain services contained in each sub-business are mapped to the topological relationship between the SQL statements in the SQL set according to the SQL statements contained in each sub-business of the first business and the domain models or domain services converted from each SQL statement, so as to obtain the domain topological relationship of the business and save the domain topological relationship of the business.

[0133] The domain topology relationship of this business mainly refers to the data interaction (input / output) relationship between the domain model and the domain service, and between the domain services.

[0134] Figure 4 for Figure 3 The topological relationship between the SQL statements in the SQL set shown in the figure corresponds to the domain topological relationship of the business, where 1 and 2 are domain models, corresponding to Figure 3 DDL statements A and B in the table are domain services, corresponding to Figure 3 The DML statements in CF.

[0135] Step 208: Execute the service according to the domain topology relationship.

[0136] Figure 5 A flowchart of a method for executing a service according to a domain topology relationship provided by an embodiment of the present invention, wherein the specific steps are as follows:

[0137] Step 501: Initialize each field service according to the predefined initialization process of each field service.

[0138] Step 502: For any domain service, if it is determined based on the domain topology relationship that a domain model needs to be called when the domain service is started, the domain service loads the domain model.

[0139] Furthermore, if there are custom columns in the domain model and validation rules are set for one or more columns, the domain service will validate the one or more columns according to the validation rules. For example, if the value range of the column data of a certain column is defined in the domain model, the domain service will obtain all the column data of the column from the corresponding table and validate the obtained column data according to the value range.

[0140] Furthermore, if the storage method is defined in the domain model, the data in the domain model is read and written according to the storage method. For example, if the storage method is defined as redis in the domain model, and the address, port, key prefix, compression method, etc. of the redis host are defined, the domain service will find the corresponding redis database according to the address and port of the redis host, obtain the corresponding key value according to the key prefix, and decompress the data read from the redis database using the corresponding compression method.

[0141] Step 503: For a domain service, if the domain basic elements of the domain service include functions, the column data targeted by the function is obtained, and whether adaptation processing is required is determined based on the obtained column data and the function. If necessary, the adaptation function of the function is queried in the technology stack of the domain service, and the obtained column data is calculated using the adaptation function to obtain the calculation result, and the mapping relationship between the function and the adaptation function is recorded.

[0142] When the domain service calls the function again, it can find the corresponding adaptation function according to the recorded mapping relationship and directly use the adaptation function to calculate the obtained column data.

[0143] Technology stack such as Java, python, or shell, etc.

[0144] Step 504: According to the domain topology relationship, when a domain service needs to output the execution result to another domain service, the domain service outputs the execution result to the other domain service after executing the service.

[0145] After the domain topology of the business is established and the initialization of each domain service, function adaptation in the domain service, storage method recording, etc. are completed, the business can be continuously executed according to the domain topology of the business. That is, after the domain topology is established, initialization, function adaptation, and storage method recording only need to be performed once, which greatly reduces the cost of business calls and improves the efficiency of business calls. In addition, according to the domain topology, the calling relationship between the domain model and the domain service and between the domain services can be intuitively understood, which can facilitate maintenance and reduce maintenance costs.

[0146] Figure 6 The schematic diagram of the structure of the service calling device provided by the embodiment of the present invention mainly includes: a SQL topology relationship building module 61, a splitting module 62, a conversion module 63, a domain topology relationship building module 64 and a service execution module 65, wherein:

[0147] The SQL topology relationship building module 61 is used to obtain the SQL set of the business to be executed, extract the dependency relationship between the SQL statements in the SQL set, and build the topology relationship between the SQL statements in the SQL set according to the dependency relationship.

[0148] The splitting module 62 is used to split the SQL set obtained by the SQL topology relationship building module 61 according to the preset business segmentation rule to obtain the SQL statements included in each sub-business of the business.

[0149] The conversion module 63 is used to obtain the data operation type of the SQL statements contained in each sub-business of the business according to the splitting module 62, and convert each SQL statement into a domain model or domain service of the business domain to which the business belongs.

[0150] The domain topology relationship establishment module 64 is used to map the domain models and / or domain services contained in each sub-business to the topological relationship between the SQL statements in the SQL set obtained by the SQL topology relationship construction module 61 based on the SQL statements contained in each sub-business of the business obtained by the splitting module 62 and the domain models or domain services converted by each SQL statement obtained by the conversion module 63, so as to obtain the domain topology relationship of the business.

[0151] The service execution module 65 is used to execute the service according to the domain topology relationship of the service obtained by the domain topology relationship establishment module 64.

[0152] In an optional embodiment, before the conversion module 63 converts each SQL statement into a domain model or domain service of the business domain to which the business belongs, it further includes: parsing each SQL statement separately to obtain SQL basic elements contained in the SQL statement, and mapping each basic element contained in the SQL statement to a corresponding domain basic element according to a mapping relationship between pre-defined SQL basic elements and domain basic elements in the business domain to which the business belongs.

[0153] In an optional embodiment, the SQL basic elements obtained by the conversion module 63 include one or any combination of the following: data operation type, table information, column information, custom parameters, functions, input sources, and output sources.

[0154] In an optional embodiment, the conversion module 63 converts each SQL statement into a domain model or domain service of the business domain to which the business belongs, including: if the data operation type of the SQL statement is CREATE, the SQL statement is determined to be a DDL statement, and a domain model is created according to the domain basic elements mapped to the basic elements contained in the DDL statement; if the data operation type of the SQL statement is a pre-defined data operation type of a DML statement, the SQL statement is determined to be a DML statement, and according to the adaptation relationship between the pre-defined data operation type of the DML statement and the domain service type in the business domain to which the business belongs, the domain service type adapted by the DML statement is determined, and a domain service of the corresponding type is created according to the domain basic elements mapped to the basic elements contained in the DML statement.

[0155] In an optional embodiment, the business execution module 65 executes the business including: initializing each domain service according to the pre-defined initialization process of each domain service; for any domain service, if it is determined based on the domain topology relationship that a domain model needs to be called when the domain service is started, then the domain service loads the domain model.

[0156] In an optional embodiment, after the domain service in the business execution module 65 loads the domain model, the process further includes: if verification rules are set for one or more columns in the domain model, the domain service verifies the one or more columns according to the verification rules.

[0157] In an optional embodiment, after the domain service in the business execution module 65 loads the domain model, it further includes: if a storage method is defined in the domain model, reading and writing data in the domain model according to the storage method.

[0158] In an optional embodiment, after the business execution module 65 initializes each domain service, it further includes: for a domain service, if the domain basic elements of the domain service include a function, then query the adaptation function of the function in the technology stack of the domain service, obtain the column data targeted by the function, use the adaptation function to calculate the column data, obtain the calculation result, and record the mapping relationship between the function and the adaptation function.

[0159] An embodiment of the present application also provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of the service calling method described in any of the above embodiments.

[0160] The embodiment of the present application also provides a computer-readable storage medium, which stores instructions, and the instructions can execute the steps in the above-mentioned service call method when executed by a processor. In practical applications, the computer-readable medium can be included in each device / apparatus / system in the above-mentioned embodiments, or it can exist independently without being assembled into the device / apparatus / system. Among them, the instructions are stored in the computer-readable storage medium, and the instructions stored therein can execute the steps in the above-mentioned service call method when executed by a processor.

[0161] According to the embodiments disclosed in the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof, but it is not used to limit the scope of protection of the present application. In the embodiments disclosed in the present application, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0162] like Figure 7 As shown, an embodiment of the present invention also provides an electronic device. Figure 7 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0163] The electronic device may include a processor 71 with one or more processing cores, a memory 72 with one or more computer-readable storage media, and a computer program stored in the memory and executable on the processor. When the program in the memory 72 is executed, the above service calling method may be implemented.

[0164] Specifically, in practical applications, the electronic device may further include components such as a power supply 73, an input / output unit 74, etc. Those skilled in the art may understand that Figure 7 The structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0165] The processor 71 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the server and processes data by running or executing software programs and / or modules stored in the memory 72 and calling data stored in the memory 72, thereby monitoring the electronic device as a whole.

[0166] The memory 72 can be used to store software programs and modules, that is, the above-mentioned computer-readable storage medium. The processor 71 executes various functional applications and data processing by running the software programs and modules stored in the memory 72. The memory 72 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 72 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 72 may also include a memory controller to provide the processor 71 with access to the memory 72.

[0167] The electronic device also includes a power supply 73 for supplying power to various components, which can be logically connected to the processor 71 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 73 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.

[0168] The electronic device may also include an input and output unit 74, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. The input unit output 74 may also be used to display information input by the user or information provided to the user and various graphical user interfaces, which may be composed of graphics, text, icons, videos and any combination thereof.

[0169] The flow chart and block diagram in the accompanying drawings of the present application show the possible architecture, function and operation of the system, method and computer program product according to the various embodiments disclosed in the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in the order of the standards in different figures. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments and / or claims of the present application may be combined and / or combined in a variety of ways, and all of these combinations and / or combinations fall within the scope disclosed in the present application.

[0171] Specific embodiments are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas, and is not used to limit the present application. For those skilled in the art, changes can be made in the specific implementation methods and application scopes according to the ideas, spirits and principles of the present invention, and any modifications, equivalent substitutions, improvements, etc. made therein should be included in the scope of protection of this application.

Claims

1. A service calling method, characterized in that: The method includes: Obtaining a SQL set of the business to be executed, extracting dependencies between SQL statements in the SQL set, and constructing a topological relationship between SQL statements in the SQL set according to the dependencies; According to the preset business segmentation rule, the SQL set is split to obtain SQL statements contained in each sub-business of the business; According to the data operation type of each SQL statement contained in each sub-business of the business, convert each SQL statement into a domain model or domain service of the business domain to which the business belongs; According to the SQL statements contained in each sub-business of the business and the domain models or domain services converted from the SQL statements, the domain models and / or domain services contained in each sub-business are mapped to the topological relationship between the SQL statements in the SQL set to obtain the domain topological relationship of the business; Execute the service according to the domain topology relationship; After obtaining the SQL statements included in each sub-business of the business and before converting each SQL statement into a domain model or domain service of the business domain to which the business belongs, the method further includes: parsing each SQL statement to obtain SQL basic elements included in the SQL statement, and mapping each basic element included in the SQL statement to a corresponding domain basic element according to a mapping relationship between pre-defined SQL basic elements and domain basic elements in the business domain to which the business belongs; SQL basic elements include one or any combination of the following: data operation type, table information, column information, custom parameters, functions, input sources, and output sources; the domain basic elements include functions; The step of converting each SQL statement into a domain model or domain service of the business domain to which the business belongs according to the data operation type of each SQL statement included in each sub-business of the business includes: If the data operation type of the SQL statement is CREATE, the SQL statement is determined to be a DDL statement, and a domain model is created according to the domain basic elements to which the basic elements contained in the DDL statement are mapped; If the data operation type of the SQL statement is a predefined data operation type of a DML statement, the SQL statement is determined to be a DML statement, and the domain service type adapted by the DML statement is determined based on the adaptation relationship between the predefined data operation type of the DML statement and the domain service type in the business domain to which the business belongs, and a domain service of the corresponding type is created based on the domain basic elements to which the basic elements contained in the DML statement are mapped.

2. The method according to claim 1, characterized in that The execution of the business includes: Initialize services in various fields according to the pre-defined initialization process of services in various fields; For any domain service, if it is determined based on the domain topology relationship that a domain model needs to be called when the domain service is started, the domain service loads the domain model.

3. The method according to claim 2, characterized in that After the domain service loads the domain model, the process further includes: If validation rules are set for one or more columns in the domain model, the domain service validates the one or more columns according to the validation rules.

4. The method according to claim 2, characterized in that: After the domain service loads the domain model, the process further includes: If a storage method is defined in the domain model, the data in the domain model is read and written according to the storage method.

5. The method according to claim 2, characterized in that: After initializing the services in each field, the following is further included: For a domain service, if the domain basic elements of the domain service include functions, the adaptation function of the function is queried in the technology stack of the domain service to obtain the column data targeted by the function, the column data is calculated using the adaptation function to obtain the calculation result, and the mapping relationship between the function and the adaptation function is recorded.

6. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the service calling method described in any one of claims 1 to 5 are implemented.

7. A non-transitory computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by a processor, the processor executes the steps of the service calling method according to any one of claims 1 to 5.

8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores a computer program, and the computer program is configured to implement the steps of the service calling method according to any one of claims 1 to 5 when executed by the processor.

Citation Information

Patent Citations

  • Task scheduling method and system supporting loop dependence

    CN112434061A

  • Business report integration method and device, equipment and storage medium

    CN112667630A