Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Serialization Format

Farshid Tavakolizadeh edited this page Oct 27, 2020 · 1 revision

NOTE:

  • The format described below is based on the assumption that the Deployment Model (the annotated domain model) can be serialized as a directed graph.
  • At the moment, only elements from the LinkSmart model (the Deployment Model) are serialized/extracted, but this format can also be used to serialize classes and objects from the Domain Model that don't have LinkSmart counterparts (i.e. no stereotypes defined)

Model:

{
  "name": "string",
  "version": "string",
  "model": []
}

where:

  • name is the name of the model
  • version is the model version (e.g., timestamp)
  • model is an array of directed graphs as described below

Node:

{
  "ls_id": "string",
  "ls_name": "string",
  "ls_stereotype": "string",
  "ls_attributes": {},
  "domain_class": "string",
  "domain_attributes": {},
  "children": []
}

where:

  • ls_id and ls_name are attributes from the LinkSmart model
  • ls_stereotype is a class from LinkSmart model: "Device" or "Resource"
  • ls_attributes are the attributes of classes from the LinkSmart model
  • domain_class is the class name from the application domain model
  • domain_attributes are the attributes of classes from the application domain model
  • children is an array of children nodes in the same format

Device Node:

{
  "ls_id": "string",
  "ls_name": "string",
  "ls_stereotype": "Device",
  "ls_attributes": {
        "description": "string",
        "meta": {},
        "ttl": "number"
    },
  "domain_class": "string",
  "domain_attributes": {},
  "children": [...]
}

Resource node:

{
  "ls_id": "string",
  "ls_name": "string",
  "ls_stereotype": "Resource",
  "ls_attributes": {
        "meta": {},
        "representation": {},
        "ext_protocol": {},
        "int_protocol": {}
    },
  "domain_class": "string",
  "domain_attributes": {},
  "children": [...]
}

Example:

{
   "model": [{
      "domain_class": "Class_1",
      "ls_stereotype": "Device",
      "ls_id": "ls01",
      "ls_attributes": {
         "description": "description for instance 1",
         "ttl": 30,
         "meta": {
            "name1": "value1",
            "name2": "value2"
         }
      },
      "children": [
         {
            "domain_class": "Class_2",
            "ls_stereotype": "Resource",
            "ls_id": "ls002",
            "ls_attributes": {
               "protocol": {
                  "methods": ["PUB"],
                  "content_types": ["text/plain"],
                  "type": "MQTT",
                  "endpoint": {
                     "topic": "temperature",
                     "url": "tcp://mqttbroker:1883"
                  }
               },
               "representation": {"text/plain": {"type": "number"}}
            },
            "children": [],
            "ls_name": "resource 1",
            "domain_attributes": {
               "id": "51",
               "Y": "250",
               "X": "120"
            }
         },
         {
            "domain_class": "Class_2",
            "ls_stereotype": "Resource",
            "ls_id": "ls003",
            "ls_attributes": {
               "protocol": {
                  "methods": ["PUB"],
                  "content_types": ["text/plain"],
                  "type": "MQTT",
                  "endpoint": {
                     "topic": "pressure",
                     "url": "tcp://mqttbroker:1883"
                  }
               },
               "representation": {"text/plain": {"type": "number"}},
               "meta": {
                  " rs3": "val3",
                  "rs4": "val4"
               }
            },
            "children": [],
            "ls_name": "resource 2",
            "domain_attributes": {
               "id": "52",
               "Y": "250",
               "X": "120"
            }
         }
      ],
      "ls_name": "device 1",
      "domain_attributes": {
         "id": "d001",
         "domain_attr1": "domain_attr1_value",
         "domain_attr2": "domain_attr2_value"
      }
   }],
   "name": "simple_deployment",
   "version": "xmi"
}
Clone this wiki locally