QUERY GENERATING METHOD AND QUERY GENERATING DEVICE

Provided is a query generating method for generating a query which processes an inputted data stream with a computer provided with a processor and memory, said method comprising: a first step of the computer separating the inputted data stream into a required column and an optional column, and loading a template which defines a process with respect to the required column; and a second step of the computer separating the inputted data stream into a required column and an optional column, processing the required columns with the template, and generating a query which outputs the result of the processing of the template and the optional column as one instance of data.

BACKGROUND

This invention relates to a technology of creating a template for a query for processing stream data.

Stream data processing is known as a technology of processing data from a multitude of sensors, and data related to settlement and buying and selling of financial organizations or other similar entities. In stream data processing, a query is registered in a system first and, when data arrives, the query is executed continuously. Continuous Query Language (CQL) is a favorable example of a language in which the query is written.

There has been known a technology of creating a template for a stream data processing query that is written in CQL in order to expand the range of use of stream data processing (for example, US 2011/0093490 A1).

SUMMARY

In the technology of US 2011/0093490 A1, however, the schema of input stream data that is defined in the template is fixed. The schema of the template therefore needs to be modified depending on the type of the data source when a large quantity of information as in a social networking service (SNS), a blog, or the like is used for input stream data. Specifically, the schema of a template that has information of one SNS as input stream data differs from a schema for information of other SNSs and, accordingly, it is necessary to redefine the template in the language in which the query is written, or to prepare numerous templates in advance.

Redefining a template in the language in which the query is written requires a person capable of programming a query, and not all users who use stream data processing possess that ability. Preparing numerous templates in advance has a problem of increasing the work and cost of software  engineers and the like.

This invention has been made in view of the problems described above, and an object of this invention is therefore to cut the cost of developing a template for a query by receiving a plurality of inputs without preparing numerous templates.

A representative aspect of this invention is as follows. A query generating method for generating a query for processing input stream data, the query generating method being performed by a computer comprising a processor and a memory, the query generating method comprising: a first step of reading, by the computer, a template in which the input stream data is divided into an essential column and an option column, and processing to be executed for the essential column is defined; and a second step of generating, by the computer, a query for dividing the input stream data into the essential column and the option column, for processing the essential column by using the template, and for outputting a result of the processing of the template and the option column as one piece of data.

According to this invention, input stream data is divided into an essential column and an option column, and the essential column on which processing of a template has been performed is combined with the option column. Receiving inputs of a plurality of types with the use of a single template is thus accomplished, and the cost of developing a template can be reduced by keeping the number of template types small.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Embodiments of this invention are described below with reference to the accompanying drawings.

First Embodiment

FIG. 1is a block diagram for illustrating an example of a computer system according to a first embodiment of this invention. A stream processing executing server101, which executes processing of stream data, is coupled via a network110to a query generating server107, which generates stream processing queries700based on a template, a terminal130through which a template is operated and other types of operation is performed, and a data source140, which supplies stream data. The data source140can be, for example, a social networking service (SNS) or a blog.

The stream processing executing server101includes a CPU104, which executes computing processing, a memory102, which holds data and programs, storage105, which stores programs and data, and an I/O interface106, which is coupled to the network110. A stream data processing engine103in the form of a program is loaded onto the memory102and executed by the CPU104. The stream data processing engine103can be stored in the storage105.

The stream data processing engine103processes stream data received from the data source140by, as described later, continuously executing the relevant stream processing query700generated by the query generating  server107. Continuous Query Language (CQL) described above, for example, can be used for the stream processing queries700. The following description takes as an example a case in which the stream processing queries700are written in CQL.

The query generating server107includes a CPU121, which executes computing processing, a memory122, which holds data and programs, storage123, which stores programs and data, and an I/O interface124, which is coupled to the network110. A template registering module108and a query generating module109in the form of a program are loaded onto the memory122and executed by the CPU121. The storage123stores templates111, pieces of template configuration information112, stream processing definitions500, and the stream processing queries700. The template registering module108and the query generating module109in the form of a program can be stored in the storage123.

The template configuration information112and function modules of the query generating module109are loaded in the form of a program onto the memory122. The CPU121executes processing as programmed by the respective programs of the function modules, to thereby operate as function modules that provide given functions. For example, the CPU121executes processing as programmed by a template registering program, to thereby function as the template registering module108. The same applies to other programs. The CPU121further operates as function modules that provide functions of a plurality of processing procedures executed by each program. A computer and a computer system are an apparatus and a system that include those function modules.

Programs, tables, and other types of information for implementing the functions of the query generating server107can be stored in the storage123, or in a non-volatile semiconductor memory, or in a storage device such as a hard disk drive or a solid state drive (SSD), or in a computer-readable,  non-transitory data storage medium such as an IC card, an SD card, or a DVD.

In main processing of the query generating server107, the template registering module108sets the templates111and stores the templates111and the template configuration information112in the storage123. When a stream processing definition is input, the templates111and the template configuration information112are used by the query generating module109to generate the stream processing queries700.

The terminal130is a computer that includes a CPU, a memory, storage, an I/O interface, and an input/output apparatus (not shown), and is operated by a user or an administrator.

FIG. 2is a block diagram for illustrating an outline of processing that is executed by each stream processing query700generated with the use of the templates111of this invention.

The stream processing query700divides input stream data into two types of data by extracting an essential column, which includes text, from the stream data and extracting an option column from the stream data. The stream processing query700at this point assigns an identifier that associates the essential column and the option column with each other (701). In the example ofFIG. 2, the stream processing query700assigns a text ID (“textID” in the drawing) to each of the essential column and the option column.

The stream processing query700then executes template processing to check whether the essential column partially matches a letter string that is a given keyword (“keyword”), and outputs the essential column that includes the given keyword (702). The stream processing query700uses a given window operator to combine the output of the letter string partial matching processing with option column data whose text ID matches the text ID of the output (703). In the example ofFIG. 2, the NOW window is used to combine the output stream data of the template processing (702) with the option column data.

In this invention, an essential column, which includes essential text, is extracted from input stream data and other portions of the input stream data than the text of the essential column is separated as an option column. The essential column is processed by given processing (702) with the use of one of the templates111, and the output of the template111is then combined with the option column.

In this manner, only the essential column needs to be defined in each template111in order to apply the template111to stream data that has a different schema. In addition, the option column can be handled as metadata. The option column may be input stream data itself, or may be data that is obtained by subtracting the essential column from input stream data.

FIG. 3is a block diagram for illustrating an example of input-output relations of the query generating module109. The query generating module109includes a template calling information generating module202to which the preset stream processing definitions500are input to generate template calling information203, and a combining processing inserting module204, which generates the stream processing query700.

The template calling information generating module202obtains configuration information of the templates111(the template configuration information112) written in the stream processing definitions500, and generates the template calling information203, which indicates for each template111the relation between input stream data and output stream data.

The combining processing inserting module204generates the stream processing query700by determining the output column to be combined and the window size based on the stream processing definitions500and the template configuration information112.

An example of the templates111used in this embodiment is shown inFIG. 4AandFIG. 4B.FIG. 4Ais a diagram for showing an example of a  template111-1(string_part_match).

The template111-1defines a query that combines inquiry results of two SELECT statements. The query defined by the template111-1combines an inquiry in which, when the value of an essential column “str” includes a letter string specified by “$key”, the value of “extracted” is the letter string specified by “$key” with an inquiry in which, when the value of the essential column “str” does not include the letter string specified by “$key”, the value of “extracted” is an empty letter string.

FIG. 4Bis a diagram for showing an example of a template111-2(string_match).

The template111-2defines a query that combines inquiry results of two SELECT statements. The query defined by the template111-2combines an inquiry in which, when the value of the essential column “str” matches the letter string specified by “$key”, the value of “extracted” is the letter string specified by “$key” with an inquiry in which, when the value of the essential column “str” does not match the letter string specified by “$key”, the value of “extracted” is an empty letter string.

The templates111-1and111-2are collectively denoted by a symbol111in the following description.

The template configuration information112-1includes a field for a name1121in which the name (or function name) of the template111-1is stored, a field for an input schema1122, which corresponds to the essential column, a field for an output schema1123, which indicates an output from the template111-1, a field for an ID1124in which an identifier is stored, and a field for a combining window size1125in which the window size in  combining processing is stored.

The input schema1122corresponds to an essential column2034of the template calling information203which is described later, and the output schema1123corresponds to an output column2036of the template calling information203.

The template configuration information112-1and112-2are collectively denoted by a symbol112in the following description.

As described, the templates111and template configuration information112of this invention define only a letter string (STRING) as the essential column of the input schema1122, which allows the system to handle data of various SNSs and a diversity of blogs as input stream data.

FIG. 6is a diagram for showing an example of the stream processing definitions500. The stream processing definitions500are created in advance by a developer or the like and stored in the storage123. The query generating server107follows one of the stream processing definitions500that is specified by a query generation request from the terminal130in generating one stream processing query700.

