Multi-data type parameterization definition and program reference processing method and system

文档序号:7459 发布日期:2021-09-17 浏览:28次 中文

1. A multi-data type parameterization definition and program reference processing method is characterized by comprising the following steps:

s1, defining various data in the program according to a uniform format of data type + name, wherein the representation mode of the uniform format data is data label and/or format field;

s2, parameterizing and defining various data defined by the uniform format according to the requirement to obtain a text parameter containing a data label and/or a parameter file containing a structural parameter of a format field; or assigning various types of data defined by the uniform format to the character string variables in the program;

and S3, operating the program, reading the parameters in the parameter file and carrying out data processing on the parameters, or carrying out data processing on the character string variables to obtain the required actual data, and then carrying out subsequent processing as required.

2. The multiple data type parameterization definition and program reference processing method according to claim 1, wherein in step S1, the data tags are used for representing uniform format data in text, the format fields are used for representing uniform format data in database, Json, XML or other formatted data, one or more of the format fields are used according to requirements, and the data tags are used for representing uniform format data;

the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, the two-dimensional label represents data according to the data category and the name, and the two-dimensional label comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label represents data according to data type + name, and comprises a start symbol, a data type, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label, is used for representing data commonly used in a program and comprises a start symbol, a name and an end symbol; the start character comprises one or more characters.

3. The multiple data type parameterization definition and program reference processing method according to claim 2, wherein step S3 specifically comprises the following steps:

running a program, replacing a data tag in the character string variable with an actual numerical value corresponding to the data tag by using a first function or process to obtain a required numerical value, and performing subsequent processing according to the requirement;

the first function or process is to scan the data label in the input character string parameter to obtain the actual data, replace the data label with the actual data, and finally return the result data.

4. The multiple data type parameterization definition and program reference processing method according to claim 2, wherein step S3 specifically comprises the following steps:

and running a program, reading the text parameters from the parameter file, performing numerical value replacement on the data tags in the text parameters by using a first function or process to obtain required data, and performing subsequent processing according to requirements.

5. The multiple data type parameterization definition and program reference processing method according to claim 2, wherein step S3 specifically comprises the following steps:

the method comprises the steps that a program is operated, structured parameters are read from a parameter file, and a first function or a process is called for single-field parameters to replace the numerical values of data labels in the single fields according to the type of the structured parameters; calling a second function for the double fields to acquire actual data; calling a second function for the three fields to acquire actual data, and then converting the actual data from the character string to the specified data type; performing subsequent treatment according to requirements;

the second function is to obtain the actual data value according to the data category and name and return the data value.

6. The multiple data type parameterization definition and program reference processing method according to claim 2, wherein step S3 specifically comprises the following steps:

and operating the program, reading the SQL statement from the parameter file, performing numerical value replacement on the data tag in the SQL statement by utilizing the first function or the process, and executing the SQL statement of the actual numerical value.

7. The method as claimed in claim 2, wherein the data categories include, but are not limited to, constants, custom variables, interface-entered data, procedure call parameters, text files, SQL data, Json, XML, and the like, depending on the development languages.

8. A multiple data type parameterization definition and program reference processing system, comprising:

the data definition unit is used for defining various data in the program according to a uniform format of data type + name, and the representation mode of the uniform format data is a data label and/or a format field;

the parameterization or assignment unit is used for carrying out parameterization definition on various types of data defined in a unified format according to the requirement to obtain a parameter file containing text parameters of a data label and/or structured parameters of a format field; or assigning various types of data defined by the uniform format to the character string variables;

and the data processing unit is used for reading the parameters in the parameter file and carrying out data processing on the parameters or carrying out data processing on the character string variables to obtain required actual data and then carrying out subsequent processing as required.

9. The multiple data type parameterization definition and program reference processing system according to claim 8, wherein in step S1, the data tags are used for representing uniform format data in text, the format fields are used for representing uniform format data in database, Json, XML or other formatted data, one or more of the format fields are used according to the requirement, and the data tags are used for representing uniform format data;

the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, the two-dimensional label represents data according to the data category and the name, and the two-dimensional label comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label represents data according to data type + name, and comprises a start symbol, a data type, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label, is used for representing data commonly used in a program and comprises a start symbol, a name and an end symbol; the start character comprises one or more characters.

