Configuring ID Graph Rules, Subrules, and Data Source Views

This tutorial provides a walkthrough on how to create the metadata objects ID Graph Rules, Subrules, and Data Source Views, publish metadata changes, and run the Customer 360 Job so that Oracle Unity can create customer profiles. If you are not already familiar with these concepts, see Explore Customer 360 Concepts first.

In this tutorial:

  1. Create an ID Graph Rule

  2. Create a Data Source View for the ID Graph Rule

  3. Create Subrules

  4. Create Data Source Views for Subrules

  5. Publish Metadata Changes

  6. Run the Customer 360 Job

Step 1: Create an ID Graph Rule

First let's create a new ID Graph Rule.

Request

Create a new ID Graph Rule named "Rule1":

POST http://{accountURL}/api-metadata/v1/<tenantAccessKey>/metadata/idgraphrules

Request Body

[
  {
    "tenantId": <tenantId>,
    "name": "Rule1",
    "active": true,
    "ruleId": "Rule1",
    "inputDsvId": "IDGraph_Customer",
    "dedupeTargetId": "customer_mastercustomer",
    "mainIdentifier": {
      "atype": ".DSVAttribute",
      "dsvId": "DataSourceView1",
      "attributeName": "ID"
    },
    "subRules": []
  }
]

Request notes

The request body defines the entire ID Graph Rule we want to create, including references to objects that do not exist yet (such as a Data Source View). We will be creating those objects later in this tutorial. This API request will not return errors when referencing objects that do not exist yet.

Note the following details about the ID Graph Rule:

  • Within the mainIdentifier parameter:

    • The dsvId parameter enables us to reference a Data Source View. In our request we are linking our ID Graph Rule to the Data Source View with the name DataSourceView1 ("dsvId": "DataSourceView1"). We will create this Data Source View in step 2.

    • The attributeName parameter enables us to select the main identifier for each row of data in the ID Graph. We are specifying ID because we want our main identifying attribute to be a customer's ID. This enables Customer ID to be the main identifier for each row of data.

  • The parameter dedupeTargetId is optional. In the above example, by declaring "dedupeTargetId": "customer_mastercustomer", the ID attribute defined in the mainIdentifier > "attributeName": "ID" is linked to the MasterCustomer ID, so that in step 3 when you create your Subrule, you can enable or disable the masterEntity parameter to control the data returned in your search.
  • We are setting ruleId to the same value as the new ID Graph Rule name we are creating. The value of this parameter needs to be unique.

Step 2: Create a Data Source View for the ID Graph Rule

Next let's create a new Data Source View for the ID Graph Rule we just created. This is the step where we define the attributes we want our search to return when we search our ID Graph Rule, and the attributes we will be able to search on when searching our ID Graph Rule.

We want the attributes of our ID Graph to contain: first name, last name, phone number, email address, customer ID, address line 1, state, and country. To accomplish this, we will set these attributes in the outputAttributes property.

Request

Create a new Data Source View:

POST http://{accountURL}/api-metadata/v1/<tenantAccessKey>/metadata/datasourceviews

Request Body