Each stream processing definition500defines the name and configuration of stream data that is input in a stream definition501. In the example ofFIG. 6, the name of input stream data is “twitter”, a “msgID” column holds a letter string, a “time” column holds a time stamp, a “text” column holds a letter string, and a “userID” column holds a letter string.  Those constitute the input schema of input stream data the name of which is “twitter”.

The stream processing definition500further defines that two templates111are to be called in template calls502and503. The template call502indicates that a template whose call name is “twitter_keyword” and whose type (or function) is “string_part_match” (letter string partial matching processing) is called in “CALL TEMPLATE”. The template call502indicates that, in the template having the call name “twitter_keyword” (111-1ofFIG. 4A), a column “text” of stream data “twitter” is the essential column, columns “text” and “keyword” of stream data “twitter_keyword” are output stream data, and a variable “key” is “bigData”.

In the template call503, the template (111-2ofFIG. 4B) whose call name is “twitter_keyword_influencer” and whose type (or function) is “string_match” (letter string matching processing) is called in “CALL TEMPLATE”. The template call503indicates that, in the template111-2having the call name “twitter_keyword_influence”, a column “userID” of stream data “twitter_keyword” is the essential column, columns “userID” and “influencer” of stream data “twitter_keyword_influencer” are output stream data, and a variable “key” is “Bob”. Input stream data of the template having the call name “twitter_keyword_influencer” is the output stream data of the template “twitter_keyword” of the template call502.

The option column of the template having the call name “twitter_keyword” includes other columns than the essential column “text” out of the columns in the stream definition501, namely, the columns “msgID”, “time”, and “userID”. The option column of the template having the call name “twitter_keyword_influencer” includes other columns than the essential column “userID”, namely, the columns “msgID”, “time”, “text”, and “keyword”. The columns “msgID”, “time”, “text”, and “userID” constitute the input schema of the template having the call name “twitter_keyword_influencer”.

The stream processing definitions500thus define for each template111stream data that is input and stream data that is output.

FIG. 7is a diagram for showing an example of the template calling information203. The template calling information203is a table that holds input-output relations extracted from the stream processing definition500ofFIG. 6.

Each single record of the template calling information203includes a field for a template call name2031which stores the call name of one of the templates111in the stream processing definition500ofFIG. 6, a field for a template2032which stores the type (or function) of the template111, a field for an input schema2033which stores columns to be input, a field for an essential column2034which stores the essential column of the template111, a field for an option column2035, and a field for an output column2036which stores columns output from the template111.

The values of those fields2031to2036may be extracted from the stream definition501and definitions of the template calls502and503ofFIG. 6.

FIG. 8andFIG. 9are the first half and second half of a diagram for showing an example of one stream processing query700that is generated by the query generating module109with the use of the templates111. The query generating module109creates in711ofFIG. 8a definition that is a copy of the stream definition501in the stream processing definition500ofFIG. 6, and that defines the name and input schema of stream data processing.

The query generating module109defines in712ofFIG. 8a query that assigns an ID to the input data and that associates the essential column and the option column with each other. This query corresponds to the ID assignment ofFIG. 2.

The query generating module109next reads the template call502of  the read stream processing definition500and the template111-1to deploy the specifics of “string_part_match” of the template111-1in the stream processing query700(713). The query generating module109inserts a combining query definition that combines the output column of the template “string_part_match” with the option column (714). The insertion of the combining query definition is executed by the combining processing inserting module204ofFIG. 3in a manner described later.

In715to717ofFIG. 9, the query generating module109executes steps similar to those inFIG. 8which include assigning an ID to data (715), reading the template call503of the read stream processing definition500and the template111-2to deploy the specifics of “string_match” of the template111-2in the stream processing query700(716), and inserting a combining query definition that combines the output column of the template “string_match” with the option column (717). The insertion of the combining query definition is executed, as in714described above, by the combining processing inserting module204in a manner described later.

The query generating module109thus generates the stream processing query700from the two templates111-1and111-2that are included in the read stream processing definition500.

Details of the processing that is executed by the query generating module109ofFIG. 3are described below.

FIG. 10is a flowchart for illustrating an example of processing that is executed by the template calling information generating module202. This processing is executed when the query generating server107receives a query generation request from the terminal130(901). The query generation request specifies one of the stream processing definitions500.

