Design a Data Source Connector File Structure

 

What do you want to do?

Create a .csv file descriptor

Represent a rulebase entity

Represent a rulebase attribute

Represent a rulebase relationship

Understand data formats

 

Create a .csv file descriptor

When creating the csv file, give each column in the input file a unique name that ideally maps to an attribute name. For each csv source file (for example, parent.csv) there must be a corresponding XML description of the file (for example, parent.xml). This XML file is there to list the "column" names for the data contained within the csv file, and is structured as follows:

parent.xml

<table name="parent" xmlns="http://oracle.com/determinations/connector/
 data-source/table">

  <columns>
    <column header="id" ordinality="1"/>
    <column header="name" ordinality="2"/>
    <column header="wage" ordinality="3"/>
  <columns>
</table>

parent.csv

1,John Robinson,350

2,Lois Griffin,400

 

To ensure consistency, the table element’s name attribute should be the same as the name of the csv/xml files.

Each column element contains a header attribute, specifying the column name, and an ordinality attribute, which can be found in the csv file.

Represent a rulebase entity

Entity mappings are one-to-one mappings with a table. The location of the table being mapped should be specified as a relative path from the configuration file.

Represent a rulebase Attribute

Attribute Mappings are two sided mappings, with a Table/Column on one side and an Entity/Attribute on the other. The mappings also store details of the data type and whether the attribute is an output attribute. If the attribute is an output (or goal) attribute the mappings also define what ordinality the attribute should take in the output CSV file.

Represent a rulebase relationship

As well as entities and attributes, a rulebase data model may also contain relationships between entities. In a database data source these will be represented as Primary/Foreign Key pairs between tables. Relationship mappings allow you to define the links between these Primary/Foreign Key pairs, and the corresponding entity relationship within the rulebase. The connector supports the use of multiple columns as keys, and the full set of 1:1, 1:M (M:1) and M:M relationship types.

 

Using these two concepts above, we can easily represent a full set of data mappings from data source to rulebase target. With the option to mark specific attributes as outputs, we also gain the ability to specify which data to extract from our rulebase.

 

Understand data formats

Data Source Connector follows some specific data formats that can be interpreted in different formats to simplify conversions.

Date Values

For dates, Data Source Connector uses the format yyyy-MM-dd, where:

yyyy – year (4 digits)

MM - month (2 digits)

dd – day (2 digits)

 

For example, there could be a table called birthday that contains two fields (name and date of birth) and contains the following;

Stephanie, 2000-08-31

Kyle, 2000-10-05

Kenny, 2005-09-08

Maria,2004-05-06

Diane,2007-12-23

 

This is to simplify the case for different locales and for different date patterns.

Boolean Values

For boolean values, the most basic is used, as with truth tables: 0 = False and 1 = True.

For example, there could be a table called holiday and it has two fields (date and holiday) and contains the following:

2000-12-25,1 (Christmas is a holiday)

2000-12-02,0 (December 2, 2000 is not a holiday)