[
  {
    "tenantId":<tenantId>,
    "name": "IDGraph_Customer",
    "active": true,
    "dataSourceViewID": "IDGraph_Customer",
    "sourceTableQuery": {
      "MCPSQuery": {
        "tenantId": 0,
        "operation": {
          "ctype": ".SetOperation",
          "tenantId": 0,
          "operands": [
            {
              "ctype": ".ObjectSet",
              "tenantId": 0,
              "name": "c1",
              "objectName": "Customer",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "ID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "SourceCustomerID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "FirstName"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "LastName"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "Email"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "AlternateEmails"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "Phone"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "MobilePhone"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "c1",
                  "attributeName": "AlternatePhones"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "a1",
                  "attributeName": "AddressLines1"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "a1",
                  "attributeName": "AddressLines2"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "a1",
                  "attributeName": "ZipCodes"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "a1",
                  "attributeName": "States"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "a1",
                  "attributeName": "Countries"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT_OUTER",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "a1",
                      "attributeName": "CustomerID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "c1",
                      "attributeName": "ID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 0,
                  "name": "a1",
                  "objectName": "Address",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "a1",
                      "attributeName": "CustomerID"
                    },
                    {
                      "atype": ".FunctionAttribute",
                      "type": "CUSTOM",
                      "attributes": [
                        {
                          "atype": ".ReferenceAttribute",
                          "tableName": "a1",
                          "attributeName": "AddressLine1"
                        }
                      ],
                      "functionName": "collect_set",
                      "alias": "AddressLines1"
                    },
                    {
                      "atype": ".FunctionAttribute",
                      "type": "CUSTOM",
                      "attributes": [
                        {
                          "atype": ".ReferenceAttribute",
                          "tableName": "a1",
                          "attributeName": "AddressLine2"
                        }
                      ],
                      "functionName": "collect_set",
                      "alias": "AddressLines2"
                    },
                    {
                      "atype": ".FunctionAttribute",
                      "type": "CUSTOM",
                      "attributes": [
                        {
                          "atype": ".ReferenceAttribute",
                          "tableName": "a1",
                          "attributeName": "ZipCode"
                        }
                      ],
                      "functionName": "collect_set",
                      "alias": "ZipCodes"
                    },
                    {
                      "atype": ".FunctionAttribute",
                      "type": "CUSTOM",
                      "attributes": [
                        {
                          "atype": ".ReferenceAttribute",
                          "tableName": "a1",
                          "attributeName": "State"
                        }
                      ],
                      "functionName": "collect_set",
                      "alias": "States"
                    },
                    {
                      "atype": ".FunctionAttribute",
                      "type": "CUSTOM",
                      "attributes": [
                        {
                          "atype": ".ReferenceAttribute",
                          "tableName": "a1",
                          "attributeName": "Country"
                        }
                      ],
                      "functionName": "collect_set",
                      "alias": "Countries"
                    }
                  ],
                  "distinct": false,
                  "groupBy": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "a1",
                      "attributeName": "CustomerID"
                    }
                  ]
                }
              }
            },
            null
          ],
          "operator": "INTERSECTION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "ID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "SourceCustomerID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "FirstName"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "LastName"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "Email"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "AlternateEmails"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "Phone"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "MobilePhone"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "AlternatePhones"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "AddressLines1"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "AddressLines2"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "ZipCodes"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "States"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "c1",
              "attributeName": "Countries"
            }
          ],
          "joinConditions": []
        },
        "type": "DW"
      }
    }
  }
]

Request notes

  • The Data Source View name must match the inputDsvId and dsvID from the ID Graph Rule we created in step 1. This is because the ID Graph Rule must reference this Data Source View object.

  • You can retrieve attribute values with a GET request to your data objects. The response will return a list of attributes.

Step 3: Create a Subrule

Next we will create a Subrule. Subrules aren't required, but we want to include more information in our ID Graph Rule so our search returns more data.

In step 1 when we created our ID Graph Rule, we kept the subrules empty. We will now update the ID Graph Rule we created in step 1 to include two Subrules: one for Customer Event Information and one for Customer Purchase Records.

Request

Update the ID Graph Rule named "Rule1":

PUT http://{accountURL}/api-metadata/v1/<tenantAccessKey>/metadata/idgraphrules/Rule1

Request Body

Update the ID Graph Rule's subRules section to include Customer Event Information (Subrule named "IDGraph_Event") and Customer Purchase Records (Subrule named "IDGraph_OrderItem").

[
  {
    "tenantId": <tenantId>,
    "name": "Rule1",
    "active": true,
    "ruleId": "Rule1",
    "inputDsvId": "IDGraph_Customer",
    "dedupeTargetId": "customer_mastercustomer",
    "mainIdentifier": {
      "atype": ".DSVAttribute",
      "dsvId": "IDGraph_Customer",
      "attributeName": "ID"
    },
    "subRules": [
      {
        "tenantId": <tenantId>,
        "name": "IDGraph OrderItem",
        "active": true,
        "ruleId": "Rule1",
        "subRuleId": "subrule_OrderItem",
        "masterEntity": true,
        "inputDsvId": "IDGraph_OrderItem",
        "orderedField": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_OrderItem",
          "attributeName": "order_date_epoch"
        },
        "identifier": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_OrderItem",
          "attributeName": "CustomerID"
        },
        "subIdentifier": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_OrderItem",
          "attributeName": "SourceOrderLineItemID"
        },
        "maxRecords": 100
      },
      {
        "tenantId":  <tenantId>,
        "name": "IDGraph Event",
        "active": true,
        "ruleId": "Rule1",
        "subRuleId": "subrule_Event",
        "masterEntity": true,
        "inputDsvId": "IDGraph_Event",
        "orderedField": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_Event",
          "attributeName": "event_date_epoch"
        },
        "identifier": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_Event",
          "attributeName": "CustomerID"
        },
        "subIdentifier": {
          "atype": ".DSVAttribute",
          "dsvId": "IDGraph_Event",
          "attributeName": "SourceEventID"
        },
        "maxRecords": 100
      }
    ]
  }
]