The template calling information generating module202of the query generating module109reads the stream processing definitions500specified in the query generation request out of the storage123(902). The template  calling information generating module202next extracts the templates111that are included in the stream processing definitions500. The template calling information generating module202reads configuration information of the extracted templates111(the template configuration information112) out of the storage123(903). The templates111extracted from the stream processing definitions500may be the templates111that are written in “CALL TEMPLATE” as in the template calls502and503ofFIG. 6.

The template calling information generating module202determines for each read piece of the template configuration information112whether or not the template calling information203is registered in the memory122(904).

In the case where the template calling information203is already registered for every read piece of the template configuration information112, the template calling information generating module202ends the processing (907).

In the case where the template configuration information112for which the template calling information203has not been registered is found, the template calling information generating module202generates the template calling information203for each found piece of the template configuration information112, and stores the generated information in the memory122in Steps905and906.

First, in Step905, the template calling information generating module202obtains from the stream processing definitions500information about a template for which the schema of input stream data has been established. With the schema of input stream data established, input schemata and output schemata are tracked starting from the template111that has the stream definition501in the stream processing definitions500ofFIG. 6as an input to register the template calling information203for each piece of the template configuration information112. Specifically, a template call name, an input  schema, an essential column, and an output column that are written in the stream processing definitions500are registered as2031,2033,2034, and2036, respectively, in the template calling information203. The template calling information generating module202also registers other columns of the input stream data than the essential column (which can be obtained from the input schema2033) as the option column2035in the template calling information203.

In Step906, the template calling information generating module202sets the group of columns included in the output column2036and the option column2035as the schema of input stream data of the next template, which has the output stream data of the current template111as an input. In other words, the output schema of the preceding template111is established and the template111that has the established output schema as an input is set as the next processing target. The template calling information generating module202then returns to Step904to repeat the processing described above for every read piece of the template configuration information112.

Through the processing described above, the template calling information203is generated for the template configuration information112of each template written in the stream processing definitions500while establishing input schemata and output schemata. In other words, the processing is executed sequentially from the template111for which the output schema of its preceding template has been established. The template calling information203may be stored in the storage123.

FIG. 11is a flowchart for illustrating an example of processing that is executed by the combining processing inserting module204of the query generating module109ofFIG. 3. This processing is executed after the processing of the template calling information generating module202is completed.

The combining processing inserting module204first reads the stream  processing definitions500, the template configuration information112, and the template calling information203(1001and1002). The combining processing inserting module204determines whether or not the generation of the ID assigning query, the in-template query, and the combining query has been completed for every template111written in the stream processing definitions500(1003). In the case where the generation processing has been completed for every written template111, the combining processing inserting module204ends this combining processing (1008). In the case where the template111for which the generation processing has not been completed is found, the combining processing inserting module204repeatedly executes Steps1004to1006until every written template111has been processed.

The combining processing inserting module204extracts the template111for which the ID assigning query, the in-template query, and the combining query have not been generated (1004). The combining processing inserting module204executes ID assigning query definition generating processing (an ID assigning query definition generating module) shown inFIG. 12for the extracted template111(1005). The combining processing inserting module204next executes in-template query definition generating processing (an in-template query definition generating module) shown inFIG. 13(1006). The combining processing inserting module204then executes combining query definition generating processing (a combining query definition generating module) shown inFIG. 14(1007).

Details of processing of generating the ID assigning query, the in-template query, and the combining query for each template111are described below. The combining processing inserting module204includes the ID assigning query definition generating module, the in-template query definition generating module, and the combining query definition generating module, and is at the center of the execution of the following processing.

FIG. 12is a flowchart for illustrating an example of processing that is  executed in the ID assigning query definition generating processing of Step1005inFIG. 11. The combining processing inserting module204calls one template111out of the extracted templates111, and sets, as an input, input stream data that is input to the called template111(1101and1102).

The combining processing inserting module204generates the definition of a query for assigning the input stream data an identifier that uniquely associates the input stream data with the output of the template111(for example, textID ofFIG. 2) (the ID assigning query). The column name of the identifier is the ID in the template configuration information112(1124ofFIG. 5A).

Through the processing described above, the combining processing inserting module204generates a query for assigning the input stream data an identifier that uniquely associates the input stream data with the output of the template111as the ID assigning query definition of the called template111. The ID assigning query definitions in712ofFIGS. 8 and 715ofFIG. 9are generated by this processing in this embodiment.

FIG. 13is a flowchart for illustrating an example of processing that is executed in the in-template query definition generating processing of Step1006inFIG. 11. The combining processing inserting module204executes the following processing for the template111called inFIG. 12(2601).

