Set Up a SQL Backend as Fact Store

You can use a SQL database to store facts and qualifiers for your Fact Store.

HPE Answer Server can connect to any RDBMS that supports SQL. You specify how to connect to the database by setting the appropriate connection string in the ConnectionString configuration parameter in the FactBank configuration. The most fully tested options are:

The SQL Fact Store contains two tables, one for facts, and one for qualifiers. The facts table stores the values of entity properties. The qualifiers table stores the names and values of particular sets of qualifiers associated with the properties. Each table includes qualifier combination values, which link the properties to the associated qualifiers.

The following sections describe the tables in more detail, and provide some best practices for how to organize your fact stores.

Manage Your Tables

HPE recommends that you organize your tables by creating a separate database for each set of facts and qualifiers. In this case, each database is the backend for its own Fact Bank system, which optimizes the database queries required for an Ask action.

For example, if you have a collection of facts about company sales histories, and a collection of facts about the products that a company offers, you might create a sales database and a products database. Each database is a separate Fact Bank instance in your HPE Answer Server setup, and you can easily query one or both, as required.

Facts Table

The facts table stores the values of entity properties.

This table must have the name facts. The facts table has four columns, described in the following table.

Column Type Description
entity_code text The code for the entity that this row is about, from your entity_to_code.txt coding file.
property_code text The code for the property that this row is about, from your property_to_code.txt coding file.
property_value text The value of this property for the specified entity, in the associated qualifier combination.
qualifier_combination integer The reference value for the rows in the qualifiers table that contain qualifiers that apply to a particular property value. This value corresponds to the values in the qualifier_combination column in the qualifiers table.

HPE Answer Server uses this column to find the appropriate property, entity, or property value when a question contains a particular qualifier.

You can optimize the performance of the facts table by creating indexes on each column. For example, in a PostgreSQL instance, HPE recommends that you create a btree index on each column.

Qualifiers Table

The qualifiers table stores the codes and values for qualifiers, and the qualifier combination reference that links a qualifier to a row in the facts table.

The table must have the name qualifiers. The qualifiers table has three columns, described in the following table.

Column Type Description
qualifier_combination integer

The qualifier combination reference that identifies qualifiers that are associated with a particular property value for an entity.

qualifier_code text The code for the property that this qualifier is about, from your property_to_code.txt file
qualifier_value text The value of the qualifier in this qualifier combination

Most data sets will have multiple rows with the same qualifier combination. For example, if your facts table contains the ares of different types of land in a country over time, you might have something like the following table for qualifiers.

qualifier_combination qualifier_code qualifier_value
0 LANDTYPE Farmland
0 YEAR 2015
1 LANDTYPE Forest
1 YEAR 2015
2 LANDTYPE Farmland
2 YEAR 2016
3 LANDTYPE Forest
3 YEAR 2016

In this case, the qualifier combination 0 relates to farmland in 2015, qualifier combination 1 relates to forest in 2015, and so on.

You can optimize the performance of the qualifiers table by creating indexes on each column. For example, in a PostgreSQL instance, HPE recommends that you create a btree index on each column.


_HP_HTML5_bannerTitle.htm