{
  "___MDB___": {
    "tableName": ["___MDB___"],
    "fields": [
      {
        "name": "name",
        "type": "character",
        "nullable": false,
        "unique": true,
        "comment": "The name of the modeled resource"
      },
      {
        "name": "title",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "A longer title for the resource"
      },
      {
        "name": "description",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "Description of the resource"
      },
      {
        "name": "url",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "URL for more information about the original resource"
      },
      {
        "name": "version",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "Version of resource data model. The version of the data should be included in the database itself."
      },
      {
        "name": "maintainer",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "Maintainer of the resource"
      }
    ],
    "primaryKey": ["name"],
    "foreignKeys": [],
    "indexes": [
      {
        "fields": ["name"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-31],
      "y": [-249],
      "color": ["#A9ECC9"],
      "comment": ["The modeled DataBase"]
    }
  },
  "___CollectionMembers___": {
    "tableName": ["___CollectionMembers___"],
    "fields": [
      {
        "name": "collection",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "The title of the collection"
      },
      {
        "name": "cid",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Collection identifier"
      },
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "The name of the table providing the collection"
      },
      {
        "name": "mid",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "The identifier of the member"
      },
      {
        "name": "field",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Part of the collection definition"
      },
      {
        "name": "static",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": "If the field value is the same for all elements in the collection"
      },
      {
        "name": "value",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "If static, the value is the value of the field, else the value is the name of the column providing the field value."
      },
      {
        "name": "type",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "Information about the type of the value helping its interpretation"
      }
    ],
    "primaryKey": ["collection", "field", "mid", "table"],
    "foreignKeys": [
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "table",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      }
    ],
    "indexes": [
      {
        "fields": ["collection", "field", "mid", "table"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-350],
      "y": [-304],
      "color": ["#DFFB86"],
      "comment": ["Tables in MDBs which provide a collection of concepts."]
    }
  },
  "___Tables___": {
    "tableName": ["___Tables___"],
    "fields": [
      {
        "name": "name",
        "type": "character",
        "nullable": false,
        "unique": true,
        "comment": "Table name"
      },
      {
        "name": "x",
        "type": "numeric",
        "nullable": true,
        "unique": false,
        "comment": "(ReDaMoR) Position of the table node in the data model"
      },
      {
        "name": "y",
        "type": "numeric",
        "nullable": true,
        "unique": false,
        "comment": "(ReDaMoR) Position of the table node in the data model"
      },
      {
        "name": "color",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "(ReDaMoR) Color of the table node in the data model"
      },
      {
        "name": "comment",
        "type": "character",
        "nullable": true,
        "unique": false,
        "comment": "(ReDaMoR) table description"
      }
    ],
    "primaryKey": ["name"],
    "foreignKeys": [],
    "indexes": [
      {
        "fields": ["name"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-355],
      "y": [-112],
      "color": ["#8FE6E0"],
      "comment": ["Tables belonging to each MDB"]
    }
  },
  "___Fields___": {
    "tableName": ["___Fields___"],
    "fields": [
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": ""
      },
      {
        "name": "name",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Field name"
      },
      {
        "name": "type",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Field type (R type)"
      },
      {
        "name": "nullable",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": "If the field is nullable"
      },
      {
        "name": "unique",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": "If the field is unique"
      },
      {
        "name": "comment",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Field description"
      },
      {
        "name": "fieldOrder",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "(ReDaMoR) Display order of the field"
      }
    ],
    "primaryKey": ["name", "table"],
    "foreignKeys": [
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "table",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      }
    ],
    "indexes": [
      {
        "fields": ["name", "table"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-354],
      "y": [197],
      "color": ["#8FE6E0"],
      "comment": ["NA"]
    }
  },
  "___PrimaryKeys___": {
    "tableName": ["___PrimaryKeys___"],
    "fields": [
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": ""
      },
      {
        "name": "field",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Table field belonging to the primary key"
      },
      {
        "name": "row_order",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Special field used to ensure the original order is preserved"
      }
    ],
    "primaryKey": ["field", "table"],
    "foreignKeys": [
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "table",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      },
      {
        "refTable": ["___Fields___"],
        "key": [
          {
            "from": "table",
            "to": "table"
          },
          {
            "from": "field",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      }
    ],
    "indexes": [
      {
        "fields": ["field", "table"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-248],
      "y": [36],
      "color": ["#C6BDF1"],
      "comment": ["Table primary keys"]
    }
  },
  "___Indexes___": {
    "tableName": ["___Indexes___"],
    "fields": [
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": ""
      },
      {
        "name": "idx",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Index identifier for the table"
      },
      {
        "name": "field",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "field belonging to the index"
      },
      {
        "name": "unique",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": ""
      },
      {
        "name": "row_order",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Special field used to ensure the original order is preserved"
      }
    ],
    "primaryKey": ["field", "idx", "table"],
    "foreignKeys": [
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "table",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      },
      {
        "refTable": ["___Fields___"],
        "key": [
          {
            "from": "table",
            "to": "table"
          },
          {
            "from": "field",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      }
    ],
    "indexes": [
      {
        "fields": ["field", "idx", "table"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-25],
      "y": [39],
      "color": ["#C6BDF1"],
      "comment": ["Table indexes"]
    }
  },
  "___ForeignKeys___": {
    "tableName": ["___ForeignKeys___"],
    "fields": [
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": ""
      },
      {
        "name": "fki",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Foreign key identifier for the table"
      },
      {
        "name": "field",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "field belonging to the foreign key"
      },
      {
        "name": "refTable",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Targeted table"
      },
      {
        "name": "refField",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Targeted field in the targeted table"
      },
      {
        "name": "fmin",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Minimum cardinality from the origin table"
      },
      {
        "name": "fmax",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Maximum cardinality from the origin table"
      },
      {
        "name": "tmin",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Minimum cardinality to the targeted table"
      },
      {
        "name": "tmax",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Minimum cardinality to the targeted table"
      },
      {
        "name": "row_order",
        "type": "integer",
        "nullable": false,
        "unique": false,
        "comment": "Special field used to ensure the original order is preserved"
      }
    ],
    "primaryKey": ["field", "fki", "refField", "refTable", "table"],
    "foreignKeys": [
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "table",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      },
      {
        "refTable": ["___Fields___"],
        "key": [
          {
            "from": "table",
            "to": "table"
          },
          {
            "from": "field",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      },
      {
        "refTable": ["___Fields___"],
        "key": [
          {
            "from": "refTable",
            "to": "table"
          },
          {
            "from": "refField",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      },
      {
        "refTable": ["___Tables___"],
        "key": [
          {
            "from": "refTable",
            "to": "name"
          }
        ],
        "cardinality": [0, -1, 1, 1]
      }
    ],
    "indexes": [
      {
        "fields": ["field", "fki", "refField", "refTable", "table"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-658],
      "y": [45],
      "color": ["#C6BDF1"],
      "comment": ["Table foreign keys"]
    }
  },
  "___MDBUsers___": {
    "tableName": ["___MDBUsers___"],
    "fields": [
      {
        "name": "login",
        "type": "character",
        "nullable": false,
        "unique": true,
        "comment": "User login"
      },
      {
        "name": "admin",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": "If the user can edit the MDB: the data and the model"
      }
    ],
    "primaryKey": ["login"],
    "foreignKeys": [],
    "indexes": [
      {
        "fields": ["login"],
        "unique": [true]
      }
    ],
    "display": {
      "x": [-662],
      "y": [-267],
      "color": ["#FAC6DC"],
      "comment": ["Users having access to the MDB"]
    }
  },
  "___Public___": {
    "tableName": ["___Public___"],
    "fields": [
      {
        "name": "public",
        "type": "logical",
        "nullable": false,
        "unique": false,
        "comment": "If the resource data are available for anybody having access to the chTKCat instance"
      }
    ],
    "primaryKey": [],
    "foreignKeys": [],
    "indexes": [],
    "display": {
      "x": [-695],
      "y": [-338],
      "color": ["#FAC6DC"],
      "comment": ["If the resource data are available for anybody having access to the chTKCat instance"]
    }
  },
  "___Timestamps___": {
    "tableName": ["___Timestamps___"],
    "fields": [
      {
        "name": "timestamp",
        "type": "POSIXct",
        "nullable": false,
        "unique": false,
        "comment": "chMDB instance timestamp"
      },
      {
        "name": "table",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Table name"
      },
      {
        "name": "instance",
        "type": "character",
        "nullable": false,
        "unique": false,
        "comment": "Table instance in Clickhouse"
      }
    ],
    "primaryKey": [],
    "foreignKeys": [],
    "indexes": {},
    "display": {
      "x": [-677],
      "y": [-179],
      "color": ["#FAC6DC"],
      "comment": ["Instance of each table at each timestamp. For each chMDB instance all the DB tables (including the model but not the \"___Public___\", the \"___Timestamps___\" nor the \"___MDBUsers___\" tables) are associated with an actual instance table in Clickouse. For the current instance, instance has the same value as table."]
    }
  }
}