The combining processing inserting module204reads a query written in the called template111(2602). The combining processing inserting module204defines input stream data of the called template111which is included in the read query as the output of the ID assigning query generated inFIG. 12(2603). The combining processing inserting module204defines output stream data of the called template111which is included in the read query as an input of the combining query, which is described later (2604).

The combining processing inserting module204generates the definition of the in-template query through the processing described above,  and then ends the processing (2605). The query definitions in713ofFIGS. 8 and 716ofFIG. 9are generated by this processing in this embodiment.

FIG. 14is a flowchart for illustrating an example of processing that is executed in the combining query definition generating processing of Step1007inFIG. 11. The combining processing inserting module204executes the following processing for the template111called inFIG. 12(1201).

The combining processing inserting module204determines the window size of the combining query. The NOW window is set as the window size for the combining of the template111with output stream data of the template111. The window for data that is simply input stream data to which an ID has been assigned (the option column) as illustrated inFIG. 2is set to one minute, and the combining query is defined so that output stream data on which given processing has been performed is combined by using the NOW window (1202).

The combining processing inserting module204determines the output column of the combining query. The combining processing inserting module204determines, as the output column of the combining query, other columns of the output stream data of the template111than the ID column and the option column out of input stream data of the template111(1203). Columns to be combined as illustrated inFIG. 2are thus set out of the columns of the output stream data and the option column.

The combining processing inserting module204next determines a combining condition of the combining query. For example, such a combining condition is determined that an ID assigned to input stream data (option column) of the template111(strID=textID) matches an ID included in output stream data of the template111(strID=textID) as illustrated in Step703ofFIG. 2.

The combining processing inserting module204uses the determined window size, output column, and combining condition to determine a SELECT  statement, a FROM statement, and a WHERE statement, and thus generates the combining query (1205).

Through the processing described above, the definition of the combining query for combining input stream data and output stream data of the template111is generated, and the processing is ended (1206). The query definitions in714ofFIGS. 8 and 717ofFIG. 9are generated by this processing in this embodiment.

By executing the processing described above ofFIG. 12toFIG. 14for one template111, the ID assigning query, the in-template query, and the combining query are generated and are stored as one stream processing query700in the storage123of the query generating server107.

The terminal130transmits a stream processing request in which one of the stream processing queries700is specified to the stream processing executing server101. The stream processing executing server101obtains the specified stream processing query700from the query generating server107, and executes the stream processing query700with the use of the stream data processing engine103. The stream processing executing server101receives stream data from the data source140and uses the stream processing query700to execute given processing.

A single template111can thus receive a plurality of inputs, instead of preparing numerous templates, and the cost of developing a template for a query is accordingly reduced.

In addition, when text data of a new service is used, the existing  template111can be applied instead of creating a new template111. This enables a user with a low program developing ability to use stream data easily. Second Embodiment

FIG. 15is a block diagram for illustrating an example of input-output relations of a template registering module108according to a second embodiment of this invention. This embodiment describes an example of automatically executing ID assignment and window size determination by using as an input an ID-unassigned template111A to which an ID (strID) and a window size in combining have not been assigned, and partial template configuration information112A. The query generating server107starts processing of the ID-unassigned template111A and the partial template configuration information112A when a registration request is received from the terminal130. The window size here refers to the window size (“NOW” of703) of output stream data to be combined with the option column ofFIG. 2.

The template registering module108of the second embodiment receives as an input the ID-unassigned template111A and the partial template configuration information112A in which the ID and the window size are undetermined, and generates the template111and the template configuration information112, which include an ID (strID) and a window size as in the first embodiment, in a manner described later.

FIG. 16is a diagram for showing an example of the ID-unassigned  template111A. In the template111A, only “str” and “$key” are defined in SELECT statements, and an ID (strID) as the one described in the first embodiment with reference toFIG. 4Ais not defined.FIG. 17, on the other hand, is a diagram for showing an example of a template111-3to which an ID has been assigned by the automatic ID assigning module1081.

FIG. 19is a diagram for showing an example of the partial template configuration information112A. In the partial template configuration information112A, the name1121, the input schema1122, and the output schema1123are defined, but the ID1124and the window size1125are not defined.FIG. 20, on the other hand, is a diagram for showing an example of template configuration information112-3to which an ID has been assigned by the automatic ID assigning module1081.

