How can I map objects and arrays in the MarkLogic Data Hub QuickStart?

140 Views Asked by At

In the MarkLogic Data Hub QuickStart, I have configured a customer entity and an address entity. The address entity is embedded in the customer using a 1..n relationship.

I have created a mapping for the customer entity: enter image description here

When I click on the "Test" button, then the Street is mapped as expected (yellow marker). But when I run the mapping step on my customer documents, then the mapping of the address properties does not work as expected by me.

Here is the JSON generated in the FINAL database after running the mapping, including the input JSON (with the addresses) as attachment:

{
  "envelope": {
    "headers": {...}
    "triples": [],
    "instance": {
      "info": {...},
      "Kunde": {
        "KundenId": "AMP_01655c5ea353001c223d3A6C10BE5F0D",
        "AmparexCustomerId": "01655c5ea353001c223d3A6C10BE5F0D",
        "Anrede": "salutation_mister",
        "Name": "XXXXXX",
        "Vorname": "Edgar"
      }
    },
    "attachments": {
      "envelope": {
        "headers": {...},
        "triples": [],
        "instance": {
          "ID": "01655c5ea353001c223d3A6C10BE5F0D",
          "Firstname": "Edgar",
          ...
          "addresses": [
            {
              "Street": "Häldenstr. 7",
              "Zip": "XXXX",
      ....

My expectation was that the entity object would contain the addresses like this in the array "Adressen" (German for "addresses"):

"Kunde": {
    "KundenId": "AMP_01655c5ea353001c223d3A6C10BE5F0D",
    "AmparexCustomerId": "01655c5ea353001c223d3A6C10BE5F0D",
    "Anrede": "salutation_mister",
    "Name": "XXXXX",
    "Vorname": "Edgar",
    "Adressen" : [{
        "Strasse" : "Häldenstr. 7",
        "Postleitzahl" : "XXXX"
    }]
}

Do I misunderstand how the mapping of arrays or child objects work? Or did I make an error that has an effect when running the mapping, but not when using the "Test" button?

1

There are 1 best solutions below

0
On

The mapping I have used for the addresses now actually works. It seems that there is some kind of lag between changing a mapping in the QuickStart UI and the mapping being used in runs of the mapping step.