Consuming Data from the Hub | ||
---|---|---|
Previous | Next | |
Running the Publishing Process | Conclusion |
Consuming data from the hub is performed through mappings using source tables from the hub. These tables contain the golden and master data. In this tutorial, the consumption process targets an XML file which has the following structure:
This structure contains information about
Customers and
Employee (The customer’s account manager), and must be loaded using the corresponding entities in the MDM Hub. The golden data for these entities is stored in the
GD_CUSTOMER
and
GD_EMPLOYEE
tables from the
SEMARCHY_DEMO_MDM
schema that was previously reverse-engineered.
In this mapping, we are extracting data from two tables in the MDM Hub (
GD_EMPLOYEE
and
GD_CUSTOMER
) and target the DemoXMLGolden XML file.
The GD tables store golden data for all data branches and editions.
Therefore, a GD table needs to be filtered in order to retrieve data:
GD_CUSTOMER.B_BRANCHID=1
.
GD_CUSTOMER.B_BRANCHID = 0 and GD_CUSTOMER.B_CLASSNAME = 'Customer' and GD_CUSTOMER.B_FROMEDITION <= 0 and (GD_CUSTOMER.B_TOEDITION is null or GD_CUSTOMER.B_TOEDITION > 0)
This filter indicate that records retrieved:
GD_CUSTOMER.B_BRANCHID = 0
GD_CUSTOMER.B_CLASSNAME = 'Customer'
GD_CUSTOMER.B_FROMEDITION <= 0 and (GD_CUSTOMER.B_TOEDITION is null or GD_CUSTOMER.B_TOEDITION > 0)
A similar filter must be applied to the GD_EMPLOYEE table.
GD_EMPLOYEE.B_BRANCHID=1
.
GD_EMPLOYEE.B_BRANCHID = 0 and GD_EMPLOYEE.B_CLASSNAME = 'Employee' and GD_EMPLOYEE.B_FROMEDITION <= 0 and (GD_EMPLOYEE.B_TOEDITION is null or GD_EMPLOYEE.B_TOEDITION > 0)
It is now necessary to join the two sources to establish the relation between the GD_CUSTOMER and GD_EMPLOYEE tables.
GD_CUSTOMER.F_ACCOUNT_MANAGER=GD_EMPLOYEE.EMPLOYEE_NUMBER
Note: This hub mandates that a customer has at least one account manager. This join uses a default join type, that is an INNER JOIN.
GD_CUSTOMER.CUSTOMER_ID
GD_CUSTOMER.CUSTOMER_NAME
GD_EMPLOYEE.FIRST_NAME
GD_EMPLOYEE.LAST_NAME
GD_EMPLOYEE.PHONE_NUMBER
GD_EMPLOYEE.EMAIL_ADDRESS
GD_CUSTOMER.INPADDRESS || ', ' || GD_CUSTOMER.INPPOSTAL_CODE || ' - ' || GD_CUSTOMER.INPCITY || ', ' || GD_CUSTOMER.INPCOUNTRY
The mapping appears as shown below.
Note: To iterate and create multiple elements in the target XML file, it is necessary to provide a key indicating how to break the records into sub-elements. In this mapping, the key is provided in the Customer> Customer target element, which appears with a key indicator. One
<Customer>
sub-element is created for eachCUSTOMER_ID
value returned from theGD_CUSTOMER
table, that is for each customer golden record.
<semarchy_di>/samples/xml/golden_customer.xml
file created by the mapping. It displays the golden customers records and their attached golden account manager records.
The file content is as shown below.
<?xml version="1.0" encoding="windows-1252"?>
<CORP:Customers xmlns:CORP="http://www.semarchy.com/samples"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Customer id="1">
<customer_name>GADGETROM</customer_name>
<address>711 KAPIOLANI BOULEVARD, - HONOLULU, USA</address>
<account_manager>
<first_name>Matthew</first_name>
<last_name>WEISS</last_name>
<phone_number>+1.650.123.1234</phone_number>
<email_address>mweiss@fakecompany.com</email_address>
</account_manager>
</Customer>
<Customer id="2">
<customer_name>BURLEIGH AND STRONGINTHEARM</customer_name>
...
Previous | Top | Next |
Running the Publishing Process | Conclusion |