Raw Item Data Structure

Raw items in Data Hub have associated metadata that describes the structure of the raw data entering the data pool. This structure and naming forms the basis for the raw to canonical item mapping during the composition phase of the Data Hub workflow.

Raw data is imported as raw item fragments. A raw item fragment is a key-value map that represents one row from a table in your source database. It consists of the item itself plus an integration key provided by the source system. You define a structure to organize these data fragments in Data Hub using metadata.

Raw item metadata defines raw item types. A raw item type roughly corresponds to a table in your source system. Each raw item type then has one or more attributes. The attribute name corresponds to the column name. As each data fragment is loaded into Data Hub, it is assigned one of these raw item type attributes. Data Hub then references this raw item type and attribute name during composition as the source for populating a canonical item attribute.

You specify this raw item data structure in your raw-extension.xml file.

Raw Item XML

The following raw item XML shows a simple example of raw item metadata. Here, there are two items, RawProduct and RawCategory, each with three attributes.

<rawItems>
		<item>
			<type>RawProduct</type>
			<description>Raw representation of apparel product</description>
			<attributes>
				<attribute>
					<name>baseName</name>
				</attribute>
				<attribute>
					<name>baseDescription</name>
				</attribute>
				<attribute>
					<name>style</name>
				</attribute>
			</attributes>
		</item>
		<item>
			<type>RawCategory</type>
			<description>Raw representation of apparel category</description>
			<attributes>
				<attribute>
					<name>name</name>
				</attribute>
				<attribute>
					<name>description</name>
				</attribute>
				<attribute>
					<name>sourceId</name>
				</attribute>
			</attributes>
		</item>
	</rawItems>

It is good practice to align this raw item structure definition with the source system structure. In this simple example, you would most likely have two tables in your source database. One table is called Product, with columns called name, description, and style. The other table is called RawCategory, with columns called name, description, and id.

However, unlike most standard data schemas, raw data in Data Hub has a flat structure. Relationships between data types in the source system can be handled by exploding the results of these relationships into your raw data fragments. You would then use the attribute called style in RawProduct. Style would contain a value taken from a style table in the source system, rather than simply a key.

Once this metadata is loaded, Data Hub uses it to create tables for storing raw items in its database, ready for composition.