Request notes

  • You can limit the number of records returned by a Subrule with the maxRecords parameter.

  • The orderedField parameter enables you to specify the field to order your data records. In the example above we are specifying our data records to be ordered using the event_date_epoch field, meaning our data records will be ordered by event date.

    Example: To create a Subrule to retrieve the last 5 events for a customer returned in chronological order, you would specify orderedField and for the attributeName parameter, specify the event time stamp field such as event_date_epoch.

  • The Subrule's identifier > attributeName must connect the data from the Subrule's Data Source View with the mainIdentifier from the ID Graph Rule's Data Source View we created in step 2. Since our rule ID is "Rule1", the main identifier is ID on the "IDGraph_Customer" Data Source View, which corresponds to "CustomerID" on the "IDGraph_OrderItem" and "IDGraph_Event" Data Source Views.

  • The masterEntity parameter enables you to see a single mastered data record in the search result. This parameter is only applicable if dedupeTargetId is specified in the ID Graph Rule.

    • masterEntity: true - Queries data based on the mastered data record (Master Customer ID for example).

    • masterEntity: false - Queries data based on the mastered data record (Master Customer ID for example) and source records (Customer ID for example).

    Example: If you want the Subrule to return the customer's mastered mailing address, then enable masterEntity. Otherwise, if you want the Subrule to return all the addresses attributed to the customer, disable masterEntity.

  • If masterEntity is disabled, you must set the subIdentifier > attributeName, otherwise you will only get one record displayed in your search results.

    Disabling masterEntity results in more data records displayed in your search results. You will want to set the subIdentifier > attributeName parameter to an attribute that enables you to tell the difference between the records. When the search results return more than one records for the same ID identifier, the API uses subIdentifier to tell the difference between the records. You must set the subIdentifier, otherwise, you will only get one record.

    Example: For our IDGraph Event Subrule, we are specifying "attributeName":"SourceEventID". This means when the search results return more than one records for the same ID identifier, the API uses the SourceEventID attribute to tell the difference between the records.

Step 4: Create additional Data Source Views for each Subrule

Next, for the two Subrules we created, we must create a Data Source View for each. First, let's create a Data Source View for the "IDGraph_Event" Subrule.

Request

Create a new Data Source View:

POST http://{accountURL}/api-metadata/v1/<tenantAccessKey>/metadata/datasourceviews

Request Body

Name the Data Source View "IDGraph_Event":

[
  {
    "tenantId": <tenantId>,
    "name": "IDGraph_Event",
    "active": true,
    "dataSourceViewID": "IDGraph_Event",
    "sourceTableQuery": {
      "MCPSQuery": {
        "operation": {
          "ctype": ".SetOperation",
          "operands": [
            {
              "ctype": ".ObjectSet",
              "name": "C1",
              "objectName": "Event",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "TenantID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceEventID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Type"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SubType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Status"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "StatusReason"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceCustomerID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CustomerID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceLaunchID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "LaunchID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceCampaignID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CampaignID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceMessageID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MessageID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceProgramID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceListID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrderID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MobileNumber"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Cookie"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Email"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "LaunchTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CampaignCreatedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MessageSentTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "EventTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Content"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceProductID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ProductID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceCategoryID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CategoryID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourcePromotionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "PromotionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "URL"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Medium"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Source"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OperatingSystem"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "UserAgent"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "BrowserType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Browser"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Complaint"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SpamType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "IsConverted"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderTotal"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Quantity"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "EmailDomain"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MobileCode"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MobileCarrier"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "MobileKeyword"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CountryCode"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourcePushID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceAppID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "PlatformType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceUserID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "IsActive"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "TargetName"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CreatedBy"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ModifiedBy"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CreatedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ModifiedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "RowCreatedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "RowModifiedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrganizationID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrganizationID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrderItemID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderItemID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Target"
                },
                {
                  "atype": ".FunctionAttribute",
                  "type": "CAST",
                  "attributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C1",
                      "attributeName": "EventTS"
                    },
                    {
                      "atype": ".StaticAttribute",
                      "data": "BIGINT"
                    }
                  ],
                  "alias": "event_date_epoch"
                }
              ],
              "distinct": false
            },
            null
          ],
          "operator": "INTERSECTION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "TenantID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceEventID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Type"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SubType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Status"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "StatusReason"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceCustomerID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CustomerID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceLaunchID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "LaunchID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceCampaignID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CampaignID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceMessageID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MessageID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceProgramID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceListID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrderID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MobileNumber"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Cookie"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Email"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "LaunchTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CampaignCreatedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MessageSentTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "EventTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Content"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceProductID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ProductID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceCategoryID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CategoryID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourcePromotionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "PromotionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "URL"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Medium"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Source"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OperatingSystem"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "UserAgent"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "BrowserType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Browser"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Complaint"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SpamType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "IsConverted"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderTotal"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Quantity"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "EmailDomain"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MobileCode"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MobileCarrier"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "MobileKeyword"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CountryCode"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourcePushID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceAppID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "PlatformType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceUserID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "IsActive"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "TargetName"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CreatedBy"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ModifiedBy"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CreatedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ModifiedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "RowCreatedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "RowModifiedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrganizationID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrganizationID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrderItemID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderItemID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Target"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "event_date_epoch"
            }
          ],
          "joinConditions": [
            
          ]
        },
        "type": "DW"
      }
    }
  }
]