The automatic ID assigning module1081of the template registering module108ofFIG. 15reads the ID-unassigned template111A and the partial template configuration information112A and, when assigning an ID is possible, adds the definition of a query for assigning an ID to generate the template111-3and the template configuration information112-3.

For example, “id” is not defined in the SELECT statements in the ID-unassigned template111A ofFIG. 16. The automatic ID assigning module1081of the template registering module108processes the ID-unassigned template111A to generate the template111-3in which “id” is inserted in each of the two SELECT statements as shown inFIG. 17.

When assigning an ID to the template111A is possible, the automatic ID assigning module1081of the template registering module108also assigns “id” as the ID1124in the partial template configuration information112A, in a manner described later. The window size1125is set to “NOW” by the window size calculating module1083of the template registering module108when the template111-3(111A) fulfills a given condition, thereby generating the template configuration information112-3.

FIG. 21is a flowchart for illustrating an example of processing that is executed by the template registering module108. The template registering module108starts the processing when receiving the ID-unassigned template111A and the partial template configuration information112A (1901). The template registering module108reads the received ID-unassigned template111A and partial template configuration information112A (1902).

The automatic ID assigning module1081of the template registering module108analyzes the read ID-unassigned template111A to determine whether or not an ID can be assigned as described later. When assigning an ID is possible, the automatic ID assigning module1081assigns an ID to the ID-unassigned template111A and the partial template configuration information112A (1903). When assigning an ID is not possible, the automatic ID assigning module1081notifies the terminal130of the fact that no ID can be assigned.

The window size calculating module1083of the template registering module108analyzes the read ID-unassigned template111A to determine a window size that is used when the option column and the output stream data are combined (1904). In the case where determining the window size is not possible, the window size calculating module1083notifies the terminal130of the fact that the window size cannot be determined.

The template registering module108stores in the storage123the template111-3to which an ID has been assigned and the template configuration information112-3in which an ID and a window size have been set (1905).

Through the processing described above, the ID-unassigned template111A and the partial template configuration information112A are received and, when the ID-unassigned template111A fulfills a given condition, the template111-3and the template configuration information112-3are generated and stored in the storage123(1906).

FIG. 22is a flowchart for illustrating an example of processing that is executed by the automatic ID assigning module1081. This processing is the one that is executed in Step1903ofFIG. 21(2001).

The automatic ID assigning module1081uses the parser1082of the stream data processing engine103to parse the ID-unassigned template111A, and generates an operator tree (2002).

FIG. 18is a diagram for illustrating an example of the operator tree of the ID-unassigned template111A which is denoted by1609. The operator tree1609includes processing inputs of two NOWWINDOWs1601and1604by filters1602and1605, respectively, and combining (UNION1607) projections (PROJECTIONs)1603and1606thereof. The result of the union is output as ISTREAM1608. The parser1082generates the operator tree1609by analyzing the structure of the read ID-unassigned template111A.

In Step2003ofFIG. 22, the automatic ID assigning module1081analyzes the operator tree1609to determine whether or not the operator tree1609includes only stateless relational operation operators (FILTERs, PROJECTIONs, and UNION), stream operations (ISTREAM and the like), and window operations (NOWWINDOW and the like). In other word, the automatic ID assigning module1081determines whether or not an ID assigned to data in the template is traceable. The automatic ID assigning module1081proceeds to Step2005when the ID is traceable, and to Step2004when the ID is not traceable. In Step2004, an error message to the effect that a query for assigning an ID cannot be generated is sent to the terminal130, and the processing is terminated.

In Step2005, the automatic ID assigning module1081adds an Id column to the SELECT statement of every query definition in the ID-unassigned template111A to generate the template111-3. The template111-3ofFIG. 17is generated from the ID-unassigned template111A ofFIG. 16as a result.

In Step2006, the automatic ID assigning module1081generates the template configuration information112-3by registering an Id in the field for the ID1124of the partial template configuration information112A.

FIG. 23is a flowchart for illustrating an example of processing that is executed by the window size calculating module1083. This processing is the one that is executed in Step1904ofFIG. 21(2101).

The window size calculating module1083determines whether or not a query definition in which the SELECT statement includes a column corresponding to an ID and stream operations include RSTREAM and DSTREAM is found among query definitions of the template111-3(2102). In other words, the window size calculating module1083removes RSTREAM and DSTREAM, which lead to a delay in output stream data, in order to trace the ID assigned in the template111-3accurately. The window size calculating module1083proceeds to Step2104when the operations of the template111-3cause a delay, and to Step2103when a delay is not caused.

