HomeGuidesRecipesAPI
HomeGuidesAPILog In

Hierarchical Data

A hierarchical datasource has the data are organized into a tree-like structure. The data are stored as records which are connected to one another through links. A record is a collection of fields, with each field containing only one value. The type of a record defines which fields the record contains.

The hierarchical database model requires that each child record has only one parent, whereas each parent record can have one or more child records.

JSON and XML files often include hierarchical data, in SmartIQ you'll get one of those if you are using one of the following Data Sources:

  • JSON
  • XML
  • Web Service (SOAP)
  • REST

Here two examples of hierarchical data:

<?xml version="1.0" encoding="utf-8"?>
<students>
  <student id="0001">
    <name>Justin</name>
    <lastName>Example</lastName>
    <subjects>
      <subject>
        <name>Science</name>
      </subject>
      <subject>
        <name>Nature History</name>
      </subject>
      <subject>
        <name>Biology</name>
      </subject>
    </subjects>
  </student>
</students>
{
  "students": {
    "student": {
      "-id": "0001",
      "name": "Justin",
      "lastName": "Example",
      "subjects": {
        "subject": [
          { "name": "Science" },
          { "name": "Nature History" },
          { "name": "Biology" }
        ]
      }
    }
  }
}

Level 1

  • name
  • lastName

Level 2

  • subject/name

In order to map these data sources in SmartIQ Design, it is required to have two Data Sources, where the first one will point directly to the root (created in manage) and the second one will point to the previous data source, specifically to the new level root (subjects/subject). Here an example diagram:

295

🚧

Note:

For hierarchical REST datasources, the schema must be supplied in Swagger format.

An example of a project that uses a JSON hierarchical data connection can be found here: