This invention relates generally to database systems and in particular to conducting searches in structured, unstructured, single vendor and multi vendor databases.
A large part of data available on the web is hidden on dynamically generated sites in databases and standard search engines can not effectively access and index this data. This hidden mass of data is referred to as the “deep web”. It has been estimated that the deep web may contain approximately 500 times more information than the data that can be accessed directly in a database via search engines. Some websites provide a proprietary search interface, custom developed for their specific applications to access and retrieve data from the deep web in their databases.
Also, the target data in a database may not necessarily be stored in a single table. For example, the target data may be stored across multiple tables that are related through the keys of the tables. Complicating this problem further, there are many variations of databases available from different vendors. The common approach to searching databases is the use of structured query language (SQL) queries to fetch data from the databases. However, to use SQL queries, the user requires prior knowledge of the structure of data storage across tables and databases and their inter-relationships. The user also needs to be conversant with the arcane query languages.
Furthermore, in the case of legacy databases, the structural schema of the database, namely the keys of the tables and the relationship between the keys of different tables, is generally either unknown or is very poorly documented. In such cases, only the raw data of the database is available.
The current market solutions provide effective keyword based search solutions for the case of structured databases from a single vendor. However, there is an unsatisfied need to address the problem of keyword-based searches in unstructured databases of multiple vendors.
This invention solves the above problems by providing keyword search functionality for a variety of database platforms. The database platform may include structured databases for which meta data definitions are available, or include unstructured databases for which no meta data information is available. The database platform may also comprise either a single database, or multiple databases from different vendors.
In this invention, an index database is created using a propagative n-level indexing method. The index database stores information regarding the occurrence of words, the relationship information between the keys of different tables, the primary key information of all the tables and the table rank information. Once the index database is created, it can be searched using multi-dimensional analysis.
Under this invention, a database adapter resolves the discrepancies when working across multi-vendor databases. The database adapter provides a consistent and uniform interface for conducting database operations.
The occurrence of a keyword in a table is indexed by storing the word, the column identifier that maps to the column name, table name and database name, and the number of times the given word occurs in the column. The relationship information indexed comprises the foreign key relationship between different tables, the primary key, and unique keys of each table. The relationship information is populated to facilitate data retrieval from the table containing the search words, and also data retrieval from across rows of other tables related to the search output.
For structured data, the population of relationship information is obtained directly from the schema and is a process well known in the art. However, this invention provides the ability to also search unstructured databases where no prior schema information is available by creating a relationship between different tables derived by propagative n-level indexing.
This invention also discloses a method to search across multiple tables. Given a set of keywords, the search engine fetches the actual rows from the database containing the given keywords. The keywords may be present in a single row of a table, or across rows in multiple tables. The search engine's in-built intelligence determines if the rows of different tables containing the keywords are related. Generally, data regarding a specific entity is not stored in a single table, but is split across different tables in a database. For example, consider the case where the contact number information of an employee is stored in the CONTACTINFO table and the remaining details of the employee like the name, age, department, etc., is stored in the EMPLOYEE table. The result is inadequate if the row containing the search keyword alone is given as the output. A more meaningful search result will comprise all the related rows from other tables. In the above case, when a phone number is given as the search input, the row containing the phone number from the CONTACTINFO table and the other details of the employee corresponding to this phone number from the EMPLOYEE table will be displayed in the output.
This invention also discloses a method to search across databases from different vendors through the use of a database adapter. The database adapter resolves the discrepancies across different database access methodologies and provides a consistent and uniform interface for conducting database operations.
This invention also discloses a method to determine the actual SQL queries for fetching data from different tables.
In addition to simplistic keyword-based searches, the invention can also support most of the standard SQL operations, for example, fetching a particular column based on a condition, ignoring a particular column from the search result, and determining the minimum, maximum and average values of a column. The keyword based search under this invention is performed through a user-friendly interface without the need for using complex SQL queries.
Other features of the present invention will become more fully apparent from the description below.
The above and further features of this invention can be understood by referring to the following drawings in conjunction with the accompanying description, in which like numerals indicate like structural elements and features in various figures.
1 displays an example of an employee table for describing the propagative n-level indexing method.
2 displays an example of a department table for describing the propagative n-level indexing method.
1 displays an example of a column index table for describing the propagative n-level indexing method.
2 displays an example of a key info table for describing the propagative n-level indexing method.
1 displays an example of word occurrences table for describing the propagative n-level indexing method.
2 displays an example of relationship info table for describing the propagative n-level indexing method.
3 displays an example of table weight table for describing the propagative n-level indexing method.
The index database 106 is first created. To create the index database 106, data is fetched from the multi-vendor structured or unstructured databases 105 through the database adapter 104. The index creator 102 builds the cross-indices for the multi vendor structured and unstructured databases 105. The index creator 102 derives word occurrences information, table weight information and table relationship information and thereafter populates the index database 106. The user inputs the keywords through the user interface 101. The search implementer 103 is pulled up on demand to provide relevant prescient search results for the given search words. The search implementer 103 consists of an index analyzer 103.A, table prioritizer 103.B and query constructor 103.C.
Propagative n-level indexing 304, illustrated in
The indexes store the relationship at one level and also extend it to n levels.
1 and
The key info table example 319 is illustrated in
The WORDOCCURRENCES table example 320 is illustrated in
Using the WordOccurrences table example table 320 for the words occurring in each of the primary key columns, the other unique columns referring to the words are determined. For example, the column id 6 (Department.DepartmentName) in
The TableWeight table example 322 is illustrated in
The populate word occurrences step involves tracking the occurrence of a word in all the columns, tables and databases. The relevant table name, column name, and database name in which the word resides is recorded. The number of times a given word occurs in a column of a table is also recorded. The word occurrences information is then populated in the WORDOCCURRENCES table 203.
The primary key and unique key information of all the tables is populated in the KEYINFO table 202 and COLUMNINDEX table 201. The relationship between the primary keys of different tables is populated in the RELATIONSHIPINFO table 205. The relationship between the primary key of one table and the foreign key of another table is also recorded in the RELATIONSHIPINFO table 205. The table rank is calculated based on the number of tables referring to the table under consideration.
The cell values are tokenized using delimiters. The tokenizing process helps in retrieving the relevant row with partial words as input, thereby avoiding the use of % word % query in the index database 106.
The search query is executed after the index information is populated in the index tables. Given a set of keywords to be searched, the search implementer 103,
The database neutrality across multi-vendor structured and unstructured databases 105 is achieved through the database adapter 104,
Application 501 of
The SQLGenerator 503 generates SQL statements that retrieve records from the underlying database 506 matching the given criteria and with all the joins to be performed between tables. SQL statements are formed for the Data Manipulation Language (DML) write operations including insert, update, delete SQLs and Data Definition Language (DDL) operations including create table, drop table SQLs. The SQL statement (select, insert, update, delete, create table, drop table, etc.) is thereafter executed.
SelectQuery is the object structure of the American National Standards Institute (ANSI) 92 compliant SQL string. It comprises the following clauses: select clause, from clause, join clause, where clause, order by clause and group by clause. Each of the above clauses has an object representation. The SelectQuery object is the complete containment object.
DataSet is the wrapper class for ResultSet object that results from the execution of a SELECT statement. Dataset handles the ResultSet based inconsistencies and provides the uniform ResultSet-like interface for the applications.
The query executed by the system is captured in the SelectQuery object. The RelationalAPI 502 upon invocation uses appropriate database specific SQL Generator 503 to generate the DB-specific SQLs. The database specific SQLs are then executed using the database specific database adapter 104 and the ResultSet is wrapped in a ResultSetAdapter. The RelationalAPI 502 then converts the returned ResultSetAdapter into a DataSet that is used by the applications 501 to process the database search result.
The following example illustrates the use of the database adapter 104 of
Along with the selectquery object, the type of the data source will also be communicated to the RelationalAPI 502. The RelationalAPI 502 transfers the SelectQuery to the SQLGenerator of the corresponding database. The SQLGenerator 503 parses the SQL and generates the query corresponding to the database.
The output of the SQLGenerator 503 for the above SelectQuery object is as follows:
The database adapter 104 executes the query generated above on the underlying database 506 through JDBC driver 505. The database adapter 104 will return the result as DataSet objects. If a method against a data type is not supported for a particular driver, but the same is valid per JDBC 2.0 specifications, then the DataSet implementation for that driver and database will handle that specific situation.
The processes illustrated in
COLUMNINDEX table 201 is first created. A unique column identifier is assigned for the columns of all the tables in structured or unstructured databases 105. This unique column identifier is used in all the subsequent tables for referring to the columns of a table. COLUMNINDEX table 201 comprises information on whether the column is unique or not unique and whether it is a primary key column, or a foreign key column. The components of the COLUMNINDEX table 201 are described in
In the case of structured databases, the uniqueness or non-uniqueness of a column is determined using the available schema information. For unstructured databases where no schema information is readily available, the data is analyzed using the propagative n-level indexing 304 method. The data analysis involves determining the number of distinct values of each column of a table and checking if the number is equal to the number of rows of the table. This process is continued for all possible column combinations, including the case where more than one column forms a composite unique key for a table.
The next step in the indexing process is the population of the KEYINFO table. The KEYINFO table 202 stores information on the primary keys (PK) of the tables. It also stores information on whether the primary key of a given table is dependent on primary keys of other tables. For structured databases, the key information is populated directly using the schema information. For unstructured data, the most probable primary key is identified from the set of unique keys. This is achieved by applying heuristic algorithms on information comprising the number of column combinations forming the unique key, the data type of the column and the length of the data available in the column. The components of the KEYINFO table 202 are described in
Once the KEYINFO table 202 is populated, the next step is to index the occurrences of each word in the WORDOCCURRENCES table 203. It is not possible to trace the occurrence of each word by the row in which it occurs. Tracing the occurrence of the cell values with respect to the rows will result in a combinatorially unmanageable number of rows in the WORDOCCURRENCES table 203. If there are i tables each with j columns and k rows, there will be i*j*k rows resulting in the WORDOCCURRENCES table 203. This will significantly increase the size of the index tables, resulting in an increase in the look-up time for these tables. The performance of a search is directly dependent on the look-up time from these tables. Moreover, indexing with respect to the row may also result in duplicate information being stored in the index table. For example, if the allowed values of a column are TRUE/FALSE and if the table contains approximately 10,000 rows, then these two values will be repeated 10,000 times in the index table.
To avoid the above problem, the value of the cell is indexed with respect to the column of a table. In addition to tracking the occurrence of the word with respect to the table name and the column name, the WORDOCCURRENCES table 203 also keeps track of the number of times a word occurs in a given column. To populate the WORDOCCURRENCES table 203, all the tables of the input structured or unstructured databases 105 using the JDBC API are obtained. Thereafter, for each table, the columns and the distinct values of a column are obtained. Each of these cell values are tokenized using delimiters like space, ampersand, comma, dot and hyphen. The words are tokenized and indexed. For example, if a value in a particular cell is james@adventnet.com and if the search word is James, since the words are indexed after tokenizing, the row that contains james@adventnet.com will also be fetched. However, if the indexing is performed without tokenizing the cell values, then only rows containing an exact match on the keywords will be retrieved. For each of the tokens, the hash code value of the token is determined and the corresponding value is stored in the WORDOCCURRENCES table 203. The tokens are hashed in order to minimize the size of the index tables. The components of the WORDOCCURRENCES table 203 are described in
The RELATIONSHIPINFO table 205 stores the relationship between the keys of different tables. This relationship information is determined from the schema in the case of structured data. In the case of unstructured data, this information is derived based on the analysis of the data. The components of the RELATIONSHIPINFO table 205 are described in
To determine the relationships between the different keys, the keys are first classified into two types. The first type of key is the surrogate key, which is a numeric key of length one. A single column forms the primary key of the table. The second type of key is the non-numeric key of length one or more. It can either be a single non-numeric column, or multiple column combinations forming the composite primary key. The second type of key will be referred to as a non-surrogate key hereafter. The classifications of the types of the keys are important, as the methodologies for determining the relationships between these two types of keys are significantly different. It is difficult to determine the relationship between tables that have surrogate keys, as sufficient information cannot be extracted from the numeric values of these columns to determine if two columns of different tables refer to each other.
For the non-surrogate case, the relationship between different keys is found using the information populated in the WORDOCCURRENCES table 203 through the following steps. The primary column of all the tables is obtained from the KEYINFO table 202. For each primary key column, the word occurring in the primary key column is identified, and the other unique column(s) in other tables that contain the same word are identified. Then a check is performed to determine if one of the tables is a subset of the other, i.e., the primary key (PK) and the foreign key (FK) are identified. This dependency information between keys is then populated in the RELATIONSHIPINFO table 205.
For example, consider the example of an EMPLOYEE table with primary key “EMPLOYEE.EmployeeName”. The following steps explain how the relationship between the keys is derived:
The above information is populated in the RELATIONSHIPINFO table 205,
The TABLEWEIGHT table 204 maintains the TableRank of a given table. TableRank is calculated based on the number of tables that refers to the table under consideration. TableRank indicates the level of importance of the given table during the search process. If a large number of tables have a foreign key (FK) relationship with the given table, then the level of importance of the table is high. The number of tables pointing to the current table is calculated from the index information in WORDOCCURRENCES table 203. Table Rank is the count of the occurrences of values in primary columns of the given table in unique columns of other tables. The components of the TABLEWEIGHT table 204 are described in
The search process consists of the step of searching the given words in a single table, followed by the step of searching the given set of words across different tables that are related through a primary key. The steps involved in the searching process once the search words 401 are input through the search interface 601 are determining the occurrences of word 402 in the tables, prioritizing the tables identified 403, checking table 404 to determine if it contains all the search words, finding the related tables 405, forming the join between the tables 406, constructing the query for the related tables 407, and executing and displaying the results 408. The user interface 101 is illustrated in
This invention not only fetches data from the table that contains the search words but also fetches information from other related tables. For example, consider the tables STUDENT 1601 illustrated in
Assume that all the Students of a college have entries in the STUDENT table 1601 and the final year students have some additional information stored in the FINALYEARSTUDENT table 1602 in addition to the STUDENT table 1601. Similarly, assume that only final year students can become a student representative. Therefore, a student representative will have entries in STUDENT,
The steps involved in multi-dimensional searching for a given set of input words are described below:
Thus, the search result will provide the rows containing the search words, and also all the related rows from other tables that are linked by the keys. This method is particularly effective when the data is split in multiple tables for normalization purposes. The present invention thereby exploits the relationships between tables to fetch relevant data from multiple tables.
It is not necessary for all the keywords to be present in a single table. Data can be spread across different tables that are linked by a primary key or a foreign key. For example, consider the details of an employee illustratrated in
The method of searching across multiple tables is now described. Consider an example where the search input is w1, w2, and w3. Assume that w1 is present in table T1.r1 and w2, w3 are present in table T2.r2. Assume that the rows r1 and r2 are related by the same primary key value. The following process steps find the tables T1, T2 as the search result for the given inputs w1, w2, w3:
The search is conducted through a user-friendly keyword search user interface 101. The user does not need to have prior knowledge of the underlying database structure or need to be conversant with SQL software language to retrieve data from the structured or unstructured databases 105. This user interface 101 performs functions offered by SQL, for example:
For the given set of search keywords, the output can be viewed in two formats. One format displays the actual data fetched from the index database 106 and the other format displays the queries that are used to fetch the data. The query generated is specific to the type of the database containing the data.
An example of the search methodology across multiple tables is described below. Assume the input words to be Radha and NetworkElement.
Similarly the other tables of the Union List namely, WORDLIST, NETWORKELEMENT, JOINTABLE, RESOURCES, RESOURCES_PIDX are processed.
For a given search query, the results are extracted from different tables that contain the given input words. The method of ranking the search results is hereafter discussed. The results are ranked based on the TABLE WEIGHT value. The COLUMNINDEX.ColumnType, WORDOCCURRENCES.WordCount and the TABLEWEIGHT.TableRank determine the table weight. The value of COLUMNINDEX.ColumnType depends on whether the given column is a primary key column or unique key column or foreign key column. The Tables are ranked as follows:
While the above description contains much specificity, it should not be construed as limitations on the scope of the present invention, but rather as an exemplification of one preferred embodiment thereof. Many other variations are possible. Accordingly the scope of the present invention should be determined not by the embodiment (s) illustrated, but by the appended claims and their legal equivalents.