Next let's create a Data Source View named "IDGraph_OrderItem":

Request

POST http://{accountURL}/api-metadata/v1/<tenantAccessKey>/metadata/datasourceviews

Request Body

[
  {
    "tenantId": <tenantId>,
    "name": "IDGraph_OrderItem",
    "active": true,
    "dataSourceViewID": "IDGraph_OrderItem",
    "sourceTableQuery": {
      "MCPSQuery": {
        "operation": {
          "ctype": ".SetOperation",
          "operands": [
            {
              "ctype": ".ObjectSet",
              "name": "C1",
              "objectName": "OrderItem",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "TenantID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrderLineItemID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrderID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceCustomerID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CustomerID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceOrganizationID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrganizationID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceSubscriptionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SubscriptionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceProductID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ProductID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourcePromotionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "PromotionID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceAssociateID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "AssociateID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceAccountID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "AccountID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceShippingAddressID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ShippingAddressID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SourceBillingAddressID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "BillingAddressID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Type"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SubType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "TargetType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Status"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Comment"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderEntryTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ShipTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Quantity"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Weight"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "UnitPrice"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ListPrice"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OriginalPrice"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ExtendedPrice"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Discount"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Cost"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Award"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ShippingCost"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ShippingRevenue"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Tax"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "SalesChannel"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "PaymentType"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "Carrier"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "IsGift"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CurrencyID"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CurrencyCode"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "OrderLevelDiscount"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CreatedBy"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ModifiedBy"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "CreatedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ModifiedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "RowCreatedTS"
                },
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "RowModifiedTS"
                },
                {
                  "atype": ".FunctionAttribute",
                  "type": "CAST",
                  "attributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C1",
                      "attributeName": "OrderEntryTS"
                    },
                    {
                      "atype": ".StaticAttribute",
                      "data": "BIGINT"
                    }
                  ],
                  "alias": "order_date_epoch"
                }
              ],
              "distinct": false
            },
            null
          ],
          "operator": "INTERSECTION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "TenantID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrderLineItemID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrderID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceCustomerID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CustomerID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceOrganizationID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrganizationID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceSubscriptionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SubscriptionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceProductID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ProductID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourcePromotionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "PromotionID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceAssociateID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "AssociateID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceAccountID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "AccountID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceShippingAddressID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ShippingAddressID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SourceBillingAddressID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "BillingAddressID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Type"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SubType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "TargetType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Status"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Comment"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderEntryTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ShipTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Quantity"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Weight"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "UnitPrice"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ListPrice"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OriginalPrice"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ExtendedPrice"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Discount"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Cost"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Award"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ShippingCost"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ShippingRevenue"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Tax"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "SalesChannel"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "PaymentType"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "Carrier"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "IsGift"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CurrencyID"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CurrencyCode"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "OrderLevelDiscount"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CreatedBy"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ModifiedBy"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "CreatedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ModifiedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "RowCreatedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "RowModifiedTS"
            },
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "order_date_epoch",
              "alias": "order_date_epoch"
            }
          ],
          "joinConditions": []
        },
        "type": "DW"
      }
    }
  }
]

 

Step 5: Publish Metadata Changes

Now that you've made changes to metadata objects in Unity, you must publish these changes for the changes to take effect. Anytime you make changes to a metadata object, you must publish before you can use the latest version of the metadata object.

Request

POST http://{accountURL}/api-admin/v1/<tenantAccessKey>/admin/tenant/publish

Response

A successful request will return a 200 response.

 

Step 6: Run the Customer 360 Job

Running the Customer 360 Job creates customer profiles. To learn how to run this job, see the Oracle Unity Help Center.

Learn more

Searching Customer Profiles