The embodiments discussed herein are related to metadata processing technology.
If program metadata is generated, the metadata can be utilized to, for example, automatically generate another program.
Japanese Laid-open Patent Publication No. 2008-090707 and Japanese Laid-open Patent Publication No. 2011-186929 are disclosed as related art.
According to an aspect of the embodiments, a non-transitory computer-readable recording medium stores therein a metadata processing program for causing a computer to execute a process including: extracting, based on comparison between a first input item name of first input data and a first output item name of first output data, an element other than an element included in both of the first input item name and the first output item name; and generating, when the extracted element and an argument of a program which generates the first output data from the first input data include an element related to a first input item value of the first input data, metadata in which the element related to the first input item value in the extracted element is transformed into a variable.
The object and advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention.
For example, the more versatile the metadata is, the higher the utility value of the metadata becomes. However, it takes time and effort to create metadata manually.
With regard to the generation of metadata, by analyzing a program itself, metadata of the program is generated. However, analyzing the program itself may not generate appropriate metadata in some cases.
For example, a technology for automatically generating versatile metadata may be provided.
In the following, it is considered to generate metadata of a program that causes a processor to execute a process of outputting a table using data registered in another table as an input.
For example, it is assumed that, when a certain program “sum_per_branch” is executed, a table illustrated in
Therefore, metadata as illustrated in
However, since the representation of metadata generated as mentioned above is limited, the purpose of utilization is sometimes restricted. In the example in
Therefore, in the following, a method of generating more versatile metadata will be described.
The metadata generating part 101 executes processes on the basis of an input table accumulated in the input table accumulating part 111, an output table accumulated in the output table accumulating part 113, and program data accumulated in the program accumulating part 123, and accumulates the processing results in the metadata accumulating part 117, the template data accumulating part 119, the function word list accumulating part 115, and the related item value accumulating part 121. The diversion processing part 103 executes processes on the basis of data accumulated in the metadata accumulating part 117, data accumulated in the template data accumulating part 119, and data accumulated in the related item value accumulating part 121, and accumulates the processing results in the output table accumulating part 113.
Next, a process executed by the metadata processing apparatus 1 will be described with reference to
The metadata generating part 101 reads the input table accumulated in the input table accumulating part 111, the program data accumulated in the program accumulating part 123, and the output table accumulated in the output table accumulating part 113 (
The metadata generating part 101 determines whether or not, among the item names of the output table read in step S1 (in the example in
When there is an unprocessed output item name (step S3: Yes route), the metadata generating part 101 specifies one unprocessed output item name (step S5).
The metadata generating part 101 determines whether or not the output item name specified in step S5 is related to any of the item names of the input table (in the example in
When the output item name specified in step S5 is not related to any of the input item names read in step S1 (step S7: No route), the process returns to step S3.
On the other hand, when the output item name specified in step S5 is related to one of the input item names read in step S1 (step S7: Yes route), the metadata generating part 101 executes the following process. For example, the metadata generating part 101 specifies an element related to the input item name and an element not related to the input item name in the output item name. Then, the metadata generating part 101 generates an item name in which the element related to the input item name in the output item name serves as a variable and the element not related to the input item name in the output item name serves as a function word (step S9). The metadata generating part 101 accumulates the generated item name in the template data accumulating part 119.
For example, when the output item name is “year” and the input item name is “year”, the element “year” of the output item name is transformed into a variable (parameterized) and, as illustrated in
The metadata generating part 101 determines whether or not an element related to the item value (for example, “Aikawa”, “Aida”, and “Aiba”) of the input table read in step S1 is included in the function word specified in step S9 and an argument included in the program data (hereinafter referred to as program argument) read in step S1 (step S11). Note that, when the function word is not specified in step S9, it is determined in step S11 that the result is “No”.
When an element related to the item value of the input table (hereinafter referred to as input item value) read in step S1 is not included in the function word specified in step S9 and the program argument (step S11: No route), the process returns to step S3.
On the other hand, when an element related to the input item value read in step S1 is included in the function word specified in step S9 and the program argument (step S11: Yes route), the metadata generating part 101 executes the following process. For example, the metadata generating part 101 specifies an element related to the input item value and an element not related to the input item value in the function word specified in step S9. Then, the metadata generating part 101 generates an item name in which the element related to the input item value serves as a variable and the element not related to the input item value serves as a function word, and replaces the item name generated in step S9 with the generated item name (step S13). In addition, the metadata generating part 101 corrects the function word registered in the function word list accumulating part 115. The process then returns to step S3.
For example, in the example in
Additionally, once the process is further executed for the output item name “number of visits to store” of the output table illustrated in
On the other hand, when there is no unprocessed output item name (step S3: No route), the metadata generating part 101 registers the program data read in step S1 and the generated item name (for example, the item name accumulated in the template data accumulating part 119 as template data) in the metadata accumulating part 117 (step S15). The process then ends.
As described above, in the present embodiment, the item name of the output table is decomposed into the function word, the element related to the input item name, and the element related to the input item value, and besides, the element also serving as an argument of the program is transformed into a variable. Since the metadata of the program contains a variable, the program is allowed to be utilized in a variety of cases. In the example mentioned above, the program is allowed to be utilized for an extraction process for another input item value different from “Aida”.
Furthermore, as compared with a case where a program is prepared for each type of extraction process, in the method according to the present embodiment, it is sufficient to merely have one program and metadata corresponding to the program. Accordingly, when the number of types of extraction process is several tens or more, taking into account that the data amount of metadata corresponding to one program is usually smaller than the data amount of the program, the data amount is preferably decreased to one several tenths.
Next, a process of diverting a program to another case by utilizing the registered metadata will be described with reference to
First, the metadata generating part 101 reads the input table accumulated in the input table accumulating part 111 and the function word list accumulated in the function word list accumulating part 115. Then, the metadata generating part 101 outputs the read input table and function word list (
For example, an input table as illustrated in
A user who has confirmed the input table and the function word list thinks what kind of output item name is expected to be obtained. Then, the user inputs one or a plurality of output item names using an input device such as a keyboard, a mouse, or a touch panel. Then, the metadata generating part 101 receives an input of the output item name (step S23).
For example, when the user inputs “branch name containing Nakahara”, “month”, and “sales” as output item names, an output table in which data is not filled is generated as illustrated in
The metadata generating part 101 determines whether or not there is an unprocessed output item name among the output item names of which inputs have been received in step S23 (step S25).
When there is an unprocessed output item name (step S25: Yes route), the metadata generating part 101 specifies one unprocessed output item name (step S27).
The metadata generating part 101 determines whether or not the output item name specified in step S27 is related to any of the input item names of the input table displayed in step S21 (in the example in
When the output item name specified in step S27 is not related to any of the input item names of the input table displayed in step S21 (step S29: No route), the process returns to step S25.
On the other hand, when the output item name specified in step S27 is related to one of the input item names of the input table displayed in step S21 (step S29: Yes route), the metadata generating part 101 executes the following process. For example, the metadata generating part 101 specifies an element related to the input item name and an element not related to the input item name in the output item name. Then, the metadata generating part 101 generates an item name in which the element related to the input item name in the output item name serves as a variable and the element not related to the input item name in the output item name serves as a function word (step S31). The metadata generating part 101 accumulates the generated item name in the template data accumulating part 119.
For example, when the input item name is “branch name” and the output item name is “branch name containing Nakahara”, the element “branch name” of the output item name is transformed into a variable and the element “containing Nakahara” of the output item name is treated as a function word; as a consequence, an item name “$input C.containing Nakahara” is generated as illustrated in
The metadata generating part 101 determines whether or not the function word specified in step S31 is related to the input item value of the input table displayed in step S21 (for example, “Maruko”, “Kosugi”, and “Nakahara”) (step S33). Note that, when the function word is not specified in step S31, it is determined in step S33 that the result is “No”.
When the function word specified in step S31 is not related to the input item value of the input table displayed in step S21 (step S33: No route), the process returns to step S25.
On the other hand, when the function word specified in step S31 is related to the input item value of the input table displayed in step S21 (step S33: Yes route), the metadata generating part 101 executes the following process. For example, the metadata generating part 101 specifies an element related to the input item value and an element not related to the input item value in the function word specified in step S31. Then, the metadata generating part 101 generates an item name in which the element related to the input item value serves as a variable and the element not related to the input item value serves as a function word, and replaces the item name generated in step S31 with the generated item name (step S35). In addition, the metadata generating part 101 corrects the function word registered in the function word list accumulating part 115 and accumulates the input item value determined to be related (for example, the related item value) in the related item value accumulating part 121. The process then returns to step S25.
For example, in
Additionally, once the process is further executed for the output item name “month” of the output table illustrated in
On the other hand, when there is no unprocessed output item name (step S25: No route), the process shifts to step S37 in
Shifting to the description of
For example, when the item name rearrangement is executed on the template data illustrated in
The diversion processing part 103 determines whether or not there is a pattern having the same structure as the structure of the metadata (step S41). When there is no pattern having the same structure as the structure of the metadata (step S41: No route), the process ends because there is no divertable program.
On the other hand, when there is a pattern having the same structure as the structure of the metadata (step S41: Yes route), the diversion processing part 103 specifies one pattern having the same structure as the structure of the metadata and executes the following process. For example, the diversion processing part 103 rearranges the columns of the input table on the basis of the correspondence relationship between the item names included in the specified pattern and the item names included in the metadata (step S43).
For example, as illustrated in
The diversion processing part 103 reads the program data accumulated in the metadata accumulating part 117 and replaces an argument (in this case, an argument associated with the input item value) included in the read program data with the related item value accumulated in the related item value accumulating part 121 (step S45). For example, the argument “Aida” in the program data “filter 2 Aida” is substituted with “Nakahara”. By this process, the original program is allowed to be executed in this case.
The diversion processing part 103 executes the program with the program data whose argument has been replaced in step S45, with respect to the input table whose columns have been rearranged in step S43 (step S47).
By the process in step S47, for example, a table as illustrated in
The diversion processing part 103 rearranges the columns of the table generated by the process in step S47 by the rearrangement in the case of restoring the structure of the specified pattern to the structure of the original template data (step S49). The diversion processing part 103 accumulates the output table generated by the process in step S49 in the output table accumulating part 113. The process then ends.
For example, as illustrated in
By executing the above-described process, a certain process of generating an output table from an input table is properly implemented by an existing program, and the time and effort expected to create a program from scratch is preferably reduced.
Although the embodiments of the present invention have been described thus far, the present invention is not limited to these embodiments. For example, the functional block configuration of the metadata processing apparatus 1 described above may not match the actual program module configuration.
Furthermore, the configuration of each table described above is an example and the configuration is not necessarily as described above. In the processing flow, it is also practicable to exchange the order of processes as long as the processing result does not change. The processes may be executed in parallel.
The present embodiments may be applied not to the extraction process but to another process (for example, a substitution process of substituting an item value with another value).
The method of representing the variables, the template data, and the like is not limited to the example indicated above.
The metadata processing apparatus 1 described above is a computer apparatus and, as illustrated in
The embodiments of the present invention described thus far are summarized as follows.
A metadata processing method according to a first mode of the present embodiment includes: (A) extracting an element other than an element included in both of an item name of first input data and an item name of first output data, on the basis of comparison between item names of the first input data and item names of the first output data; and (B) generating, when the extracted element and an argument of a program for generating the first output data from the first input data include an element related to an item value of the first input data, metadata in which the element related to the item value of the first input data in the extracted element is transformed into a variable.
The metadata becomes more versatile because the metadata contains a variable.
In the generating the metadata, (b1) metadata in which an element related to an item value of the first input data in the extracted element is transformed into a variable, and an element included in both of an item name of the first input data and an item name of the first output data is transformed into a variable may be generated.
The metadata becomes more versatile because a part of the metadata is further transformed into a variable.
The present metadata processing method may further include: (C) extracting an element other than an element included in both of an item name of second input data and a designated item name, on the basis of comparison between the item name of the second input data and the designated item name; (D) generating, when the extracted element includes an element related to an item value of the second input data, template data in which the element related to the item value of the second input data in the extracted element is transformed into a variable; (E) rearranging columns of the second input data on the basis of a correspondence relationship between elements included in the metadata and elements included in the template data; and (F) executing the program with the second input data of which the columns have been rearranged, as an input to generate second output data.
The program is allowed to be diverted to a process of other input data
In the rearranging the columns of the second input data, (e1) item names included in the template data may be rearranged such that a format of the metadata matches a format of the template data, and the columns of the second input data may be rearranged on the basis of a correspondence relationship between elements included in the metadata and elements included in the template data of which the item names have been rearranged. The present metadata processing method may further include (G) executing the same rearrangement as rearrangement in the case of restoring an arrangement of the item names included in the template data to an original arrangement, with respect to the columns of the second output data.
It becomes easier to cope with a case where the format of the metadata and the format of the template data are different from each other.
A metadata processing apparatus according to a second mode of the present embodiment includes: (H) a data accumulating part (for example, the input table accumulating part 111 and the output table accumulating part 113) that accumulates first input data and first output data; and (I) a generating part (for example, the metadata generating part 101) that extracts an element other than an element included in both of an item name of the first input data and an item name of the first output data, on the basis of comparison between item names of the first input data and item names of the first output data, and, when the extracted element and an argument of a program for generating the first output data from the first input data include an element related to an item value of the first input data, generates metadata in which the element related to the item value of the first input data in the extracted element is transformed into a variable.
A program for causing a computer to execute the process according to the above method can be created, and the program is accumulated in, for example, a computer readable storage medium or storage device, such as a flexible disk, a compact disk read only memory (CD-ROM), a magneto-optical disk, a semiconductor memory, or a hard disk. An intermediate processing result is temporarily saved in a storage device such as a main memory.
All examples and conditional language provided herein are intended for the pedagogical purposes of aiding the reader in understanding the invention and the concepts contributed by the inventor to further the art, and are not to be construed as limitations to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although one or more embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2017-002190 | Jan 2017 | JP | national |
This application is a continuation application of International Application PCT/JP2017/046674 filed on Dec. 26, 2017 and designated the U.S., the entire contents of which are incorporated herein by reference. The International Application PCT/JP2017/046674 is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2017-002190, filed on Jan. 10, 2017, the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/JP2017/046674 | Dec 2017 | US |
Child | 16451618 | US |