This invention relates to a technique for retrieving in a form that data distributedly held in plural databases is integrated.
In a conventional art, when associated data is distributedly held extending in plural existing databases, which are placed in different environments, a method has been adopted in which a new data warehousing is constructed in order to refer to them as one set of integrated data, and all of the data are migrated to the data warehousing. However, because data should be copied from the original databases to the data warehousing in this method, time lag occurs. Therefore, it is impossible to refer to the data in the original database in real time. In addition, because the cost and time are required for the construction of the data warehousing, it is not easy to re-form the data warehousing. Therefore, the data warehousing has a problem that it is impossible to rapidly deal with a case where a request for the database integration is changed because the business changes in a short cycle.
On the other hand, as another method, there is a method in which the data is stored in the original databases, and when a request for the integrated data is received from a user, necessary data is acquired by outputting a query to each database in real time, and then the acquired data is composed to return it to the user (hereinafter, this method is called as a query-type database integration). In this method, a response time is not short because data is acquired through the network, but the practicability of this method increases because of the recent improvement of the network speed. In this method, the data extending in the plural databases can be used except for the performance problem as if the data is stored in one database. This method can resolve the real-time problem of the data in the data warehousing, and there is no need to change the databases themselves. Therefore, it becomes possible to immediately deal with the change of the request for the database integration because of the business change.
For example, as shown in
Although there are various methods of referring to the associated data registered extending in the plural databases by the query-type database integration technique, one of the methods is disclosed in U.S. 2005/0160076-A1, for example. In this publication, a technique is disclosed in which a data view in a tagged document format, which is integrated extending in plural databases, is provided, and a query freely using a query language is enabled. In this publication, as a generation rule when integrating the plural databases, “DB integration metadata” is prepared.
In the DB integration metadata, three kinds of contents including “definition of the view structure in the tagged document format” (See
Conventionally, when an application using the data distributed in the plural databases is created, a lot of time is required to describe codes for obtaining data from each database. However, according to the technique described in this publication, the time to create the entire application is shortened because the data acquisition from each database becomes very simple and can be carried out quickly.
However, in the technique disclosed in the publication, because “the association between the database items” needs the complete identity of the values, it is impossible to associate the items and provide the data view in the tagged document format when value ranges or formats of the items to be associated are not identical. For example, as shown in
In addition, in the technique disclosed in the aforementioned publication, the data structure can be virtualized, but the value range of the data cannot be virtualized. That is, the value itself of the data in the database is shown as the value of the data on the virtual view. With this, it is impossible to provide a view matching with a value range or format of the data, which is assumed by the application developer, and it is necessary to change the value range or format to that of the view, at the application side. Therefore, the development of the application becomes complicated.
Therefore, an object of this invention is to provide a technique enabling to set association between data items in a different value range or different format when carrying out the query-type database integration.
In addition, another object of this invention is to provide a technique enabling the virtualization of the value range of the data in the database when carrying out the query-type database integration.
Furthermore, still another object of this invention is to provide a technique enabling to flexibly carry out the association between the data items in the database or data reference when carrying out the query-type database integration.
In a search method according to the first aspect of this invention, integration metadata is newly introduced in which structure data defining an output structure of a query result (e.g. in an embodiment, virtual XML schema information), a correspondence relation between elements in the structure data and elements in databases, an association of elements between the databases and a bi-directional conversion function applied to the association of the elements between the databases or a specific element of the databases are defined. By such a bi-directional conversion function, it becomes possible to associate the data items in different value ranges or different formats. Furthermore, it is possible to virtualize the value range in the database.
Incidentally, the bi-directional conversion function is a function having symmetricalness of the conversion. That is, when a value firstly converted in a certain direction by using the bi-directional conversion function is next converted in the reverse direction of the bi-directional conversion function, the original value is obtained.
Then, the search method according to the first aspect of this invention includes: accepting a query of integrated data reference for a plurality of databases; extracting a value of an element in database, which corresponds to the top-level element in a structure identified from integration metadata in a integration metadata storage by upwardly tracing the structure based on the query; extracting a value of each element in each database by downwardly tracing the structure based on a value of an element in the database, which corresponding to the top-level element in the structure; and outputting the extracted value of each element in each database according to data stored in the integration metadata storage.
In addition, the aforementioned first extracting includes: outputting individual queries based on at least one of a condition of the query and a processing result immediately before to the pertinent databases on a upward trace route, and obtaining search processing results of the individual queries; and upwardly applying a pertinent bi-directional conversion function on the upward trace route to at least one of the condition of the query and the processing result immediately before, and obtaining a conversion processing result. In addition, the aforementioned second extracting includes: outputting individual queries based on upper-level processing results to pertinent databases on a downward trace route, and obtaining the search processing result; and applying a pertinent bi-directional conversion function on the downward trace route to upper-level processing results, and obtaining a conversion processing result.
Thus, by appropriately carrying out the individual queries for the databases and the application of the bi-directional conversion function in appropriate directions in the upward trace processing and downward trace processing of the structure identified from the integration metadata, the user can obtain the query result without considering the plural databases.
In addition, in the aforementioned integration metadata, the bi-directional conversion function may be defined as an element in the same rank as that of the element of the database. Then, the association of the elements between the databases may include an association between an element of a first database and a downward element of the bi-directional conversion function, and an association between an element of a second database and an upward element of the bi-directional conversion function. Similarly to the elements of the databases, the bi-directional conversion function corresponds to a node in the structure (e.g. tree structure) identified from the integration metadata, and associates the elements of the databases in the both directions.
Furthermore, in the aforementioned integration metadata, the bi-directional conversion function may be defined as an element in the same rank as that of the elements of the database. Then, in a case of the bi-directional conversion function, which converts a value of a specific element in the database, the association of the elements between the databases may include an association between the specific element of the database and the element of the bi-directional conversion function. Virtualization of the value range of the data in the database can be realized by adopting such a configuration.
In addition, in the aforementioned integration metadata, an element in the structure data, which corresponds to the bi-directional conversion function, may include an attribute concerning whether or not utilization in the query of the data reference is granted. It becomes possible to define necessary structure in the structure data without destroying the virtual view for the user.
Furthermore, in the aforementioned integration metadata, the bi-directional conversion function may be defined as an element in the same rank as that of the element of the database. Then, the association of the elements between databases may include an association between m elements of a first database and m downward elements of the bi-directional conversion function and an association between n elements of a second database and n upward elements of the bi-directional conversion function. Thus, it is possible to flexibly determine a conversion method of the bi-directional conversion function.
In addition, in the aforementioned integration metadata, the bi-directional conversion function may be defined as an element in the same rank as that of the elements of the database. Then, in a case of the bi-directional conversion function, which is applied to a specific element of the database, the association of the elements between the databases may include an association between m specific elements of the database and m elements of the bi-directional conversion function. When virtualizing the value range of the data in the database, the flexible virtualization becomes possible.
In addition, when a function limiting a value of the element of the associated database is defined as the aforementioned bi-directional conversion function, the individual query to the associated database may include a condition concerning the value limited by the bi-directional conversion function. For example, when the bi-directional conversion function is defined in which the conversion at the upward trace processing is not carried out unless the specific data item in the lower-level database has a specific value, the upward trace cannot be carried out through the element corresponding to the bi-directional conversion function unless the specific data item has the specific value. That is, the data is limited. The useless trace is carried out when the characteristic of the bi-directional conversion function is not considered. Therefore, by changing the individual query to be the aforementioned individual query, it is possible to reduce the data volume replied from the database, the load of the data transfer, and the processing load of the replied data.
Although the first aspect of this invention effectively functions in a case where the bi-directional conversion function can be defined, the bi-directional conversion function cannot be always defined. For example, in a case where data stored in two databases is associated each other by using an item code, when a first item code is represented by a mixed format including both of capital letters and small letters (e.g. “SymfoWARE”), and a second item code is represented by a format including only capital letters (e.g. “SYMFOWARE”), a conversion from the former to the latter can be uniquely defined. However, the reverse conversion cannot be defined, and the association between them cannot be made. However, there is a case where such association is effective. Therefore, in a second aspect of this invention, both of the bi-directional conversion function and a one-directional conversion function are made to be handled.
However, when the one-directional conversion function exists, the upward trace and the downward trace for the structure identified from the integration metadata cannot be simply carried out. Therefore, it is necessary to carry out a following processing. Incidentally, the integration metadata defines structure data defining an output structure of a query result, a correspondence relation between elements in the structure data and elements in the databases, an association of the elements between the databases, and a bi-directional conversion function or one-directional conversion function applied to the association of the elements between the databases or a specific element of the databases.
The second aspect of this invention includes: accepting a query of integrated data reference for a plurality of databases; identifying an upward trace condition that is a condition obtained by excluding a downward trace condition that is a condition relating to a first element corresponding to a one-directional conversion function in the structure identified from the integration metadata stored in the integration metadata storage device storing the integration metadata and second elements lower than the first element from conditions of the query or that is a condition to extract all values for an immediately upper element of the first element corresponding to the one-directional conversion function in the structure in a case where the conditions of the query are only the downward trace conditions; extracting a value of an element in the database, which corresponds to a top-level element in the structure identified from the integration metadata by upwardly tracing the structure identified from the integration metadata based on the upward trace condition; extracting a value of each element in each database by downwardly tracing the structure based on the value of the element in the database, which corresponds to the top-level element in the structure, and the downward trace condition; and outputting the extracted value of each element in each database according to the integration metadata stored in the integration metadata storage device.
Then, the extracting by upwardly tracing includes: outputting an individual query based on at least one of the upward trace condition and a processing result immediately before to a pertinent database on an upward trace route to obtain a search processing result; and upwardly applying the pertinent bi-directional conversion function on the upward trace route to the upward trace condition or the processing result immediately before to obtain a conversion processing result. Furthermore, the extracting by downwardly tracing includes: outputting an individual query based on at least one of an upper processing result and the downward trace condition to a pertinent database on an downward trace route to obtain a search processing result; and downwardly applying the pertinent bi-directional conversion function or the pertinent one-directional conversion function on the downward trace route to obtain a conversion processing result.
Because the upward trace cannot be carried out from an element lower than the one-directional conversion function when the one-directional conversion function is defined in the structure, the upward trace condition and the downward trace condition are separately applied.
Incidentally, the definition method of the one-directional conversion function in the integration metadata is almost the same as that of the bi-directional conversion function.
Incidentally, it is possible to create a program for causing a computer to execute these methods according to the present invention. The program is stored into a storage medium or a storage device such as, for example, a flexible disk, a CD-ROM, a magneto-optical disk, a semiconductor memory, or a hard disk. In addition, the program may be distributed as digital signals over a network in some cases. Data under processing is temporarily stored in the storage device such as a computer memory.
The database integration query system 13 includes an XQuery output processor 131, a grid tool 132, and a DB integration metadata storage 133. The XQuery output processor 131 includes a query parser 1311, a query processing engine 1312, and a database access processor 1313.
The DB integration metadata stored in the DB integration metadata storage 133 is a rule for the view generation. Prior to the query execution, this is created in advance, and stored in the DB integration metadata storage 133. Plural types of the DB integration metadata may be prepared according to the integration method of the database and the view structure to be shown. In addition, the extensible Markup Language (XML) is adopted for the description of the DB integration metadata in this embodiment. However, other languages such as SGML may be adopted.
The query parser 1311 of the XQuery output processor 131 accepts a query by the XQuery that is a query language being standardized in W3C, for example, and carries out a syntax analysis, and converts the query into an internal format (e.g. syntax tree) when there is no problem in the syntax check. Although the XQuery is used here, XPath (see http://www.w3.org/TR/xpath) may be adopted. In order to access to the integrated virtual data view, the user outputs, from the user terminal 11, a query for the virtual XML data, which uses the XQuery, to the database integration query system 13.
The query processing engine 1312 actually processes the query by the XQuery, for which the query parser 1311 carried out the syntax analysis, judges what query should be output to each database in what order to obtain data corresponding to the query, and outputs individual queries (also called as a sub query) to respective databases. In addition, in order to finally reply data obtained from each database in response to the query to the user terminal 11, the query processing engine 1312 also carries out an assembling processing to the XML data.
When receiving a query request from the query processing engine 1312, the database access processor 1313 carries out accesses to the databases through the grid tool 132. A conventional technique can be used for the queries for the plural and different types of databases as it is, and for instance, Globus Toolkit 4+OGSA-DAI WSRF 2.1, which is a grid middleware of the open source, can be used. As a result, the database access processor 1313 outputs the queries according to SQL, for the RDB, and the queries according to, for example, XPath, for the XML-DB.
In addition, the integration metadata created when the treated item table of the item DB in
This DB integration metadata includes three data portions.
This is information concerning how to show the associated data extending in the plural databases, for the user, as XML data having a certain structure.
(2) Correspondence Relation with Database Item (
This is information concerning what item in what database corresponds to each node in XML.
When XML data or tupples in different databases are associated and treated as one element, this is information concerning what items in respective databases are associated.
In the following, the details are respectively explained.
In the virtual XML schema information, the XML structure of the integrated data view is defined by using a format similar to the XML Schema. The nodes constructing the schema are categorized into three types.
This is an intermediate node having other nodes under it. In the example of
When the corresponding database is the RDB, a combination of this node and SimpleElements under this node corresponds to one tupple in the database. When the corresponding database is the XML-DB, this node is an intermediate node having other nodes under this node, and means it does not have any value. Under this node, any type of the three types of nodes may appear. In addition, this node has attributes.
a tag name of this node on the virtual data view
whether or not this node is displayed on the virtual data view
When the value is “true”, this node is displayed, and when the value is “false”, this node is not displayed. When this node is not displayed, this node cannot be included in the query.
the upper limit of the number of times this node repeatedly appears
the lower limit of the number of times this node repeatedly appears
A terminal node having a value under this node; In the example of
When the corresponding database is the RDB, this node corresponds to one column in the tupple, and holds only its value. When the corresponding database is the XML-DB, this node corresponds to a terminal node having a value. Because this node is the terminal node, other nodes cannot appear under this node. In addition, this node holds following attributes.
a tag name of this node on the virtual data view
whether or not this node is displayed on the virtual data view
This attribute is the same as that of the Complex Element. For example, when “false” is set to the visible attribute of the ComplexElement whose name is “filter”, the SimpleElement whose label is “upper0” and the SimpleElement whose label is “lower0”, nodes deleted by the double line in
When the pertinent database is the XML-DB, this attribute designates whether or not the appearance of the free schema under this node is allowed by treating, as the simple character string, all of the tags appeared under this node.
This node is a dummy node to insert a tag. In
Name (Name): A Tag Name of this Node on the Virtual Data View.
In addition, a unique ID is given to the ComplexElement and TagElement in order to make a correspondence relation with a database item corresponding to either of those nodes. Those IDs are called as ComplexElement-ID and SimpleElement-ID, respectively.
When the corresponding database is the RDB, a set of one ComplexElement and one or more SimpleElements corresponds to one tupple of the RDB, and a tree structure is assembled by mutually coupling the sets together. At a time of the coupling, items for which the association (i.e. matching of values) can be made between both nodes are required. Irrelevantly to those, it is possible to insert the TagElement at a position where a dummy tag should be added.
When the corresponding database is the XML-DB, it is necessary to construct the virtual XML schema so as to conform with the schema of the XML data stored in the XML-DB. When a tag, which does not exist in the schema of the original XML data, should be added, the TagElement has to be used. When a tag, which exists in the schema of the original XML data, should be deleted, it is possible to treat such a case by setting “False” to the attribute “Visible” of the tag.
(2) Correspondence Relation with Database Item (
As for the correspondence relation with the database item, information concerning what item in what database actually corresponds is described in each element (ComplexElement, SimpleElement) in the virtual XML schema. Content to be described is much different, depending on RDB or XML-DB, which is the corresponding database.
When the corresponding database is the RDB, it is described that each ComplexElement corresponds to which table in which RDB, and each SimpleElement under the ComplexElement corresponds to which column in the table. Examples of
In addition, when the corresponding database is the XML-DB, it is described that a sub tree composed of which ComplexElement corresponds to what data in the XML-DB. Furthermore, when the tag name on the view is different from the tag name on the XML-DB, such correspondence is described (as for the ComplexElement and SimpleElement, which are not described, it is supposed that the tag name on the view is the same as the tag name on the XML-DB.).
In this embodiment, the bi-directional filter (i.e. bi-directional conversion function) and the database are equally handled, and the correspondence relation between the element in the virtual XML schema and the bi-directional filter is also described. Similarly to the case of the RDB, it is described that one ComplexElement corresponds to a bi-directional filter, and the following information is also described.
In the association information between the elements, coupling information between “sets of ComplexElement and SimpleElement”, which correspond to the RDB and coupling information between the set and the XML sub tree corresponding to the XML-DB are described. Specifically, it is described that a value matching between which SimpleElement and which SimpleElement should be carried out. Basically, “the complete identity of the values” between one item and one item is handled, but “the complete identity of the values” among the plural items may be handled.
In the example of
Like the examples of
In addition, specific examples of the bi-directional filter are as follows: However, the bi-directional filter is not limited to those examples. The bi-directional filter can be any filter function having the symmetricalness of the conversion.
The conversion of the data value by one to one or plurality to plurality is carried out. Following examples can be adopted.
When the bi-directional filter having the input/output of m to n is used, it is possible to carry out the data coupling or decomposing. Specifically, following examples can be adopted.
When the bi-directional filter, which has the input/outputs of m to n and to which a constant is set to one or more input/outputs at the one side, is used, the data flowing through this filter is limited (or selected). When the filter of such a type is used, it becomes possible to take only specific data of the data stored in the database in to the virtual data view. As for the filter of this type, the details will be explained later.
Incidentally, the definition data for the conversion processing of the bi-directional filter is stored in the DB integration metadata storage 133.
Next, a processing flow of the system shown in
Incidentally, when the syntax of the query by the XQuery is incorrect (step S5: No route), the XQuery output processor 131 outputs an error message to the user terminal 11 (step S7). Then, the processing returns to the step S1. On the other hand, when the syntax of the query by the XQuery is correct (step S5: Yes route), the query parser 1311 outputs data of the syntax tree to the query processing engine 1312. Then, the query processing engine 1312 reads pertinent portion of the DB integration metadata from the DB integration metadata storage 133, and identifies XML structure and databases in which data corresponding to each node are stored (step S9).
For example, the query by the XQuery to extract orders in which name=FMV-6000CL and the quantity is two or more is described as shown in the upper right of
Next, the query processing engine 1312 categorizes conditional expressions, which are AND-coupled, into some conditional groups, which can respectively be output simultaneously (step S11). For example, the conditional expressions for data items included in the same table and/or database are grouped. Two conditional expressions in the example on the upper right of
After that, the query processing engine 1312 identifies a conditional expression group that has the highest possibility to narrow the data most (step S13). The character string precedes the numeric value, and the long character string precedes the short character string. As shown in
Then, the query processing engine 1312 judges whether or not an element, which corresponds to the conditional expression group identified at the step S13, in the data structure identified from the DB integration metadata is the bi-directional filter (step S15). For example, as shown in
On the other hand, when the element corresponding to the conditional expression group identified at the step S13 is not the bi-directional filter, the query processing engine 1312 generates a query sentence to inquire of the first database by using respective conditions of the identified conditional expression group, and outputs the query sentence to the database access processor 1313 (step S17). For example, an SQL query for the item DB as shown in the upper right (A) of
Then, the database access processor 1313 outputs the query sentence to a host managing the first database (e.g. the treated item table in the item DB) through the grid tool 132, and obtains a query result (step S19). As shown in the upper right (B) of
Shifting to the explanation of the processing of
As shown in
On the other hand, when the element positioned in one upper level in the XML tree structure is not the filter, the query processing engine 1312 generates a query sentence for the upper-level database by using the query result immediately before or the application result of the filter and an unused conditional expression group if it exists, and outputs the query sentence to the database access processor 1313 (step S29). As shown in
Then, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. order DB) through the grid tool 132, and obtains a query result (step S31). As shown in the upper right (B) of
After that, the query processing engine 1312 judges whether or not the trace reaches the top-level element in the XML tree structure (step S33). When the trace does not reach the top-level element in the XML tree structure, the processing shifts to the step S25. By carrying out such a repeat processing, values of the top-level element on the XML tree structure are obtained. The values of the top-level element are stored in a storage device. In an example of
When it is judged at the step S33 that the trace reaches the top-level element, the query processing engine 1312 judges whether or not the element positioned in one lower level in the XML tree structure is a filter (step S35). When the element positioned in one lower level in the XML tree structure is not the filter, the query processing engine 1312 generates a query sentence for the lower-level database by using the upper-level query result or the application result of the filter, and outputs the query sentence to the database access processor 1313 (step S39). As shown in
Then, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. the item table of the order DB) through the grid tool 132, and obtains the query result (step S41). As shown in the upper right (B) of
When the element positioned in one lower level in the XML tree structure is the filter, the query processing engine 1312 carries out the downward conversion of the bi-directional filter for the upper-level query result or the application result of the filter (step S37). As shown in
In the example of
Then, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. the treated item table of the item DB) through the grid tool 132, and obtains the query result. As shown in the upper right (B) of
Then, the query processing engine 1312 judges whether or not the trace reaches the bottom-level element, again. Because the “item_code” column in the item table of the order DB is also associated with the columns in the stock DB1 and the stock DB2, it is judged that the trace does not reach the bottom-level element. Then, the processing returns to the step S35, and shifts to the step S39.
Then, the query processing engine 1312 generates the query sentence for the lower-level database by using the upper-level query result, and outputs the query sentence to the database access processor 1313. As shown in
After that, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. the stock table 1 of the stock DB 1) through the grid tool 132, and obtains the query result. As shown in the upper right (B) of
Then, the query processing engine 1312 judges again whether or not the trace reaches the bottom-level element. Because the stock table 2 of the stock DB 2 is unprocessed, it is judged that the trace does not reach the bottom-level element. Then, the processing returns to the step S35, and shifts to the step S39.
Then, the query processing engine 1312 generates a query sentence for the lower-level database by using the upper-level query result, and outputs the query sentence to the database access processor 1313. As shown in
After that, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. the stock table 2 of the stock DB 2) through the grid tool 132, and obtains the query result. As shown in the upper right (B) of
Then, the query processing engine 1312 judges again whether or not the trace reaches the bottom-level element. Here, it is judged that the trace reaches the bottom-level element, and the processing shifts to the processing in
The query processing engine 1312 constructs XML data of the query result from the obtained values according to the DB integration metadata (step S45). For example, the XML data as schematically shown in
After that, the query processing engine 1312 carries out a check processing of the query results (step S47). Because the possibility that a portion of the query conditions designated in the query by the XQuery has not been reflected yet remains, any solution that does not satisfy the query conditions is excluded from the XML data of the final results by the check processing. Finally, the query processing engine 1312 outputs the query result to the user terminal 11 (step S49).
By carrying out such a processing, it becomes possible to refer to the associated data extending in the plural databases all together.
Next, the bi-directional filter for the data limitation or selection will be explained.
Then, when outputting a query to the treated item table of the item DB, it is checked in advance whether or not the destination of the association is the bi-directional filter, and when the bi-directional filter carries out the data limitation or selection, the condition of the limitation or selection is added to the query to the treated item table of the item DB. As shown in the upper right (B) of
In a case where the bi-directional filter to carry out such data limitation or selection is used, a processing shown in
Incidentally, when the syntax of the query by the XQuery is not correct (step S55: No route), the query parser 1311 outputs an error message to the user terminal 11 (step S57). Then, the processing returns to the step S51. On the other hand, when the syntax of the query by the XQuery is correct (step S55: Yes route), the query parser 1311 outputs the data of the syntax tree to the query processing engine 1312. Then, the query processing engine 1312 reads the pertinent DB integration metadata from the DB integration metadata storage 133, and identifies XML structure and databases in which data corresponding to each node is stored (step S59).
Next, the query processing engine 1312 categorizes conditional expressions, which are AND-coupled, into conditional expression groups, which can respectively be output simultaneously (step S61). For example, the conditional expressions for data items included in the same table and/or database are grouped.
After that, the query processing engine 1312 identifies a conditional expression group that has the highest possibility to narrow the data most (step S63).
Then, the query processing engine 1312 judges whether or not an element corresponding to the conditional expression group identified at the step S63 is a bi-directional filter (step S65). For example, as shown in
On the other hand, when the element corresponding to the conditional expression group identified at the step S63 is not the bi-directional filter, the query processing engine 1312 carries out a first search processing (step S69). Then, the processing shift to the processing in
The first search processing will be explained by using
Then, the database access processor 1313 outputs the query sentence to a host managing the first database through the grid tool 132, and obtains a query result (step S77). The database access processor 1313 outputs the query result to the query processing engine 1312. Then, the processing returns to the original processing.
On the other hand, when the conditions at the step S71 are satisfied, the query processing engine 1312 generates a query sentence for the query to the first database by using respective conditions in the conditional expression group identified at the step S63 and a limitation condition (in the example of
Shifting to the explanation of the processing of
On the other hand, when the element positioned in one upper level in the XML tree structure is not the filter, the query processing engine 1312 carries out a second search processing (step S85). After that, the processing shifts to step S89.
The second search processing will be explained by using
Then, the database access processor 1313 outputs the query sentence to a host managing the upper-level database through the grid tool 132, and obtains the query result (step S107). The database access processor 1313 outputs the query result to the query processing engine 1312. Then, the processing returns to the original processing.
On the other hand, when the conditions at the step S101 are satisfied, the query processing engine 1312 generates a query sentence for the query to the upper-level database by using the query result immediately before or the application result of the filter, the pertinent conditional expression group and the limitation condition of the function of the filter positioned in one upper level, and outputs the query sentence to the database access processor 1313 (step S105). Then, the processing shifts to step S107.
Thus, by carrying out such a repeat processing, the value of the top-level element in the XML tree structure is obtained. Incidentally, the value of the top-level element is stored in the storage device.
Returning to the explanation of the processing of
Then, the database access processor 1313 outputs the query sentence to a host managing the database through the grid tool 132, and obtains the query result (step S95). The database access processor 1313 outputs the obtained query result to the query processing engine 1312. Then, the query processing engine 1312 judges whether or not the trace reaches the bottom-level element (step S99). When the trace does not reach the bottom-level element, the processing returns to the step S91. On the other hand, when the trace reaches the bottom-level element, the processing shifts to the processing of
When the element positioned in one lower level in the XML tree structure is the filter, the query processing engine 1312 carries out the downward conversion of the bi-directional filter for the upper-level query result or the application result of the filter (step S97). Then, the processing shifts to step S99.
Thus, in a case of the upward trace, the query sentence is generated taking into consideration the bi-directional filter, which limits or selects the data value. On the other hand, in a case of the downward trace, there is no need to take into consideration such a type of the bi-directional filter on tracing the XML tree structure.
By carrying out the aforementioned processing, it becomes possible to appropriately deal with even a case where the bi-directional filter limits or selects the data value.
Although the first embodiment of this invention was explained, this invention is not limited to this embodiment. For example, in the examples shown in
Furthermore, as described above, this invention can be applied to an environment in which XML-DB (e.g. order slip XML of the order DB) as shown in
In addition, the functional block diagram shown in
A one-directional filter, not the bi-directional filter introduced in the first embodiment of this invention, can be introduced.
Even when the one-directional filter is introduced, the DB integration metadata is described similarly to the DB integration metadata in case of introducing the bi-directional filter. Therefore, the schematic drawing of the DB integration metadata is represented similarly to
Incidentally, whether the filter is the one-directional filter or the bi-directional filter is identified based on the substance of the filter, not the DB integration metadata. That is, for example, at the activation, the system reads the definition of the filter, and distinguishes the type by identifying which class of the bi-directional filter and the one-directional filter the filter inherits.
For example, the one-directional filter is a conversion function as shown in the following:
The conversion indicated in (a) to (g) is a one-to-one conversion. However, it is possible to define an m-to-n conversion such as obtaining n outputs from m elements in the database.
As shown in
Next, by using
In addition, the system configuration in the first embodiment shown in
First, the query parser 1311 of the XQuery output processor 131 waits for an input of a query by the XQuery from the user terminal 11 (
Incidentally, when the syntax of the query by the XQuery is incorrect (step S205: No route), the XQuery output processor 131 outputs an error message to the user terminal 11 (step S207). Then, the processing returns to the step S201. On the other hand, when the syntax of the query by the XQuery is correct (step S205: Yes route), the query parser 1311 outputs data of the syntax tree to the query processing engine 1312. Then, the query processing engine 1312 reads pertinent portion of the DB integration metadata from the DB integration metadata storage 133, and identifies XML structure and databases in which data corresponding to each node are stored (step S209). As described above, at the activation or the like, the filter definition is read to identify which class of the bi-directional filter and the one-directional filter the pertinent filter inherits.
For example, the query by the XQuery to extract orders in which name=FMV-6000CL and the quantity is two or more is described as shown in the upper right of
Next, the query processing engine 1312 categorizes conditional expressions, which are AND-coupled, into some conditional groups, which can respectively be output simultaneously (step S211). For example, the conditional expressions for data items included in the same table and/or database are grouped. Two conditional expressions in the example on the upper right of
After that, the query processing engine 1312 carries out an upward conditional expression group generation processing (step S213) This upward conditional expression group generation processing is provided to handle a case where the one-directional filter is defined in the XML tree structure and a conditional expression of the query is defined for a portion under this one-directional filter. This is because an upward trace of the tree structure cannot be simply carried out, when the one-directional filter exists. The upward conditional expression group generation processing will be explained by using
First, the query processing engine 1312 confirms, for each conditional expression, whether or not the one-directional filter is defined for a specific element on the tree structure of the DB integration metadata, which corresponds to that conditional expression, or an upper-level element of the specific element (step S301). The query processing engine 1312 confirms, for each conditional expression, whether or not the aforementioned condition is satisfied, and adds a flag representing whether or not the condition is satisfied to data of the syntax tree of the query, for example.
Then, the query processing engine 1312 judges whether or not at least one conditional expression relating to the one-directional filter (i.e. which satisfies the aforementioned condition) exists (step S303). When there is no conditional expression relating to the one-directional filter (i.e. a case where there is no filter, a case where only the bi-directional filter is defined in the DB integration metadata, and a case where no conditional expression is not inputted for the one-directional filter and the lower element of the one-directional filter), the query processing engine 1312 sets the conditional expression group identified at the step S211 as an upward conditional expression group (step S305).
On the other hand, when the conditional expression relating to the one-directional filter exists, the query processing engine 1312 excludes the conditional expression relating to the one-directional filter from the conditional expression group identified at the step S211 to generate an interim conditional expression group (step S307). The conditional expression “code=FMV-6000CL” among two conditional expressions in the upper-right example of
Then, the query processing engine 1312 judges whether or not one or more interim conditional expression groups can be generated (step S309). Although it is described later in detail, in a case where the query includes only the conditional expression “code=FMV-6000CL”, when the conditional expression “code=FMV-6000CL” is excluded at the step S307, the interim conditional expression group becomes empty. At this step, the query processing engine 1312 confirms whether or not such a state occurred.
When one or more interim conditional expression groups are generated, the query processing engine 1312 sets the interim conditional expression groups as the upward conditional expression groups (step S311). On the other hand, when no interim conditional expression group is generated, the query processing engine 1312 generates a conditional expression to extract all values of an immediately upper-level element of the one-directional filter defined for an element corresponding to the conditional expression or for an upper-level element of such an element (step S313). When the query including only the conditional expression “code=FMV-6000CL” in the XML tree structure as shown in
Then, the query processing engine 1312 generates the upward conditional expression group by gathering the generated conditional expressions, if possible (step S315). For example, when the plural one-directional filters relating to the condition expressions exist in the DB integration metadata and the immediately upper-level element of each one-directional filter is the same, it is possible to gather the conditional expressions because the values to be extracted are the same and the same conditional expression is generated.
Thus, a preparation for the upward trace of the XML tree structure is carried out. Incidentally, the conditional expression excluded at the step S307 (called “downward trace conditional expression” or “downward conditional expression”) is used in the downward trace of the tree structure of the DB integration metadata.
Returning to the explanation of the processing in
Then, the query processing engine 1312 judges whether or not an element, which corresponds to the upward conditional expression group identified at the step S215, in the XML tree structure is the bi-directional filter (in this case, always bi-directional filter because the processing as shown in
On the other hand, when the element corresponding to the upward conditional expression group identified at the step S215 is not the bi-directional filter, the query processing engine 1312 generates a query sentence to inquire of the first database by using respective conditions of the identified upward conditional expression group, and outputs the query sentence to the database access processor 1313 (step S219). For example, an SQL query for the stock table of the RDB2 as shown in the upper right (A) of
Then, the database access processor 1313 outputs the query sentence to a host managing the first database (e.g. the stock table of RDB2) through the grid tool 132, and obtains a query result (step S221). As shown in the upper right (B) of
Shifting to the explanation of the processing of
On the other hand, when the element positioned in one upper level in the XML tree structure is not a filter, the query processing engine 1312 generates a query sentence for the upper-level database by using the query result immediately before or the application result of the filter and an unused upward conditional expression group if it exists, and outputs the query sentence to the database access processor 1313 (step S231). As shown in
Then, the database access processor 1313 outputs the query sentence to a host managing the database (here, the RDB3) through the grid tool 132, and obtains a query result (step S233). As shown in the upper right (B) of
After that, the query processing engine 1312 judges whether or not the trace reaches the top-level element (step S235). When the trace does not reach the top-level element on the XML tree structure, the processing shifts to the step S227. By carrying out such a repeat processing, the value of the top-level element in the XML tree structure is obtained. The value of the top-level element is stored in a storage device.
Because the trace does not still reach the top-level element in the XML tree structure at the stage of
When it is judged at the step S235 that the trace reaches the top-level element, the query processing engine 1312 judges whether or not the element positioned in one lower level in the XML tree structure is a filter (step S237). When the element positioned in one lower level in the XML tree structure is not a filter, the query processing engine 1312 generates a query sentence for the lower-level database by using the upper-level query result or the application result of the filter and unused conditional expression (i.e. downward trace conditional expression), and outputs the query sentence to the database access processor 1313 (step S241). As shown in
Then, the database access processor 1313 outputs the query sentence to a host managing the database (e.g. the order_item table of the RDB3) through the grid tool 132, and obtains the query result (step S243). As shown in the upper right (B) of
In the example of
Then, the query processing engine 1312 judges whether or not the trace reaches the bottom-level element in the XML tree structure. Because the trace does not reach the bottom-level element in the XML tree structure, the processing returns to the step S237.
When the element positioned in one lower level in the XML tree structure is the filter, the query processing engine 1312 carries out a downward conversion of the bi-directional filter or the one-directional filter for the upper-level query result or the application result of the filter (step S239). As shown in
Because the trace does not still reach the bottom-level element in the example of
Then, the database access processor 1313 outputs the query sentence to a host managing the database (here, the item table of the RDB1) through the grid tool 132, and obtains the query result. As shown in the upper right (B) of
Then, the query processing engine 1312 judges whether or not the trace reaches the bottom-level element, again. In the example of
The query processing engine 1312 constructs XML data of the query results from the obtained data values according to the DB integration metadata (step S247). The obtained data values are embedded so as to correspond to the nodes of the SimpleElement, in which visible=true is set.
After that, the query processing engine 1312 carries out check of the query result (step S249). Because the possibility that a portion of the query conditions designated in the query by the XQuery has not been reflected yet remains, any solution that does not satisfy the query conditions is excluded from the XML data of the final results by the check processing.
When the one-directional filter is used in the XML tree structure, because some conditional expressions (i.e. downward trace condition expression) included in the query are not used in the upward trace, a lot of values were extracted though they does not satisfy the query condition in the downward trace for the upper portion of the filter. In the aforementioned example, when the conversion result of the filter and the conditional expression (code=FMV-6000CL) are finally applied, a case where any value is not extracted frequently occurs. Therefore, in this step, as a case where the query condition is not satisfied, data for a case where any values are not extracted for the code column and the name column in the item table of the RDB1 is deleted. When the value of the code column is “FMV-034564”, because the condition is not satisfied, the values of the code column and the name column in the item table of the RDB1 become empty. Accordingly, a case where the value of the code column in the order_item table of the RDB3 is “FMV-034564” is deleted.
Finally, the query processing engine 1312 outputs the query result to the user terminal 11 (step S251).
By carrying out such a processing, it becomes possible to refer to the associated data extending in the plural databases all together.
Next, by using
In such a case, at the step S313 of the upward conditional expression group generation processing, a conditional expression to extract all values of the immediately upper-level element of the one-directional filter is generated. Namely, as shown in the upper right (A) of
Then, shifting to an element positioned in one upper level, as shown in the upper right (A) of
Because the trace reaches the top-level element, the processing shifts to the downward trace. First, as shown in the right upper (A) of
Furthermore, the processing shifts to an element corresponding to the stock table of the RDB2, as the lower-level element. Then, as shown in the upper right (A) of
Next, the processing shifts to the one-directional filter. Then, as shown in the upper right (A) of
The trace shifts to an element corresponding to the item table of the RDB1 as a further lower-level element. Then, as shown in the upper right (A) of
Although this has been described above, narrowing by the condition of the query is lastly carried out in this case. Therefore, the records extracted from the RDB2 and the RDB3 includes data, which does not satisfy the condition of the query. Finally, already extracted data sets, which do not satisfy the condition of code=FMV-6000CL and in which any value of the name column is not extracted from the item table of the RDB1, are deleted.
Thus, even in case of the one-directional filter and even in case of the bi-directional filter, by the aforementioned upward trace and downward trace, it becomes possible to extract necessary data from the plural databases and to provide the extracted data for the user by the data view defined in the DB integration metadata in advance.
Incidentally, the database integration query system 13 and the user terminal 11 are computer devices as shown in
Although the present invention has been described with respect to a specific preferred embodiment thereof, various change and modifications may be suggested to one skilled in the art, and it is intended that the present invention encompass such changes and modifications as fall within the scope of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2006-343872 | Dec 2006 | JP | national |
2007-313134 | Dec 2007 | JP | national |
This is a continuation-in-part application of application Ser. No. 11/903,029, filed Sep. 20, 2007.
Number | Date | Country | |
---|---|---|---|
Parent | 11903029 | Sep 2007 | US |
Child | 12075373 | US |