Skip to content

Reading list

Example definition minimal-table.des

Views generated from the file

These views are drawn by this site from minimal-table.des itself: its metamodel, and the layers it fills. They are not the notation the definition draws; that appears in an IDE that runs it.

Metamodel of the Reading list example. Class diagram of minimal-table.des: 4 node types (Field, View, Book, Value) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
Generated from minimal-table.des at 2f3c7aa
Diagram as text (Mermaid)
classDiagram
  accTitle: Metamodel of the Reading list example
  accDescr: Class diagram of minimal-table.des: 4 node types (Field, View, Book, Value) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
  class Field {
    +string name
    +ValueType valueType
  }
  class View {
    +string name
  }
  class Book {
  }
  class Value {
    +Field field
    +text text
    +number number
  }
  Book "1" *-- "0..*" Value : contains
Layers of minimal-table.des. The eight DISL layers in order. minimal-table.des fills 3 of them: Metamodel (5 items), Constraints (1 items), Persistence (5 items). It leaves Coordinates, Notation, Toolbox, Behavior, Layout empty.
Generated from minimal-table.des at 2f3c7aa
Diagram as text (Mermaid)
flowchart LR
  accTitle: Layers of minimal-table.des
  accDescr: The eight DISL layers in order. minimal-table.des fills 3 of them: Metamodel (5 items), Constraints (1 items), Persistence (5 items). It leaves Coordinates, Notation, Toolbox, Behavior, Layout empty.
  L1["1 · Metamodel<br/>5 items"]
  L2["2 · Coordinates<br/>not used"]
  L3["3 · Notation<br/>not used"]
  L4["4 · Toolbox<br/>not used"]
  L5["5 · Constraints<br/>1 items"]
  L6["6 · Behavior<br/>not used"]
  L7["7 · Layout<br/>not used"]
  L8["8 · Persistence<br/>5 items"]
  L1 --> L2 --> L3 --> L4 --> L5 --> L6 --> L7 --> L8
  classDef filled stroke-width:3px
  classDef empty stroke-dasharray:4 4
  class L1 filled
  class L2 empty
  class L3 empty
  class L4 empty
  class L5 filled
  class L6 empty
  class L7 empty
  class L8 filled
  • Layer 1 — Metamodel: 5 items
  • Layer 2 — Coordinates: not used
  • Layer 3 — Notation: not used
  • Layer 4 — Toolbox: not used
  • Layer 5 — Constraints: 1 items
  • Layer 6 — Behavior: not used
  • Layer 7 — Layout: not used
  • Layer 8 — Persistence: 5 items

The file

Download minimal-table.des (2,507 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/desl/schema/0.1/desl.schema.json#/$defs/Specification",
  "desl": "0.1",
  "doc": "DESL's smallest example: a reading list, one row per book, with text and number fields and one view.",
  "language": { "id": "net.etalii.adp.example.reading-list", "version": "0.1.0", "origin": "example/reading-list", "label": "Reading list" },
  "metamodel": {
    "types": {
      "Field": {
        "attributes": { "name": { "type": "string", "required": true }, "valueType": { "type": "ValueType", "required": true } },
        "labelAttribute": "name"
      },
      "View": { "attributes": { "name": { "type": "string", "required": true } }, "labelAttribute": "name" },
      "Book": { "children": { "allowed": ["Value"], "ordered": true, "slots": { "values": { "allowed": ["Value"] } } } },
      "Value": { "attributes": { "field": { "type": "Field", "required": true }, "text": { "type": "text" }, "number": { "type": "number" } } }
    },
    "enums": { "ValueType": { "values": { "text": { "label": "Text" }, "number": { "label": "Number" } } } }
  },
  "persistence": {
    "format": "fbl",
    "bindings": ["minimal-table.fbl#yaml"],
    "ids": {
      "strategy": "uuid-v4",
      "encoding": "base36",
      "types": { "Value": { "strategy": "derived", "expression": "self.parent.id + '/' + self.field.id" } }
    }
  },
  "constraints": {
    "rules": [
      {
        "id": "uniqueFieldNames",
        "code": "reading-list.duplicate-field-name",
        "scope": ["Field"],
        "severity": "error",
        "rule": "document.elementsOfType('Field').filter(f, f.name == self.name).size() == 1",
        "message": "Two fields have this name."
      }
    ]
  },
  "surface": {
    "kind": "table",
    "columns": { "type": "Field", "name": "name", "valueType": "valueType" },
    "rows": { "type": "Book" },
    "cells": { "type": "Value", "column": "field" },
    "views": { "type": "View", "name": "name" },
    "valueTypes": {
      "text": { "label": "Text", "key": "text", "editor": "text", "comparisons": ["is", "contains"], "sort": "text", "converts": { "number": "parse" } },
      "number": {
        "label": "Number",
        "key": "number",
        "editor": "number",
        "comparisons": ["equals", "greater-than", "less-than"],
        "sort": "number",
        "converts": { "text": "written-form" }
      }
    }
  },
  "operations": { "addBook": { "label": "New book", "for": "document", "actions": [{ "create": { "type": "'Book'" } }] } }
}

In an IDE

No IDE host runs this example yet.