Generate the Fact Store Data

The format that you use to store Fact Store data depends on whether you use a SQL database or an IDOL Content component as your Fact Store.

This section describes how to convert a table of information into Fact Store content, for each backend type. It uses the example table specified in the Create Coding Files, and also assumes you have set the entity and property codes as described in that section.

product_name, color, buy_price, sell_price, sold_last_year
alpha, red, 10, 12, 3500000
beta, blue, 11, 13, 2000000
gamma, green, 9, 10, 1000000

Create a Fact Store Table for a SQL Database

In the SQL database backend, each property and property value for a particular entity is a row in the Facts table. For more information about the format of this table, see Set Up a SQL Backend as Fact Store.

The following table shows the table rows for the alpha product, assuming that all these properties refer to the same qualifier combination.

entity_code property_code property_value qualifier_combination
QALPHA SCOLOR red 0
QALPHA SBUY_PRICE 10 0
QALPHA SSELL_PRICE 12 0
QALPHA SSOLD_LAST_YEAR 35000000 0

For this data, the qualifiers you use in the qualifiers table might include a year, or a selling region. For example:

qualifier_combination property_code property_value
0 SYEAR 2015
0 SREGION Americas

Create Fact Store Documents for the IDOL Content Component

To index your fact data into the Fact Store Content component, you must convert each row of your data table into an IDX document.

For example, the following sample is an IDX document for the first row of the example data.

#DREREFERENCE QALPHA
#DREFIELD SCOLOR="red"
#DREFIELD SBUY_PRICE="10"
#DREFIELD SSELL_PRICE="12"
#DREFIELD SSOLD_LAST_YEAR=35000000"
#DREENDDOC

You can index the fact data into your Fact Store Content component by using a DREADD or DREADDDATA index action, to add it into the Facts database. For example:

http://localhost:12111/DREADD?C:\Documents\factbank\factstore.idx&DREDbName=Facts
TIP:

The Facts database is configured by default, but Answer Server queries all databases in the Fact Bank, so you can use any database that you want.

When you have more complicated data, where a property of one entity is also an entity in its own right, you include the value in the document for the main entity, but use a code with a Q prefix in the property coding files and the document field.

For example, for the following fact table, you might want to have both company_name and CEO as entities. For more information about this example, see More Complicated Data.

company_name,CEO,share_price
MyCompany,Jane Smith,12.00

The IDX that you generate for this company entity would have the following form:

#DREREFERENCE QMyCOMPANY
#DREFIELD QCEO="Jane Smith"
#DREFIELD SSHARE_PRICE="12.00"

_HP_HTML5_bannerTitle.htm