In Step2105, the window size calculating module1083sets the combining window size1125in the template configuration information112-3to “NOW”.

In Step2104, the window size calculating module1083sends to the terminal130an error message to the effect that the window size to be used in the combining cannot be determined, and terminates the processing.

Through the processing described above, the window size in the combining is set to “NOW” when the template111-3fulfills a given condition, and the determined window size is set in the template configuration information112-3(2106).

As described above, the template111-3and the template configuration information112-3can be generated automatically from the ID-unassigned template111A and the partial template configuration information112A in which the window size is undetermined in the second embodiment and, accordingly, the work of a user or an administrator who operates the terminal130can be further reduced.

Third Embodiment

FIG. 24toFIG. 27are diagrams for showing an example of input-output relations of the query generating module109according to a third embodiment of this invention. In the third embodiment, an option column inserting module205is provided in place of the combining processing inserting module204described in the first embodiment with reference toFIG. 3. The rest of the configuration of the third embodiment is the same as that of the first embodiment.

The query generating module109receives one of the stream processing definitions500and uses the template calling information generating module202to generate the template calling information203in the same manner as in the first embodiment. The query generating module109next uses the option column inserting module205to define a query for inserting the option column in the result of the processing of the template111, and generates a stream processing query700A. In the third embodiment, an  ID(=strID) assigned to the essential column and the option column is used to determine a place where the option column is inserted.

FIG. 25is the first half of a diagram for showing an example of the stream processing query700A, which is generated by the query generating module109.FIG. 26is the second half of the diagram for showing an example of the stream processing query700A.

The stream processing query700A is similar to the stream processing query ofFIG. 8described in the first embodiment in that the name and input schema of stream data processing are defined in711ofFIG. 25. In712ofFIG. 25, a query that assigns an ID (strID) to the input data is defined as inFIG. 8described in the first embodiment.

In713A ofFIG. 25, the specifics of “string_part_match” of the template111-1are deployed in the stream processing query700A as in the first embodiment, and the option column inserting module205inserts the columns “msgID”, “time”, and “userID”, which constitute the option column whose ID matches the assigned ID (strID). Once the option column that has a matching strID is inserted to the processing result of the template111-1, the strID itself is no longer needed, and the query generating module109defines a query for removing the strID (720).

The template111-2ofFIG. 26which is a template “string_match” is processed in a similar manner, and an ID is assigned to the input schema in715ofFIG. 26. In716A ofFIG. 26, the specifics of “string—match” of the template111-2are deployed in the stream processing query700A as in the first embodiment, and the option column inserting module205inserts the columns “msgID”, “time”, “text”, and “keyword”, which constitute the option column whose ID matches the assigned ID (strID). Once the option column that has a matching ID is inserted, the ID itself is no longer needed, and the query generating module109defines a query for removing the strID (721).

FIG. 27is a flowchart for illustrating an example of processing that is  executed by the option column inserting module205of the query generating module109. This processing is executed after the processing of the template calling information generating module202ofFIG. 3(FIG. 24) is completed.

The option column inserting module205first reads the stream processing definition500, the template configuration information112, and the template calling information203(2501and2502). The option column inserting module205determines whether or not the option column has been added to every template111written in the stream processing definition500(2503). The option column inserting module205ends the processing ofFIG. 27in the case where the addition has been completed for every written template111(2508). In the case where the addition has not been completed for some of the written templates111, on the other hand, the option column inserting module205repeatedly executes Steps2504to2507until every written template111has been processed.

The option column inserting module205extracts the template111to which the option column has not been added (2504). The option column inserting module205executes the ID assigning query definition generating processing (ID assigning query definition generating module) described in the first embodiment with reference toFIG. 12for the extracted template111(2505).

The option column inserting module205next executes the in-template query definition generating processing described in the first embodiment with reference toFIG. 13and, in the case where the SELECT statement includes a column corresponding to an ID in a query definition that is included in the template111, generates a query for adding the option column to this SELECT statement (2506).

The option column inserting module205next generates the definition of a query that has output stream data of the template111as an input and that removes, from the input stream data, an ID that is uniquely associated  with the input stream data (an ID removing query). The column name of the ID is the ID in the template configuration information112.

Through the processing described above, output stream data can be obtained in which the option column has been added to the essential column processed by the template111.

Fourth Embodiment

FIG. 28AandFIG. 28BtoFIG. 33are diagrams of a fourth embodiment of this invention. While the window size in the combining is “NOW” in the first embodiment to the third embodiment, the window size1125in the fourth embodiment is set to two minutes for “string_part_match” in a template111-4, and to five minutes for “string_match” in a template111-5. The rest of the configuration of the fourth embodiment is the same as that of the first embodiment.

