UDT Data Load via Rest Do Not Work as per the online specification - What's the correct way?

TigerGraph 3.1.6
I have the following Vertex Type:

VERTEX Reaxys_Metabolizer(
    PRIMARY_ID uri             STRING,
    hasMetabolizerCompoundName STRING,
    hasRelationIndexNumber     STRING,
    hasMetabolizerNumber       STRING,
    hasMetabolizerTotalNumber  Reaxys_MetabolizerTotalNumber,
    hasMetabolizerPercentage   Reaxys_MetabolizerPercentage
)

and the following UDT Type Defined

Reaxys_MetabolizerTotalNumber (
    hasValueUnit              STRING (1024),
    hasValue                  STRING (1024),
    hasDisplayValue           STRING (1024),
    hasPlausibility           STRING (1024),
    hasStatisticalInformation STRING (1024),
    hasStandardValue          STRING (1024),
    hasValuePrecision         STRING (1024)
)

I send a request where the json is formatted as such:

{
  "vertices" : {
    "Reaxys_Metabolizer" : {
      "Metabolizer_1" : {
        "hasMetabolizerTotalNumber" : {
          "value" : {
            "valuelist" : [
              "2000",
              "2000",
              "2000",
              "2000",
              "2000yards",
              "2000",
              "2000yards"
            ],
            "keylist" : [
              "hasPlausibility",
              "hasValueUnit",
              "hasStatisticalInformation",
              "hasStandardValue",
              "hasDisplayValue",
              "hasValue",
              "hasValuePrecision"
            ]
          }
        },
        "hasMetabolizerNumber" : {
          "value" : "1829"
        }
      }
    }
  },
  "edges" : {
    
  }
}

I keep getting the following error:

{
  "version" : {
    "edition" : "enterprise",
    "api" : "v2",
    "schema" : 1
  },
  "error" : true,
  "message" : "Processing attribute hasMetabolizerTotalNumber failed, keylist and UDT field names mismatch",
  "code" : "REST-30200"
}

Does the order of the keys on its own matter ? not talking of the alignement of the key and value, but the keys wrt to the tupleDef Definition. nothing in the doc says it should.
https://docs.tigergraph.com/v/3.1/dev/restpp-api/intro#formatting-data-in-json

The order of items in the valueList should correspond to the order of items in the keyList.

That is the only thing it says.

Hi @Maatdeamon,

Yes, it seems that the order of keys in keylist matters (even if – based on the docs – it should not).

I have created this UDT:

TYPEDEF TUPLE<
    field1 STRING(1024),
    field2 STRING(1024),
    field3 STRING(1024)
> my_tuple

and this vertex type:

VERTEX v1 (
    PRIMARY_ID id STRING,
    attr1         STRING,
    attr2         STRING,
    attr3         my_tuple
)

I could create/upload a vertex when I matched the order of key names:

{
  "vertices" : {
    "v1" : {
      "test2" : {
        "attr1" : {
          "value" : "This should work"
        },
        "attr3" : {
          "value": {
            "keylist" : [
              "field1",
              "field2",
              "field3"
            ],
            "valuelist" : [
              "value1",
              "value2",
              "value3"
            ]
          }
        }
      }
    }
  }
}
{
  "version": {
    "edition": "enterprise",
    "api": "v2",
    "schema": 1
  },
  "error": false,
  "message": "",
  "results": [
    {
      "accepted_vertices": 1,
      "accepted_edges": 0
    }
  ],
  "code": "REST-0001"
}

but got the same error as you when they were in a different order:

{
  "vertices" : {
    "v1" : {
      "test3" : {
        "attr1" : {
          "value" : "This should not work"
        },
        "attr3" : {
          "value": {
            "keylist" : [
              "field3",
              "field2",
              "field1"
            ],
            "valuelist" : [
              "value3",
              "value2",
              "value1"
            ]
          }
        }
      }
    }
  }
}
{
  "version": {
    "edition": "enterprise",
    "api": "v2",
    "schema": 1
  },
  "error": true,
  "message": "Processing attribute attr3 failed, keylist and UDT field names mismatch",
  "code": "REST-30200"
}
1 Like