Initialization example data generation method and device, computer device and storage medium
By abstracting business data using a structured language and generating object file templates, the problem of high complexity in initializing sample data in business systems is solved. This enables rapid data expansion and simplifies adjustment, thereby improving the system's flexibility and maintenance efficiency.
Patent Information
- Application Number
- CN202211231855.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In business systems, the function of initializing sample data or template data is complex to write, resulting in a bloated system that is difficult to maintain, especially when there are large differences in data across multiple operating regions, and there is a lack of efficient solutions.
A structured language is used to abstract the object information of business data into target information. An object file template is generated based on the object ID and dependency relationship, and function code is generated in combination with business requirements. Finally, they are combined into initialization sample data.
It enables rapid data expansion and simplifies the adjustment of data representation, thereby improving the system's flexibility and maintenance efficiency.
Smart Images

Figure CN115562635B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software technology, and in particular to a method, apparatus, computer device, and storage medium for generating initialization example data. Background Technology
[0002] In business systems, there are often functions that require initializing sample or template data. However, writing initialization code for various business data in the code makes the business system bloated, consumes service resources, and increases the complexity of modifying existing business functions. Furthermore, in multi-operational regions, since the data required by each region may differ, a more discriminative and efficient method is needed to address these shortcomings. Summary of the Invention
[0003] This invention provides an initialization example data generation method, apparatus, computer device, and storage medium, aiming to achieve rapid data expansion and simplify the difficulty of adjusting data performance.
[0004] In a first aspect, embodiments of the present invention provide a method for generating initial sample data, comprising:
[0005] Acquire business data, and use a structured language to abstract all object information of the business data into target information; the object information includes object ID, object attributes, object behavior, object association, object dependency information, and dependency state type;
[0006] Based on the object ID, obtain the object association relationship and object dependency information between each object information, and specify the dependency state type for each object information based on the object association relationship and object dependency information, and compile the object file template in combination with the dependency state type;
[0007] Based on the object file template, function code is generated for the target information according to the standard logic;
[0008] The function code is combined according to business requirements to generate initialization sample data.
[0009] Secondly, embodiments of the present invention provide an initialization example data generation apparatus, comprising:
[0010] Abstract representation unit, used to acquire business data, uses a structured language to abstract all object information of the business data into target information; the object information includes object ID, object attributes, object behavior, object association, object dependency information, and dependency state type;
[0011] The template compiling unit is configured to obtain object association relationships and object dependency information among the object information according to the object IDs, specify dependency state types for the object information according to the object association relationships and the object dependency information, and compile the object file template in combination with the dependency state types.
[0012] The code generating unit is configured to generate function codes for the target information according to a specification logic based on the object file template.
[0013] The function combining unit is configured to combine the function codes according to business requirements to generate the initialization sample data.
[0014] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, the memory stores a computer program capable of running on the processor, and the processor implements the initialization sample data generation method according to the first aspect when executing the computer program.
[0015] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the initialization sample data generation method according to the first aspect.
[0016] The embodiment of the present application provides an initialization sample data generation method, device, computer device and storage medium, the method includes: obtaining business data, and abstracting all object information of the business data into target information by using a structured language; the object information includes an object ID, object attributes, object behaviors, object association relationships, object dependency information and dependency state types; obtaining object association relationships and object dependency information among the object information according to the object IDs, and specifying dependency state types for the object information according to the object association relationships and the object dependency information, and compiling the object file template in combination with the dependency state types; generating function codes for the target information according to a specification logic based on the object file template; and combining the function codes according to business requirements to generate the initialization sample data. The embodiment of the present application abstracts and expresses data, constructs an object file template, generates function codes according to the object file template, combines different function codes into initialization sample data according to business requirements, and thus realizes the effects of fast data expansion and simplified data performance adjustment difficulty. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without any creative effort.
[0018] Figure 1 A flowchart of an initialization example data generation method provided by the embodiment of the present application is shown in the figure.
[0019] Figure 2 A sub-flowchart of an initialization example data generation method provided by the embodiment of the present application is shown in the figure.
[0020] Figure 3 Another sub-flowchart of an initialization example data generation method provided by the embodiment of the present application is shown in the figure.
[0021] Figure 4 A schematic block diagram of an initialization example data generation device provided by the embodiment of the present application is shown in the figure.
[0022] Figure 5 A sub-schematic block diagram of an initialization example data generation device provided by the embodiment of the present application is shown in the figure.
[0023] Figure 6 Another sub-schematic block diagram of an initialization example data generation device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort belong to the scope of protection of the present application.
[0025] It should be understood that the terms "include" and "contain" as used in the specification and the appended claims indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or sets thereof.
[0026] It should also be understood that the terms used in the present application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0027] It should be further understood that the term "and / or" used in the description and claims of the application herein is used to mean any one and / or any combination of the associated listed items and includes all possible combinations.
[0028] Please see the following Figure 1 , Figure 1 A flowchart of an initialization example data generation method provided by an embodiment of the application is shown in the figure, and specifically includes steps S101-S104.
[0029] S101, obtaining service data, and abstracting all object information of the service data into target information using a structured language; the object information includes object ID, object attribute, object behavior, object association relationship, object dependency information, and dependency state type;
[0030] S102, obtaining object association relationship and object dependency information between each object information according to the object ID, and specifying a dependency state type for each object information according to the object association relationship and the object dependency information, and writing the object file template in combination with the dependency state type;
[0031] S103, generating function code for the target information according to a specification logic based on the object file template;
[0032] S104, combining the function code in combination with business requirements to generate initialization example data.
[0033] In this embodiment, the service data is first abstractly expressed as target information, then constructed into an object file template according to a preset attribute set, and further corresponding function code is generated according to a specification logic. Then the function code is combined according to specific business requirements to obtain initialization example data.
[0034] This embodiment abstractly expresses data to construct an object file template, thereby generating function code according to the object file template, and combining different function codes into initialization example data according to business requirements, thereby achieving the effects of rapid data expansion, simplifying data performance adjustment difficulty, etc.
[0035] In the embodiment, when the object information of the service data is abstractly expressed, the content contained in the object information is actually abstractly expressed, for example, the object attributes and object behaviors are expressed by using the structured language. For example, when the object information of project and sprint in the service system is abstractly expressed by using the structured language, the object attributes, object behaviors, object association relationship, dependent object information, and dependent state type of the project and sprint are abstractly expressed. Each kind of object information is abstractly expressed according to its own attributes, behaviors, and dependent relationship, and the abstract logic is the same, that is, the own attributes and behaviors are encapsulated.
[0036] For example, the project is abstractly expressed as:
[0037] project{name:A,sprints:[Sa,Sb],tasks:[Ta,Tb]}
[0038] For example, the sprint is abstractly expressed as:
[0039] sprint:{name:Sa,tasks:[Ta,Tb]}.
[0040] The structured language described in the embodiment is specially used to describe the logical requirements of a functional unit, which is different from the natural language and any specific program language (such as VB, VC, etc.), and is a language between the natural language and the program language. The structured description language generally uses English, which is very similar to the general programming language. The structured language has the characteristics of the natural language, such as strong flexibility, rich expression, clear readability, and logical rigor of the structured program. The structured language is also a language used for database query and programming, and has become a standard widely used in relational databases. The use of the standard database language brings great convenience to the program design and database maintenance, and is widely used in various data queries. VB and other application programs, including Access, Foxpro, Oracle, SQL Server, and the like, support the SQL language.
[0041] In a specific embodiment, as shown in Figure 2 the step S101 includes steps S201-S204.
[0042] S201, performing lexical analysis on the structured file programming language to obtain symbol data of the structured file programming language; wherein the symbol data includes keywords, identifiers, literal values, and special symbols;
[0043] S202, performing syntax analysis on the symbol data by using a syntax expression to obtain an abstract syntax tree representing a structure formula file programming language; wherein the abstract syntax tree takes an expression as a node;
[0044] S203, performing semantic analysis on the abstract syntax tree by using a static semantic analysis method to obtain a type identifier of the abstract syntax tree;
[0045] S204, abstractly expressing object information of the business data in combination with the type identifier to obtain the target information.
[0046] In an embodiment, for the step S102, when writing an object file template according to a preset attribute set, firstly, object association relationships and object dependency information between different object information can be obtained according to object IDs in the object information, and for the object association relationship, only the corresponding object association needs to be expressed, i.e., the dependency state type is specified.
[0047] For example, if a work item A is associated with a work item B, it can be expressed as:
[0048] Work item A: ID = 1;
[0049] Work item B: ID = 2;
[0050] Association relationship: RelatedTask: source: 1, target: 2;
[0051] RelatedTask: represents the association relationship type as a work item association;
[0052] source: indicates the source work item;
[0053] target: indicates the target work item.
[0054] Then, the object information is written into the object file template in combination with the dependency state type. For example:
[0055] tasks: [Ta: {name: ta, status: todo}, Tb: {name: tb, status: doing}];
[0056] sprints: [Sa: {name: sa, state: todo}, Sb: {name: sb, state: doing}].
[0057] In a specific embodiment, as shown in Figure 3 the step of writing the object file template in combination with the dependency state type specifically includes steps S301-S304.
[0058] S301, constructing a template format of the object file template through a fixed field and a custom field; wherein the custom field can include a field name, a field header, and a field type, etc.; the field type includes at least one of the following: a drop-down box, a signed integer, an unsigned integer, and a string;
[0059] S302, constructing a configuration tool program file of the object file template according to a preset service requirement library; wherein the service requirement library records historical service requirements and related information;
[0060] S303, performing dependency parsing on the dependency state type, and detecting whether each node (i.e., different object information) after dependency parsing exists according to the template format;
[0061] S304, when all object information exists, constructing the object file template in combination with the template format, the configuration tool program file, and the dependency state type.
[0062] Further, in an embodiment, the step S102 further includes:
[0063] setting a parameter list to statistically summarize different dependency state types, and writing the object file template based on the parameter list.
[0064] In a complex business scenario, an object may depend on multiple objects, so this embodiment introduces a parameter list to write an object file template, which can improve the efficiency and accuracy of writing. For example, a card depends on a component and a view in the component:
[0065] Card A configuration: component A: view B;
[0066] Parameter list: {type: conponent, value: A}, {type: view, value: B}.
[0067] In an embodiment, the step S103 includes:
[0068] Obtaining table structure information in a database, and obtaining metadata of the table structure information through a database connection;
[0069] Assembling the metadata into data used by a basic template according to a field name, a field type, and annotation information of the metadata;
[0070] Substituting the data used by the basic template into an object file template, calling a template engine nesting method, and generating the function code file.
[0071] In the embodiment, the object file template is used to quickly write the object generation code, i.e., the function code, according to the specification logic. In the case of unchanged structure, the file template can be adjusted in operation without adjusting the code. Specifically, first, the metadata of the table structure information is obtained from the database, and the metadata is composed into data used by the basic template, and then the data is substituted into the object file template, and the corresponding function code file is generated through the template engine nesting method. It can be understood that the template engine is generated to separate the user interface from the business data (content), and can generate a document in a specific format, for example, the template engine for a website generates a standard HTML document.
[0072] In the embodiment, in the step of calling the template engine nesting method to generate the function code file, the step specifically includes:
[0073] The type of the data substituted into the object file template is converted into a string type to obtain string data;
[0074] The string data is sent to the template engine through the object thread in the object file template;
[0075] The template engine receives the string data through the template thread therein, and converts the string data into a template function, and then returns the template function to the object thread of the object file template;
[0076] The object file template receives the template function through the object thread, and takes the template function as the function code of the object file template.
[0077] In an embodiment, the step S104 includes:
[0078] The business function contained in the business requirement is parsed to obtain the business function;
[0079] The target function code corresponding to the business function is queried in the function code, and all the target function codes are combined into initialization example data.
[0080] Further, the step of querying the target function code corresponding to the business function in the function code and combining all the target function codes into initialization example data includes:
[0081] If the target function code corresponding to the business function is queried in the function code, the target function code is extracted and combined into the initialization example data;
[0082] If the target function code corresponding to the business function is not queried in the function code, the field name, field type and annotation information of the business function are acquired, a template engine nested method is called to generate the corresponding target function code for the business function, and then the target function code is combined into the initial example data and is synchronously updated in the function code.
[0083] In this embodiment, the corresponding function code is combined according to different business requirements, so that the example initial data can be quickly generated. For example, a certain business requirement needs to assemble a project PA containing an iteration SA, work items A, B and C, and a component CA, and the object file template is expressed as:
[0084] PA{sprint:SA,component:CA,task:[A,B,C]}.
[0085] Specifically, when the initial example data is generated, the business requirement is first parsed to obtain the business function of the business requirement, and then the corresponding target function code in the function code is queried according to the business function. Here, if the target function code is directly queried in the function code, the target function code can be directly extracted and combined into the initial example data; if the target function code is not queried in the function code, the corresponding target function code needs to be generated according to the business function, and then the initial example data is combined, and the generated target function code is updated to the function code.
[0086] In a specific embodiment, in the step of parsing the business requirement to obtain the business function contained therein, the following steps are included:
[0087] The business type of the business requirement is acquired, and the business type is coded as the business ID of the business requirement;
[0088] The object ID corresponding to the object ID is queried in the object file template according to the business ID, and the object information corresponding to the object ID is taken as the business function of the business requirement.
[0089] Further, when the business type of the business requirement is acquired, first, evaluation information of the business requirement is counted, and a random gradient descent algorithm is used to calculate a feature vector of the evaluation information. The business requirement is analyzed by clustering in combination with the evaluation information and the feature vector, so as to obtain a mapping relationship of the business requirement and a pre-set business type library, so as to determine the business type of the business requirement according to the mapping relationship. Further, when the random gradient descent algorithm is used to calculate the feature vector of the evaluation information, the evaluation information is normalized, then a partial derivative of the normalized evaluation information is calculated, and an evaluation matrix is constructed based on the partial derivative, then a loss function is constructed according to the evaluation matrix, and the loss function is iterated by the random gradient descent algorithm, so as to obtain the final feature vector. In addition, when the business requirement is analyzed by clustering in combination with the evaluation information and the feature vector, the evaluation information and the feature vector are clustered with historical evaluation information and historical feature vectors in the pre-set business type library by using a clustering algorithm, so as to obtain a mapping relationship of the evaluation information and a mapping relationship of the feature vector, and thus the mapping relationship of the business requirement is obtained.
[0090] Figure 4 A schematic block diagram of an initialization example data generation device 400 is provided for an embodiment of the present application, and the device 400 comprises:
[0091] An abstract expression unit 401 is configured to abstract all object information of the business data into target information by using a structured language; the object information comprises object ID, object attribute, object behavior, object association relationship, object dependency information, and dependency state type;
[0092] A template writing unit 402 is configured to acquire object association relationship and object dependency information between each object information according to the object ID, and specify a dependency state type for each object information according to the object association relationship and the object dependency information, and write the object file template in combination with the dependency state type;
[0093] A code generation unit 403 is configured to generate function code for the target information according to a specification logic based on the object file template;
[0094] A function combination unit 404 is configured to combine the function code according to the business requirement, so as to generate initialization example data.
[0095] In the embodiment, the business data is first abstractly expressed as target information, then the target information is constructed as an object file template according to a pre-set attribute set, and further corresponding function code is generated according to a specification logic. Then the function code is combined according to a specific business requirement, so as to obtain initialization example data.
[0096] The embodiment abstractly expresses data, constructs an object file template according to the object file template, generates function code according to the object file template, and combines different function codes into initial sample data according to business requirements, so as to realize fast data expansion, simplify data performance adjustment difficulty, and the like.
[0097] In an embodiment, as shown in Figure 5 The abstract expression unit 401 includes:
[0098] The lexical analysis unit 501 is configured to perform lexical analysis on the structured file programming language to obtain symbol data of the structured file programming language; the symbol data includes keywords, identifiers, literal values, and special symbols.
[0099] The syntax analysis unit 502 is configured to perform syntax analysis on the symbol data by using a syntax expression to obtain an abstract syntax tree representing the structured file programming language; the abstract syntax tree takes an expression as a node.
[0100] The semantic analysis unit 503 is configured to perform semantic analysis on the abstract syntax tree by using a static semantic analysis method to obtain a type identifier of the abstract syntax tree.
[0101] The identifier combination unit 504 is configured to abstractly express object information of the business data by combining the type identifier to obtain the target information.
[0102] In the embodiment, when the object information of the business data is abstractly expressed, the content contained in the object information is actually abstractly expressed, for example, object attributes and object behaviors are expressed by using a structured language. For example, when the object information such as project and sprint in a business system is abstractly expressed by using a structured language, object attributes, object behaviors, object association relationships, dependent object information, and dependent state types of the project and the sprint are abstractly expressed. Each kind of object information is abstractly expressed according to its own attributes, behaviors, and dependency relationships, and the abstract logic is the same, that is, the own attributes and behaviors are encapsulated.
[0103] For example, the project is abstractly expressed as:
[0104] project{name:A,sprints:[Sa,Sb],tasks:[Ta,Tb]}
[0105] For example, the sprint is abstractly expressed as:
[0106] sprint:{name:Sa,tasks:[Ta,Tb]}.
[0107] The structured language described in the embodiment is specially used to describe the logical requirements of a functional unit, which is different from natural language and any specific program language (such as VB, VC, etc.), and is a language between natural language and program language. The structured description language generally uses English, which is similar to general programming language. The structured language has the characteristics of strong flexibility, rich expression of natural language, and clear readability and logical rigor of structured program. The structured language is also a language used for database query and programming, and has become a standard widely used in relational databases. Using the standard database language brings great convenience to program design and database maintenance, and is widely used in various data queries. VB and other application programs including Access, Foxpro, Oracle, SQL Server, etc. support SQL language.
[0108] In an embodiment, as shown in Figure 6 The template writing unit 402 includes:
[0109] The format building unit 601 is configured to build a template format of the object file template by fixed fields and custom fields.
[0110] The configuration building unit 602 is configured to build a configuration tool program file of the object file template according to a preset business requirement library. The business requirement library records historical business requirements and related information.
[0111] The dependency parsing unit 603 is configured to perform dependency parsing on the dependency state type, and detect whether each object information after dependency parsing exists according to the template format.
[0112] The combination building unit 604 is configured to combine the template format, the configuration tool program file and the dependency state type to build the object file template when all object information exists.
[0113] In the embodiment, when the object file template is written according to the preset attribute set, the object association relationship and the object dependency information between different object information can be obtained according to the object ID in the object information. For the object association relationship, only the corresponding object association needs to be expressed, that is, the dependency state type is specified.
[0114] For example, the work item A is associated with the work item B, which can be expressed as:
[0115] Work item A: ID = 1;
[0116] Work item B: ID = 2;
[0117] Association relationship: RelatedTask: source: 1, target: 2;
[0118] RelatedTask: represents a work item association relationship type is task;
[0119] source: represents a source work item;
[0120] target: represents a target work item.
[0121] Then, the object information is written into the object file template in combination with the dependency state type. For example:
[0122] tasks: [Ta: {name: ta, status: todo}, Tb: {name: tb, status: doing}];
[0123] sprints: [Sa: {name: sa, state: todo}, Sb: {name: sb, state: doing}].
[0124] In an embodiment, the template writing unit 202 further includes:
[0125] a list setting unit configured to set a parameter list to statistically summarize different dependency state types, and write the object file template based on the parameter list.
[0126] In a complex business scenario, an object may depend on multiple objects, so this embodiment introduces a parameter list to write an object file template, which can improve the efficiency and accuracy of writing. For example, a card depends on a component and a view in the component:
[0127] Card A configuration: component A: view B;
[0128] Parameter list: {type: conponent, value: A}, {type: view, value: B}.
[0129] In an embodiment, the code generation unit 403 includes:
[0130] a metadata acquisition unit configured to acquire table structure information in a database, and acquire metadata of the table structure information through a database connection;
[0131] a data assembly unit configured to assemble the metadata into data used by a basic template according to field names, field types, and annotation information of the metadata;
[0132] a data substitution unit configured to substitute the data used by the basic template into an object file template, call a template engine nesting method, and generate the function code file.
[0133] In the embodiment, the object file template is used to quickly write the object generation code, i.e., the function code, according to the specification logic. In the case of unchanged structure, the file template can be adjusted in operation without adjusting the code. Specifically, first, the metadata of the table structure information is obtained from the database, and the metadata is composed into data used by the basic template, and then the data is substituted into the object file template, and the corresponding function code file is generated by the template engine nesting method. It can be understood that the template engine is generated to separate the user interface from the business data (content), and can generate a document in a specific format, for example, the template engine for a website generates a standard HTML document.
[0134] In the embodiment, in the step of calling the template engine nesting method to generate the function code file, the step specifically includes:
[0135] The type of the data substituted into the object file template is converted into a string type to obtain string data;
[0136] The string data is sent to the template engine through the object thread in the object file template;
[0137] The template engine receives the string data through the template thread therein, and converts the string data into a template function, and then returns the template function to the object thread of the object file template;
[0138] The object file template receives the template function through the object thread, and takes the template function as the function code of the object file template.
[0139] In an embodiment, the code generation unit 403 includes:
[0140] A requirement analysis unit is configured to analyze the business requirement to obtain a business function contained therein;
[0141] A code query unit is configured to query a target function code corresponding to the business function in the function code, and combine all the target function codes into the initialization example data.
[0142] In an embodiment, the code query unit includes:
[0143] A code extraction unit is configured to extract the target function code if the target function code corresponding to the business function is queried in the function code, and combine the target function code into the initialization example data;
[0144] a code updating unit, configured to: if the target function code corresponding to the business function is not found in the function code, acquire the field name, field type and annotation information of the business function, and call a template engine nested method to generate the corresponding target function code for the business function, and then combine the target function code into the initial example data and synchronously update the function code.
[0145] In this embodiment, the function code is combined according to different business requirements, so that the example initial data can be quickly generated. For example, a certain business requirement needs to assemble a project PA containing an iteration SA, work items A, B and C, and a component CA, and the object file template is expressed as:
[0146] PA{sprint:SA,component:CA,task:[A,B,C]}.
[0147] Specifically, when the initial example data is generated, the business requirement is first parsed to obtain the business function of the business requirement, and then the corresponding target function code in the function code is queried according to the business function. Here, if the target function code is directly found in the function code, the target function code can be directly extracted and combined into the initial example data; if the target function code is not found in the function code, the corresponding target function code needs to be generated according to the business function, and then combined into the initial example data, and the generated target function code is updated to the function code.
[0148] In a specific embodiment, in the step of parsing the business requirement to obtain the business function contained therein, the following steps are included:
[0149] acquiring the business type of the business requirement and encoding the business type as the business ID of the business requirement;
[0150] querying the object ID same as the business ID in the object file template, and taking the object information corresponding to the object ID as the business function of the business requirement.
[0151] Further, in the process of obtaining the business type of the service demand, first, the evaluation information of the service demand is counted, and a random gradient descent algorithm is used to calculate a feature vector of the evaluation information. The service demand is analyzed by clustering in combination with the evaluation information and the feature vector, so as to obtain a mapping relationship between the service demand and a pre-set business type library, and the business type of the service demand is determined according to the mapping relationship. Further, in the process of calculating the feature vector of the evaluation information by using the random gradient descent algorithm, the evaluation information is normalized, then the partial derivative of the normalized evaluation information is calculated, and an evaluation matrix is constructed based on the partial derivative, then a loss function is constructed according to the evaluation matrix, and the loss function is iterated by using the random gradient descent algorithm, so as to obtain the final feature vector. In addition, in the process of analyzing the service demand by clustering in combination with the evaluation information and the feature vector, the evaluation information and the feature vector are clustered with historical evaluation information and historical feature vectors in the pre-set business type library by using a clustering algorithm, so as to obtain the mapping relationship of the evaluation information and the mapping relationship of the feature vector, and finally the mapping relationship of the service demand is obtained.
[0152] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described in the description of the embodiments of the method part, and will not be described here.
[0153] The embodiments of the present application also provide a computer readable storage medium, which has a computer program stored thereon, and the computer program can implement the steps provided by the above embodiments when executed. The storage medium can include a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium capable of storing program codes.
[0154] The initialization example data generation method provided by the embodiments of the present application comprises:
[0155] The business data is obtained, and all object information of the business data is abstracted into target information by using a structured language; the object information includes object ID, object attribute, object behavior, object association relationship, object dependency information and dependency state type;
[0156] The object association relationship and the object dependency information between each object information are obtained according to the object ID, and the dependency state type of each object information is specified according to the object association relationship and the object dependency information, and the object file template is written in combination with the dependency state type;
[0157] Based on the object file template, function code is generated for the target information according to the specification logic;
[0158] The function code is combined according to the business requirement to generate the initialization sample data.
[0159] The embodiment of the application further provides a computer device, which can comprise a memory and a processor, the memory has a computer program stored therein, and the processor can realize the steps provided by the above embodiment when calling the computer program in the memory. Of course, the computer device can further comprise various network interfaces, power supplies and other components.
[0160] The embodiment of the application provides an initialization sample data generation method, which comprises the following steps:
[0161] Business data is acquired, and all object information of the business data is abstracted into target information by using a structured language; the object information comprises an object ID, object attributes, object behaviors, object association relationships, object dependency information and dependency state types;
[0162] Object association relationships and object dependency information between the object information are acquired according to the object ID, and dependency state types of the object information are specified according to the object association relationships and the object dependency information, and the object file template is written in combination with the dependency state types;
[0163] Function code is generated for the target information according to a standard logic based on the object file template;
[0164] The function code is combined according to the business requirement to generate the initialization sample data.
[0165] The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. For the system disclosed by the embodiments, since it corresponds to the method disclosed by the embodiments, the description is relatively simple, and the related parts can be referred to the method part. It should be pointed out that, for ordinary skilled in the art, without departing from the principles of the application, the application can be improved and modified, and these improvements and modifications also fall within the protection scope of the claims of the application.
[0166] It is further noted that the terminology "first", "second" and the like used in the specification are merely used for differentiating one entity or action from another, and do not necessarily imply any actual physical or logical relationship or order between such entities or actions. Moreover, the use of the term "including", "containing" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements is not required to comprise only those elements but can include other elements not expressly listed or inherent to such process, method, article or apparatus. An element preceded by "comprises a..." does not, without further constraints, preclude the existence of additional identical elements in the process, method, article or apparatus that comprises the stated element.
Claims
1. A method for generating initial sample data, characterized in that, include: Acquire business data, and use a structured language to abstract all object information of the business data into target information; The object information includes object ID, object attributes, object behavior, object association, object dependency information, and dependency state type; Based on the object ID, obtain the object association relationship and object dependency information between each object information, and specify the dependency state type for each object information based on the object association relationship and object dependency information, and write an object file template based on the dependency state type; Based on the object file template, function code is generated for the target information according to the standard logic; The function code is combined according to business requirements to generate initialization sample data; The step of obtaining object associations and object dependencies among object information based on the object ID, specifying dependency state types for each object based on the object associations and object dependencies, and writing the object file template based on the dependency state types includes: The template format for the object file template is constructed using fixed fields and custom fields; A configuration tool program file for constructing the object file template based on a pre-set business requirement library; wherein, the business requirement library records historical business requirements and related information; Dependency resolution is performed on the dependency state type, and the existence of each object information after dependency resolution is checked according to the template format; When all object information exists, the object file template is constructed by combining the template format, configuration tool program file, and dependency state type. The step of obtaining object associations and object dependency information between object information based on the object ID, specifying dependency state types for each object information based on the object associations and object dependency information, and writing the object file template based on the dependency state types, further includes: Set a parameter list to summarize statistics for different dependency state types; The object file template is written based on the dependency state types in the parameter list.
2. The method for generating initialization example data according to claim 1, characterized in that, The process of using a structured language to abstract all object information of the business data into target information includes: Lexical analysis is performed on the structured file programming language to obtain symbolic data of the structured file programming language; wherein, the symbolic data includes keywords, identifiers, literals and special symbols; Syntactic analysis of symbolic data is performed using syntactic expressions to obtain an abstract syntax tree representing a structured file programming language; wherein the abstract syntax tree uses expressions as nodes. The abstract syntax tree is semantically analyzed using a static semantic analysis method to obtain the type identifier of the abstract syntax tree; The target information is obtained by abstracting and expressing the object information of the business data in combination with the type identifier.
3. The method for generating initialization example data according to claim 1, characterized in that, The step of generating function code for the target information based on the object file template and according to the specification logic includes: Retrieve table structure information from the database, and obtain the metadata of the table structure information through a database connection; The metadata is assembled into data used by the base template based on the field names, field types, and annotation information of the metadata; The data used by the base template is substituted into the object file template, and the nested methods of the template engine are called to generate the function code file.
4. The method for generating initial sample data according to claim 1, characterized in that, The process of combining the function code with business requirements to generate initialization sample data includes: The business requirements are parsed to obtain the business functions contained therein; The target function code corresponding to the business function is queried in the function code, and all the target function codes are combined into initialization sample data.
5. The method for generating initialization example data according to claim 4, characterized in that, The step involves querying the target function code corresponding to the business function in the function code, and combining all the target function codes into initialization example data, including: If a target function code corresponding to the business function is found in the function code, the target function code is extracted and combined into the initialization example data; If no target function code corresponding to the business function is found in the function code, the field name, field type and comment information of the business function are obtained, and the template engine nesting method is called to generate the corresponding target function code for the business function. Then, the target function code is combined into the initialization example data and updated synchronously in the function code.
6. An initialization example data generation apparatus, characterized in that, include: Abstract expression unit, used to acquire business data, uses a structured language to abstract all object information of the business data into target information; The object information includes object ID, object attributes, object behavior, object association, object dependency information, and dependency state type; The template writing unit is used to obtain the object association relationship and object dependency information between each object information according to the object ID, and to specify the dependency state type for each object information according to the object association relationship and object dependency information, and to write an object file template in combination with the dependency state type; The step of obtaining object associations and object dependencies among object information based on the object ID, specifying dependency state types for each object based on the object associations and object dependencies, and writing the object file template based on the dependency state types includes: The template format for the object file template is constructed using fixed fields and custom fields; A configuration tool program file for constructing the object file template based on a pre-set business requirement library; wherein, the business requirement library records historical business requirements and related information; Dependency resolution is performed on the dependency state type, and the existence of each object information after dependency resolution is checked according to the template format; When all object information exists, the object file template is constructed by combining the template format, configuration tool program file, and dependency state type. The step of obtaining object associations and object dependency information between object information based on the object ID, specifying dependency state types for each object information based on the object associations and object dependency information, and writing the object file template based on the dependency state types, further includes: Set a parameter list to summarize statistics for different dependency state types; Write the object file template according to the dependency state types in the parameter list; The code generation unit is used to generate function code for the target information based on the object file template and in accordance with the specification logic. The function composition unit is used to combine the function code according to business requirements to generate initialization sample data.
7. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the initialization example data generation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the initialization example data generation method as described in any one of claims 1 to 5.