Background

The core of the program is essentially to process data functionally, because data in the program is complex, has different sources and different types, software development does not have uniform data description on the data traditionally, and what data are used for writing codes to realize acquisition and then processing is carried out, so that the basic function of data acquisition has many repeated codes, the code amount of the program is large, and the program is complex.

In the software design, a plurality of common values are parametrically defined outside a program through configuration files, and the method can improve the flexibility of software design and use. The traditional parameter definition method only involves some simple fixed value parameters. When the demand of the non-parameterized program changes, the flexibility is poor, the program needs to be modified, the original program needs to be tested, stopped, replaced, and re-run to complete the modification process, which takes more labor and time.

Disclosure of Invention

Aiming at the defects in the prior art, the invention aims to provide a multi-data type parameterization definition and program reference processing method, realize a simple and easy-to-use data representation and value taking method in a program and reduce program codes for data acquisition; the traditional parameter file can only carry out parameter design aiming at some simple fixed values, the invention ensures that various required data can be used in the parameter file, the data parameterization range is enlarged, the function change modification required by a program is completed by modifying the data in the parameter file, and the problems that the non-parameterized program is poor in flexibility, the program is required to be modified, the original program needs to be tested, the original program is stopped, the original program is replaced, the modification process can be completed by running again, and more labor and time are spent are solved, and in order to achieve the purpose, the invention adopts the following specific technical scheme:

a multi-data type parameterization definition and program reference processing method specifically comprises the following steps:

s1, defining various data in the program according to a uniform format of data type + name, wherein the representation mode of the uniform format data is data label and/or format field;

s2, parameterizing and defining various data defined by the uniform format according to the requirement to obtain a text parameter containing a data label and/or a parameter file containing a structural parameter of a format field; or assigning various types of data defined by the uniform format to the character string variables in the program;

and S3, operating the program, reading the parameters in the parameter file and carrying out data processing on the parameters, or carrying out data processing on the character string variables to obtain the required actual data, and then carrying out subsequent processing as required.

Preferably, in step S1, the data tag is used to represent uniform format data in a text, the format field is used to represent uniform format data in a database, Json, XML or other formatted data, one or more of the data tags are used as needed, the data tags are divided into a single field, a double field and three fields according to the number of the fields, one or more of the fields are used as needed, the double field is respectively a data category and a name, the three fields are respectively a data type, a data category and a name, and the single field uses the data tag to represent uniform format data;

the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, and the one-dimensional label is used for representing a commonly used numerical value in a program and comprises a start symbol, a marker symbol, a name and an end symbol; the two-dimensional label represents data according to data category + name, and comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label represents data according to data type + name, and comprises a start symbol, a data type, a name and an end symbol.

Preferably, step S3 specifically includes the following steps:

running a program, replacing a data tag in the character string variable with an actual numerical value corresponding to the data tag by using a first function or process to obtain a required numerical value, and performing subsequent processing according to the requirement;

the first function or process is to scan the data label in the input character string parameter to obtain the actual data, replace the data label with the actual data, and finally return the result data.

Preferably, step S3 specifically includes the following steps:

and running a program, reading the text parameters from the parameter file, performing numerical value replacement on the data tags in the text parameters by using a first function or process to obtain required data, and performing subsequent processing according to requirements.

Preferably, step S3 specifically includes the following steps:

the method comprises the steps that a program is operated, structured parameters are read from a parameter file, and a first function or a process is called for single-field parameters to replace the numerical values of data labels in the single fields according to the type of the structured parameters; calling a second function for the double fields to acquire actual data; calling a second function for the three fields to acquire actual data, and then converting the actual data from the character string to the specified data type; performing subsequent treatment according to requirements;

the second function is to obtain the actual data value according to the data category and name and return the data value.

Preferably, step S3 specifically includes the following steps:

and operating the program, reading the SQL statement from the parameter file, replacing the data tag in the SQL statement by using a first function or process, and executing the SQL statement of the actual numerical value.

Preferably, the data category is various data sources in the software, and includes, but is not limited to, constants, custom variables, interface-entered data, program call parameters, text files, SQL data, Json, and XML according to different development languages.

A multiple data type parameterization definition and program reference processing system, comprising:

the data definition unit is used for carrying out uniform format definition on various data and expression forms thereof in the program and uniformly defining the expression forms of the various data as data labels and/or format fields;

the parameterization or assignment unit is used for carrying out parameterization definition on various types of data defined in a unified format according to the requirement to obtain a parameter file containing text parameters of a data label and/or structured parameters of a format field; or assigning various types of data defined by the uniform format to the character string variables;

and the data processing unit is used for reading the parameters in the parameter file and carrying out data processing on the parameters or carrying out data processing on the character string variables to obtain required actual data and then carrying out subsequent processing as required.

Preferably, the data tag is used for representing uniform format data in a text, the format field is used for representing the uniform format data in a database, Json, XML or other formatted data, one or more of the uniform format data is adopted according to needs, the uniform format data is divided into a single field, a double field and three fields according to the field number, one or more of the single field, the double field is respectively a data type and a name, the three fields are respectively a data type, a data type and a name, and the single field is used for representing the uniform format data by the data tag;

the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, and the one-dimensional label is used for representing a commonly used numerical value in a program and comprises a start symbol, a marker symbol, a name and an end symbol; the two-dimensional label represents data according to data category + name, and comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label is used for representing data according to data type + data category + name, and comprises a start character, a data type, a data category, a name and an end character.

The invention has the beneficial effects that: the method for representing and taking the data in the program is simple and easy to use, and the program code for acquiring the data is simplified; the traditional parameter file can only carry out parameter design aiming at some simple fixed values, the invention ensures that various required data can be used in the parameters, and solves the problems that the non-parametric program has poor flexibility when the requirement changes, the program needs to be modified, the original program needs to be tested, stopped, replaced and re-run to complete the modification process, and more labor and time are spent.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

FIG. 1 is a flow diagram of a multiple data type parameterization definition and program reference processing method according to the present invention;

FIG. 2 is a functional block diagram of a software data bus for uniform format data;

FIG. 3 is a flow chart of a first function;

FIG. 4 is a flow chart of a second function;

FIG. 5 is a flow chart of a third function;

fig. 6 is a flowchart comparing the prior art with the program modification of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Other embodiments, which can be derived by one of ordinary skill in the art from the embodiments given herein without any creative effort, shall fall within the protection scope of the present invention.

As shown in fig. 1, the present invention provides a multi-data type parameterization definition and program reference processing method, which specifically includes the following steps:

s1, defining various data in the program according to a uniform format of data type + name, wherein the representation mode of the uniform format data is data label and/or format field;

as shown in fig. 2 and fig. 4, the present invention proposes a software data bus concept, which is similar to the hardware that obtains data between different devices through a data bus, describes various data in software according to a uniform format of data category + name, and obtains various actual data in a program through the software data bus.

Data type: the method is characterized in that the method is different from the prior art, and comprises constants, custom variables, interface input data, program call parameters, text files, SQL data, Json and XML according to different development languages.

Name: is the specific object name in the data category.

In step S1, the data tag is used to represent the uniform format data in the text, the format field is used to represent the uniform format data in the database, Json, XML or other formatted data, one or more of them are used as required, and the data is divided into a single field, a double field and a three field according to the number of the fields, one or more of them are used as required, the double field is respectively the data type and name, the three fields are respectively the data type, the data type and the name, and the single field uses the data tag to represent the uniform format data;

the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, the two-dimensional label represents data according to the data category and the name, and the two-dimensional label comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label represents data according to data type + name, and comprises a start symbol, a data type, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label, is used for representing data commonly used in a program and comprises a start symbol, a name and an end symbol; the start character comprises one or more characters.

The character strings are obtained by the one-dimensional label and the two-dimensional label, and in software, the character strings can be mutually converted with other types of data; three-dimensional tags are used where the type of data is specified.

The data tags are exemplified below:

one-dimensional labeling:

in the program, there are some common numerical values, and a simple label mode is provided for representing the numerical values.

The format is as follows: start character + name + end character

Inside the program, for each name, it is internally predetermined by the program. Corresponding values are returned accordingly.

