Using the Query Builder Platform to Test a Query
The Query Builder Platform provides a command-line interface for testing a query definition. The two steps used to test a query definition are verifying that the configuration file is correct and verify that the query retrieves the desired records.
Verifying the configuration
This step verifies that the configuration file defining the query is valid and generates a valid TIBCO Patterns query. The command-line tool scans the configuration producing a log of all errors and questionable items found in the configuration. On request, it creates a copy of the configuration file with error messages added as annotations to the associated items in the configuration. This is often the best way to locate where the errors are in a large and complex configuration.
Verifying the query
Verifying that a configuration is valid does not verify that the query it defines returns the desired results. To do that you must run the query and examine the query results. The command-line interface allows you to run a query against a TIBCO Patterns server using data from CSV files or a TIBCO Patterns server.
A configuration file defines how the queries are run. This is a separate configuration file from the one that defines the query. In this file, you can specify the source data for generating the queries and a target TIBCO Patterns server, on which the queries are run.
The query source can be a set of CSV files, one for each table defined for the query. The rows in the files must be sorted by the PARENT key value. The records in the CSV files are merged into compound records. These compound records are used as the input to the defined query builder.
Alternatively, the query source can be a TIBCO Patterns server. Compound records are read from the server based on the table structure in the query definition.
By using the query run configuration file, you can remap the table and field names for the query source and the target server. You can also specify a cutoff score applied to all queries, and a maximum number of queries to run.
Details about the format of the configuration file used to define a query run can be found in the RunQuery.xsd schema file located in the query_builder/schema directory. The run_customer1.xml sample query run configuration file is provided in the query_builder/samples directory.