Show Menu
TOPICS×

Model data in schemas

In this lesson, you will model Luma's data into schemas. This is one of the longest lessons in the tutorial, so get a glass of water and buckle up!
Standardization and interoperability are key concepts behind Adobe Experience Platform. Experience Data Model (XDM), driven by Adobe, is an effort to standardize customer experience data and define schemas for customer experience management.
XDM is a publicly documented specification designed to improve the power of digital experiences. It provides common structures and definitions for any application to use to communicate with Platform services. By adhering to XDM standards, all customer experience data can be incorporated into a common representation that can deliver insights in a faster, more integrated way. You can gain valuable insights from customer actions, define customer audiences through segments, and express customer attributes for personalization purposes.
XDM is the foundational framework that allows Adobe Experience Cloud, powered by Experience Platform, to deliver the right message to the right person, on the right channel, at exactly the right moment. The methodology on which Experience Platform is built, XDM System , operationalizes Experience Data Model schemas for use by Platform services.
Data Architects will need to create schemas outside of this tutorial, but Data Engineers will work very closely with the schemas created by the Data Architect.
Before you begin the exercises, watch this short video to learn more about schemas and the Experience Data Model (XDM):

Permissions required

In the Configure Permissions lesson, you set up all the access controls you need to complete this lesson, specifically:
  • Permission items Data Modeling > View Schemas and Manage Schemas
  • Permission item Sandboxes > Luma Tutorial
  • User-role access to the Luma Tutorial Platform product profile
  • Developer-role access to the Luma Tutorial Platform product profile (for API)

Create Loyalty Schema via UI

In this exercise we will create a Luma Loyalty Schema to ingest loyalty data of customers.
  1. In the Platform UI and ensure your sandbox is selected.
  2. Click Schemas in the left navigation
  3. Click the Create Schema button on the top right
  4. From the dropdown menu, select XDM Individual Profile
  5. In Schema Properties , on the right-hand side of the screen, enter Display Name Luma Loyalty Schema

Add standard mixins

Fields are added to schemas by adding mixins. You can choose from a large set of industry-standard mixins provided by Adobe or create your own. As you start modeling your own data in Experience Platform, it is good to become familiar with the industry-standard mixins provided by Adobe. Whenever possible, it is a best-practice to use them as they sometimes power downstream services, such as Customer AI, Attribution AI, Adobe Analytics, etc.
To add mixins:
  1. On the left side of the schema editor, in the Mixin section, click the Add button:
  2. In the Mixins modal, select following mixins
    1. Profile Personal Details
    2. Profile Person Details
  3. Note that you can preview the fields in the mixin by clicking the icon on the right side of the row.
  4. Click Add mixin to add the mixins to the schema
Now take some time to explore the current state of the schema. Note that these two mixins have added standard fields related to a person and their contact details. You may find these two mixins useful when you create schemas for your own company's data. Click a specific mixin row or check the box next to the mixin name to see how the visualization changes.
It is okay if a mixin adds a field for a data point that you don't collect. For example, "faxPhone" might be a field for which Luma doesn't collect data. That's fine. Just because a field is defined in the schema doesn't mean that data for it needs to be ingested later on.

Add custom mixins

Next we need to add fields that are specific to Luma's Loyalty system and which don't exist in any standard mixins. For that you can create your own mixins.
  1. In the Mixins section of the schema editor, click the Add button again
  2. Select Create new mixin radio button
  3. Enter the Display name as Luma Loyalty Mixin and click the Add mixin button
  4. In the Mixins section of the schema editor, click on the name of the new mixin so that the Add field buttons appear on in the Structure section
  5. In Structure section, click Add field at top level in structure of Schema. It will create an object with your tenant id (prefixed with an underscore) and a field 'New field' .
  6. In Field properties section, enter the following
    1. Field Name: loyalty
    2. Display Name: Loyalty
    3. Type: Object
  7. Click Apply to add the field
  8. Select the newly created loyalty object and click Add Field button next to it to add a field within the object
  9. Create a field with following values
    1. Field Name: memberSince
    2. Display Name: Member Since
    3. Type: Date
  10. Click Apply to add the field
  11. Repeat Step 8-10 to add two more fields within the loyalty object:
    1. Points
      1. Field name: points
      2. Display name: Points
      3. Type: Integer
      4. Default: 0
    2. Level
      1. Field name: level
      2. Display name: Level
      3. Type : String
      4. Enum: Checked, with the following enumeration values:
        Value
        Label
        bronze
        Bronze
        silver
        Silver
        gold
        Gold
        platinum
        Platinum
  12. Click Save to save the current state of your schema, which should look like this:
Now we will create another mixin to contain the loyaltyId field, as well as other identifiers which we will use in the other schemas. Since you are now familiar with how to create mixins, create one named Luma Identity Profile Mixin with the following fields:
  1. System Identifier
    1. Field name: systemIdentifier
    2. Display name: System Identifier
    3. Type: Object
  2. Loyalty Id (put in the systemIdentifier object)
    1. Field name: loyaltyId
    2. Display name: Loyalty Id
    3. Type: String
  3. CRM Id (put in the systemIdentifier object)
    1. Field Name: crmId
    2. Display Name: CRM Id
    3. Type: String
Your new mixin should look like this. Click the Save button to save your schema, but leave the schema open for the next exercise.

Create a data type

Mixins, such as your new Luma Loyalty Mixin , can be reused in other schemas, allowing you to enforce standard data definitions across multiple systems. Mixins however can only be reused in schemas that share the same class , in this case the XDM Profile Class.
The data type is another multi-field construct which can be reused in schemas across multiple classes . Let's convert our new systemIdentifier object into a data type:
With the Luma Loyalty Schema still open, select the systemIdentifier object and click Convert to new data type
We will use this data type later in the lesson.

Create CRM Schema via API

Now we will create a schema using the API.
If you prefer to skip the API exercise, you can create the following schema using the UI method you just used:
  1. Use the XDM Individual Profile class
  2. Name it Luma CRM Schema
  3. Use the following mixins: Profile Person Details, Profile Personal Details, Profile Preferences Details and Luma Identity Profile Mixin
First we will create the empty schema:
  1. Open Postman
  2. If you haven't made a call in the last 24 hours, your authorization tokens have probably expired. Open the call Adobe I/O Access Token Generation > Local Signing (Non-production use-only) > IMS: JWT Generate + Auth via User Token and click Send to request new JWT and Access Tokens, just like you did in the Postman lesson.
  3. Open your environment variables and change the value of CONTAINER_ID from global to tenant . Remember, you need to use tenant whenever you want to interact with your own custom elements in Platform, such as creating a new schema.
  4. Open the call Schema Registry API > Schemas > Create a new tenant-defined schema
  5. Open the Body tab and paste the following code and click Send to make the API call. This will create a new schema using the same XDM Individual Profile base class that was used in the Loyalty schema:
    {
      "type": "object",
      "title": "Luma CRM Schema",
      "description": "Schema for CRM data of Luma Retail ",
      "allOf": [{
        "$ref": "https://ns.adobe.com/xdm/context/profile"
      }]
    }
    
    
    The namespace references for standard class and mixin objects, in this and subsequent code samples, can be obtained by using list API calls such as Schema Registry API > Schemas > List all classes in the specified container. or Schema Registry API > Mixins > Return a list of all mixins within the specified container. with the CONTAINER_ID set to global and an accept header application/vnd.adobe.xdm+json .
  6. You should get a 201 Created response
  7. Copy meta:altId from Response body. We will use it later in another exercise.
  8. The new schema should be visible in the UI but without any mixins
The meta:altId or schema id can also be obtained by making the API request Schema Registry API > Schemas > List all schemas within the specified container. with the CONTAINER_ID set to tenant and an accept header application/vnd.adobe.xdm+json .
Common issues making this call and likely fixes:
  • No auth token: Run the IMS: JWT Generate + Auth via User Token call to generate new tokens
  • 401: Not Authorized to PUT/POST/PATCH/DELETE for this path : /global/schemas/ : Update the CONTAINER_ID environment variable from global to tenant
  • 403: PALM Access Denied. POST access is denied for this resource from access control : Verify your user permissions in the Admin Console

Add standard mixins

Now it's time to add the mixins to the schema:
  1. In Postman, open the call Schema Registry API > Schemas > Modify or update part of a tenant-defined schema
  2. In the Params tab, paste the meta:altId value from the previous response as the $id
  3. Open the Body tab and paste the following code and click Send to make the API call. This will add the three standard mixins to your Luma CRM Schema :
    [{
        "op": "add",
        "path": "/allOf/-",
        "value": {
          "$ref": "https://ns.adobe.com/xdm/context/profile-personal-details"
        }
      },
      {
        "op": "add",
        "path": "/allOf/-",
        "value": {
          "$ref": "https://ns.adobe.com/xdm/context/profile-person-details"
        }
      },
      {
        "op": "add",
        "path": "/allOf/-",
        "value": {
          "$ref": "https://ns.adobe.com/xdm/context/profile-preferences-details"
        }
      }
    ]
    
    
  4. You should get a 200 OK status for the response and the mixins should be visible as part of your schema in the UI

Add custom mixin

Now let's add our Identity Profile Mixin to the schema. Looking at the Body of the request from our last call, how do we know what $ref value to use for our custom mixin? We can find the value by using a list API:
  1. Open the call Schema Registry API > Mixins > Return a list of all mixins within the specified container.
  2. In the Headers tab, update the Accept header to application/vnd.adobe.xed-id+json
  3. Click the Send button to retrieve a list of all of the custom mixins in your account
  4. Grab the $id value of the Luma Identity Profile Mixin (yours will be different from the value in this screenshot)
  5. Now open the call Schema Registry API > Schemas > Modify or update part of a tenant-defined schema again
  6. The Params tab should still have the $id of your schema
  7. Open the Body tab and paste the following code, replacing the $ref value with the $id of your own Luma Identity Profile Mixin :
    [{
      "op": "add",
      "path": "/allOf/-",
      "value": {
        "$ref": "REPLACE_WITH_YOUR_OWN_MIXIN_ID"
      }
    }]
    
    
  8. Click Send