In the fourth embodiment, the query generating module109can generate the definition of a query for keeping the option column for the duration of a given time window by taking into account a delay due to the processing of the template111, and for sequentially combining output stream data that has undergone the processing of the template111with the option column.

FIG. 28Ais a diagram for showing an example of the template111-4, which is a template “string_part_match—2m_delay”. InFIG. 28A, a difference from the template “string_part_match” described in the first embodiment with reference toFIG. 4Ais indicated by bold-face letters. The template111-4, which is a template “string_part_match—2m_delay”, differs fromFIG. 4Aof the first embodiment in that a window size of two minutes is set for DSTREAM.

FIG. 28Bis a diagram for showing an example of the template111-5, which is a template “string_match—5m_delay”. InFIG. 28B, a difference from the template “string_match” described in the first embodiment with reference toFIG. 4Bis indicated by bold-face letters. The template111-5, which is a  template “string_match—5m_delay”, differs fromFIG. 4Bof the first embodiment in that a window size of five minutes is set for DSTREAM.

FIG. 29Ais a diagram for showing an example of template configuration information112-4of the template111-4, which is a template “string_part_match—2m_delay”. The template configuration information112-4differs from the configuration information of the template “string_part_match” which has been described in the first embodiment with reference toFIG. 5Ain that the name1121is “string_part_match—2m_delay”, and in that the combining window size1125is “two minutes”.

FIG. 29Bis a diagram for showing an example of template configuration information112-5of the template111-5, which is a template “string_match—5m_delay”. The template configuration information112-5differs from the configuration information of the template “string_match” which has been described in the first embodiment with reference toFIG. 5Bin that the name1121is “string_match—5m_delay”, and in that the combining window size1125is “five minutes”.

FIG. 30is a diagram for showing an example of the stream processing definitions500A. The stream processing definition500A differs from the stream processing definition500described in the first embodiment with reference toFIG. 6in that the name of the template111in502A ofFIG. 30and the name of the template111in503A ofFIG. 30are “string_part_match—2m_delay” and “string_match—5m_delay”, respectively. The rest ofFIG. 30is the same asFIG. 6.

FIG. 31is a diagram for showing an example of the template calling information203generated by the query generating module109. The template calling information203ofFIG. 31differs from the template calling information203described in the first embodiment with reference toFIG. 7in that names stored as the template2032are changed in the manner described with reference toFIG. 30. The rest of the template calling information203of  this embodiment is the same as in the first embodiment.

In this embodiment, the query generating module109executes the functions and processing described in the first embodiment with reference toFIG. 3andFIG. 10toFIG. 14to generate a stream processing query700B, which is shown inFIG. 32andFIG. 33.

FIG. 32andFIG. 33are the first half and second half of a diagram for showing an example of the stream processing query700B, which is generated based on the stream processing definition500A, the templates111, and the template configuration information112.

InFIG. 32andFIG. 33, differences of the stream processing query700B from the stream processing query700described in the first embodiment with reference toFIG. 8andFIG. 9are expressed in bold-face letters. Firstly, stream data processing and the window size are changed to DSTREAM and two minutes, respectively, in a query definition713B ofFIG. 32, and the window size is changed to two minutes in a combining query definition714B ofFIG. 32.

Similarly, stream data processing and the window size are changed to DSTREAM and five minutes, respectively, in a query definition716B ofFIG. 33, and the window size is changed to five minutes in a combining query definition717B ofFIG. 33.

The stream processing query700B described above combines the output stream and option column of the processing of the template111-4, which is a template “string_part_match—2m_delay”, in a two-minute window, combines the output stream and option column of the processing of the template111-5, which is a template “string_match—5m_delay”, in a five-minute window, and outputs the resultant output streams.

Through the processing described above, a time required for processing in each template111is taken into account so that a delay in output stream can be tolerated.

The computers, processing units, and processing means described related to this invention may be, for a part or all of them, implemented by dedicated hardware.

The variety of software exemplified in the embodiments can be stored in various media (for example, non-transitory storage media), such as electro-magnetic media, electronic media, and optical media and can be downloaded to a computer through communication network such as the Internet.

This invention is not limited to the foregoing embodiments but includes various modifications. For example, the foregoing embodiments have been provided to explain this invention to be easily understood; they are not limited to the configurations including all the described elements.