Example (c): [ # user name ] [ # user ID ] [ # current date ] [ # current time ]

Wherein the initiator is [ #

Two-dimensional labeling:

the core is as follows: data category + name, return string.

The two-dimensional tag is a standard format using a data bus.

One format is: start character + data category + separator character + name + end character.

Where the data category may be a character, or a string, in which case the separator character must be present. In the case of a special character, the separator character may be null.

Example (c): the [ $ enter. MyName ] represents the input value of the interface entry control MyName, and the initial character is: [ $)

In the name part, for some special data types, such as Json data, which contains a plurality of field data, an extended form may be adopted, in which the field is obtained by processing relative fields inside the program.

Three-dimensional labeling: the data type is added on the basis of the two-dimensional label, and the method is used for occasions needing to specify the data type.

The core is as follows: data type + data class + name

One form is: start character + data type + data category + separator character + name + end character.

Example (c): score represents the input value of the interface entry control score, in integer.

On the basis of the two-dimensional label, a data type and a type separator are added. The type separator is different from the separator in the two-dimensional label.

Other patterns are one example: [ $ data type/data category + name ]

And the program obtains the numerical value of the character string type according to the two-dimensional label for the three-dimensional label, and then carries out type conversion processing on the numerical value according to the data type.

S2, parameterizing and defining various data defined by the uniform format according to the requirement to obtain a text parameter containing a data label and/or a parameter file containing a structural parameter of a format field; or assigning various types of data defined by the uniform format to the character string variables in the program;

and S3, operating the program, reading the parameters in the parameter file and carrying out data processing on the parameters, or carrying out data processing on the character string variables to obtain the required actual data, and then carrying out subsequent processing as required.

Preferably, step S3 specifically includes the following steps:

and running a program, replacing the data tag in the character string variable with the actual numerical value corresponding to the data tag by using a first function or process to obtain a required numerical value, and performing subsequent processing according to requirements.

The first function or process is to scan the data label in the input character string parameter to obtain the actual data, replace the data label with the actual data, and finally return the result data.

Preferably, step S3 specifically includes the following steps:

and running a program, reading the text parameters from the parameter file, performing numerical value replacement on the data tags in the text parameters by using a first function or process to obtain required data, and performing subsequent processing according to requirements.

Preferably, step S3 specifically includes the following steps:

the method comprises the steps that a program is operated, structured parameters are read from a parameter file, and a first function or a process is called for single-field parameters to replace the numerical values of data labels in the single fields according to the type of the structured parameters; calling a second function for the double fields to acquire actual data; calling a second function for the three fields to acquire actual data, and then converting the actual data from the character string to the specified data type; performing subsequent treatment according to requirements;

the second function is to obtain the actual data value according to the data category and name and return the data value.

Preferably, step S3 specifically includes the following steps:

and operating the program, reading the SQL statement from the parameter file, replacing the data tag in the SQL statement by using a first function or process, and executing the SQL statement of the actual numerical value.

As shown in fig. 3, the program flow of the first function or process is as follows:

(1) for input parameter A, scan data tag initiator '[ $'

(2) Scan data label terminator ']', ending position is B

(3) According to the positions of the start character and the end character, acquiring the data label C and removing the intermediate character string of the start character and the end character

(4) Respectively acquiring the data category D and the name E from the intermediate character string by separating characters

(5) Calling a second function (D, E) to obtain a value F

(6) Substituting the data label C in A into F

(7) The length of the lower value F minus the length of the data tag C is calculated as G

(8) Steps 1 to 6 are performed starting from position B + G until the end of the string.

//

(9) One-dimensional labels are processed beginning with a scan position of 1.

(10) Begin scanning for data tag initiator [ #in A

(11) Scan data label terminator ']'. The end position is B2

(12) Obtaining the data label C2 and the name E2 in the data label

(13) The third function (E2) is called to obtain the value F2.

(14) Substitution of this data tag C2 with F2

(15.) calculate the length of F2 minus the length of data tag C2, respectively, as G2

(16) The scan continues from position B2+ G2, executing 10-14 until the end of the string.

The program flow of the second function is as follows (fig. 4):

obtaining a numerical value according to the category and the name: second function (Category, name)

(1) Obtain class, Name

(2) And respectively acquiring numerical values from corresponding data sources according to the categories and the names.

If the category is input, a value is obtained from the control named Name.

If the category is URL, obtaining the URL parameter value with Name from the URL.

And if the category is a custom variable, acquiring a custom variable value named as the Name.

And if the category is a text file, reading the content of the text file with the file Name.

.....

(3) And returning a result, wherein the type is a character string.

Establishing a third function to obtain a one-dimensional label numerical function: third function (name)

The procedure is as follows (FIG. 5):

using switch (name) to connect

Case "user name" result is the current user name variable value.

break;

Case "current date": result is system date;

break;

case "current time", the result is the current time;

Break;

.....

}

the following examples illustrate practical applications of the present invention:

the web page is used for inputting a real name after a user logs in, and then displaying a receiving page.

The project page consists of 2 pages, page a contains an input control named MyName and a submit button. Page B displays acceptance information. Each page is a program (page a program is a.aspx, page B program is b.aspx).

Procedure a: query button, the executed instructions are: response.redlict (query page parameter); the query page parameters are defined as follows:

the parameter file 1 defines: aspxname [ $ input. MyName ]

The program A button action reads the definition in the parameter file 1, the page parameter is inquired, the inquiry button action is executed, the mode of calling the program B is changed, only the parameter file 1 needs to be modified, and the program A does not need to be modified.

And a program B for displaying the acceptance information, wherein the acceptance information display content parameter file is defined as follows:

the parameter file 2 defines:

name ], welcome you.

Your application has been accepted.

Account number: application time [ # user name ]: [ # Current time ]

For the display content, the program B only needs to read the parameter file 2 definition into the variable S from the parameter file, replace the data tag in S with the actual value by using the first function, and then display S to complete the required function. The data label content does not need to be assigned by a program to each variable content. The display content is added in the method, and the program is not required to be modified as long as the parameter definition is modified.

Fig. 5 is a third function flow chart, fig. 6a is a flow chart of program modification in the prior art, and fig. 6b is a flow chart of program modification in the present invention. The invention solves the problems that when the demand of the non-parameterized program changes, the flexibility is poor, the program needs to be modified, the original program needs to be tested, stopped, replaced and re-run to finish the modification process, and more labor and time are spent.

The invention also provides a system for parameterizing and defining multiple data types and processing program reference, which comprises the following steps:

the data definition unit is used for carrying out uniform format definition on various data and expression forms thereof in the program and uniformly defining the expression forms of the various data as data labels and/or format fields;

the parameterization or assignment unit is used for carrying out parameterization definition on various types of data defined in a unified format according to the requirement to obtain a parameter file containing text parameters of a data label and/or structured parameters of a format field; or assigning various types of data defined by the uniform format to the character string variables;

and the data processing unit is used for reading the parameters in the parameter file and carrying out data processing on the parameters or carrying out data processing on the character string variables to obtain required actual data and then carrying out subsequent processing as required.

Preferably, the data tag is used for representing uniform format data in a text, the format field is used for representing the uniform format data in a database, Json, XML or other formatted data, one or more of the uniform format data is adopted according to needs, the uniform format data is divided into a single field, a double field and three fields according to the field number, one or more of the single field, the double field is respectively a data type and a name, the three fields are respectively a data type, a data type and a name, and the single field is used for representing the uniform format data by the data tag; the data label adopts one or more of a one-dimensional label, a two-dimensional label and a three-dimensional label, the two-dimensional label represents data according to the data category and the name, and the two-dimensional label comprises a start symbol, a data category, a name and an end symbol; the three-dimensional label represents data according to data type + name, and comprises a start symbol, a data type, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label, is used for representing data commonly used in a program and comprises a start symbol, a name and an end symbol; the start character comprises one or more characters.

The invention has the advantages that:

1. by means of the program data bus concept, a data unified format with concise and clear data and a corresponding representation and value taking method of data types and names are established, and program codes for data acquisition are simplified.

2. The data label and the data expression mode of the format field realize the parameterization of data outside the program, thereby greatly expanding the range of parameterized data and expanding the flexibility of program design.

3. The method can realize parametric design and program function updating through parameter adjustment, and does not need program modification and compiling.

In light of the foregoing description of the preferred embodiments of the present invention, those skilled in the art can now make various alterations and modifications without departing from the scope of the invention. The technical scope of the present invention is not limited to the contents of the specification, and must be determined according to the scope of the claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:接口的测试方法、装置、电子设备及计算机可读介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!