Verify that the mixin has been added to the schema by checking the UI or, for bonus points, see if you can figure out how to list the mixins in the schema using the Lookup a specific schema by its unique ID call in the Postman collection.

Create Offline Purchase Events Schema

Now let's create a schema based on the XDM ExperienceEvent class for Luma's offline purchase data. Since you are now getting familiar with the schema editor UI, I will reduce the number of screenshots in the instructions:
  1. Create a schema with the XDM ExperienceEvent class named Luma Offline Purchase Events Schema
  2. Save it and review the difference in base structure from the XDM Profile class schemas. Notice _id and timestamp are required fields in experience event class.
Next we will add a standard mixin and a custom mixin.

Add standard mixin

Experience event commerce details is a standard mixin for capturing common order details. Go ahead and add it to your schema. Spend a few minutes exploring the objects inside.

Add custom mixin

Now let's add the identities to our new schema:
  1. In the Mixins section, and click the Add button.
  2. Search for Luma Identity Profile Mixin . Note that it is not available! Remember that mixins are specific to a class, and this schema uses the XDM ExperienceEvent class instead of the XDM Individual Profile class. We will add a new mixin for the XDM ExperienceEvent class that contains the same exact identity fields thanks to our data type
  3. Select the Create new mixin radio button
  4. Enter the Display name as Luma Identity ExperienceEvent Mixin and click the Add mixin button
  5. In the Mixins section of the schema editor, click on the name of the new mixin so that the Add field buttons appear on in the Structure section
  6. In Structure section, click Add field at top level of the schema
  7. As the Field Name , enter systemIdentifier
  8. As the Display Name , enter System Identifier
  9. As the Type , select System Identifier
  10. Click the Apply button
  11. Click the Save button to save your schema
Note how the data type added all of the fields!

Create Web Events Schema

Now we are going to add one more schema for Luma's website data. By this point you should be an expert at creating schemas! Build the following schema with these properties
Property
Value
Schema Name
Luma Web Events Schema
Class
XDM ExperienceEvent
Mixin
AEP Web SDK ExperienceEvent Mixin
Mixin
Consumer ExperienceEvent mixin
Click on the Consumer ExperienceEvent mixin in the Composition section of the schema editor. Note that this mixin contains the commerce and productListItems objects that were also in the Experience event commerce details . Indeed Consumer ExperienceEvent mixin is a combination of several other standard mixins that are also available separately.
Notice that we didn't add the Luma Identity ExperienceEvent Mixin to this schema. This is because the Web SDK has a different way of collecting identities. If you select the XDM ExperienceEvent class in the Composition section of the schema editor, you will notice that one of the fields it adds by default is called IdentityMap . IdentityMap is used by various Adobe applications to link to Platform. You will see how identities are sent to Platform via identityMap in the streaming ingestion lesson.

Create Product Catalog Schema

By using the Experience event commerce details and Consumer ExperienceEvent mixins, Luma reports details of product-related events via the standard productListItems data type. But they also have additional product detail fields that they would like to send to Platform. Instead of capturing all of these fields in their point-of-sale and e-commerce systems and ingesting them into Platform using the schemas you just created, Luma would prefer to simply ingest these fields directly from their product catalog system. A "relationship schema" in Platform allows you to define a relationship between two schemas for the purposes of classification. Luma will use a relationship schema to classify their product details. We will begin the process now and complete it at the end of the next lesson.
If you are an existing Analytics or Target customer, classifying entities with relationship schema is analogous to SAINT classifications or uploading your product catalog for Recommendations
First we need to create a schema for Luma's product catalog using a custom class:
  1. Click the Create schema button and select the Browse option from the dropdown
  2. Select the Create new class radio button
  3. Name it Luma Product Catalog Class
  4. Leave the Behavior as Record
  5. Click the Assign Class button
  6. Name the schema Luma Product Catalog Schema
  7. Add a new mixin called Luma Product Catalog Mixin with the following fields:
    1. productName: Product Name: String
    2. productCategory: Product Category: String
    3. productColor: Product Color: String
    4. productSku: Product SKU: String | Required
    5. productSize: Product Size: String
    6. productPrice: Product Price: Double
  8. Save the schema
Your new schema should look like this:
The next step is to define the relationship between the two ExperienceEvent schemas and the Luma Product Catalog Schema , however there are a few additional steps that we need to take in the next lesson before we can do that.

Additional Resources

Now that you have your schemas you can map identities !