Skip to content

Repo API: Node serialization #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
enikao opened this issue Nov 11, 2022 · 8 comments
Closed

Repo API: Node serialization #37

enikao opened this issue Nov 11, 2022 · 8 comments

Comments

@enikao
Copy link
Contributor

enikao commented Nov 11, 2022

Aspects

  • Nodes form a graph -> several pointers to the same node
  • Because of partial loading, we might have dangling pointers -> target might not be loaded

Detailed discussions

Format

All nodes are repesented by a flat list.
All links to other nodes (both containment and reference) are represented by their id.

Each node has the following fields:

  • id: The id of the node
  • concept: Refers to the id of the type of the node
  • properties: Map with
    • key: id of the property
    • value: string value of the property
  • children: Map with
    • key: id of the containment link
    • value: id of the contained node
  • references: Map with
    • key: id of the reference link
    • value: List of Maps with
      • reference: id of the referenced node, or null if id of the referenced node is not available
      • resolveInfo: resolve info as string, or null if no resolve info is available
  • parent: id of parent node

Example

Similar to example in #36, but using property/link ids

{
  "serializationFormatVersion": "1",
  "nodes": [
    {
      "id": "11",
      "concept": "1000_1001",
      "parent": "abc",
      "properties": {
      },
      "children": {},
      "references": {
        "1000_1001-3001": [
          {
            "reference": "23",
            "resolveInfo": "Lassie"
          },
        ],
        "1000_1001-3002": [
          {
            "reference": "19",
            "resolveInfo": "Main street 23, 123 FarFarAway"
          }
        ],
        "1000_10-01": [
          {
            "reference": "342",
            "resolveInfo": null
          }
        ]
      }
    },
    {
      "id": "99",
      "concept": "1000_1002",
      "parent": "abc",
      "properties": {
        "1000_1002-1001": "Lassie"
      },
      "children": {},
      "references": []
    },
    {
      "id": "19",
      "concept": "2000_addr",
      "parent": "def",
      "properties": {
        "addr_com-example-3": "Main street",
        "addr_com-example-2": "23",
        "addr_com-example-0": "123",
        "addr_com-example-1": "FarFarAway"
      },
      "children": {},
      "references": []
    },
    {
      "id": "342",
      "concept": "internal_TechnicalPermission",
      "parent": "internal_permissionStore"
      "properties": {
        "internal_TechnicalPermission_data": "ICAgIHsKICAgICAgImlkIjogIjM0MiIsCiAgICAgICJ0eXBlIjogIlRlY2huaWNhbFBlcm1pc3Npb24iLAogICAgfQo="
      },
      "children": {},
      "references": []
    }
  ]
}
@enikao enikao added the repo label Nov 11, 2022
@enikao
Copy link
Contributor Author

enikao commented Nov 11, 2022

Do we need a fourth list for annotations, that work the same as containments?
E.g.

{
  "id": "99",
  "type": "Dog",
  "properties": {
    "name": "Lassie"
  },
  "containments": {
    "eyes": [
      "23", "55"
    ]
  },
  "references": {
    "owner": {
      "34": "Joe"
    }
  },
  "annotations": {
    "character": "79"
  }
}

@enikao
Copy link
Contributor Author

enikao commented Nov 11, 2022

How do we store several children in the same role?

List

{
  "id": "99",
  "type": "Dog",
  "containments": {
    "eyes": [
      "23", "55"
    ]
  }
}

Duplicate keys

(I think JSON allows that.)

{
  "id": "99",
  "type": "Dog",
  "containments": {
    "eyes": "23",
    "eyes": "55"
  }
}

@enikao
Copy link
Contributor Author

enikao commented Jan 13, 2023

Rename type field?

Once we introduce a typesystem, people tend to get confused by "typesystem type" vs. "metalevel type".

Potential other field names include

  • concept
  • meta

@dslmeinte
Copy link
Contributor

Or metaType?

(Can we make a poll on GitHub?)

@enikao
Copy link
Contributor Author

enikao commented Feb 1, 2023

Decision on type field via Slack vote: rename to concept

Rationale: type might be confused with calculated type (as provided by a typesystem). meta is too ambiguous.

@enikao
Copy link
Contributor Author

enikao commented Feb 1, 2023

How do we store several children in the same role?

Has been decided to use Lists

@enikao
Copy link
Contributor Author

enikao commented Feb 1, 2023

Do we need a fourth list for annotations, that work the same as containments?

Annotations are postponed (#13)

@enikao
Copy link
Contributor Author

enikao commented Mar 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants