Skip to content

Example definition minimal-sections.des

Views generated from the file

These views are drawn by this site from minimal-sections.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 Trip log example. Class diagram of minimal-sections.des: 2 node types (Trip, Stop) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
Generated from minimal-sections.des at ddb0daa
Diagram as text (Mermaid)
classDiagram
  accTitle: Metamodel of the Trip log example
  accDescr: Class diagram of minimal-sections.des: 2 node types (Trip, Stop) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
  class Trip {
    +string title
    +string traveller
  }
  class Stop {
    +datetime at
    +StopKind kind
    +string place
    +text note
  }
Layers of minimal-sections.des. The eight DISL layers in order. minimal-sections.des fills 2 of them: Metamodel (3 items), Persistence (4 items). It leaves Coordinates, Notation, Toolbox, Constraints, Behavior, Layout empty.
Generated from minimal-sections.des at ddb0daa
Diagram as text (Mermaid)
flowchart LR
  accTitle: Layers of minimal-sections.des
  accDescr: The eight DISL layers in order. minimal-sections.des fills 2 of them: Metamodel (3 items), Persistence (4 items). It leaves Coordinates, Notation, Toolbox, Constraints, Behavior, Layout empty.
  L1["1 · Metamodel<br/>3 items"]
  L2["2 · Coordinates<br/>not used"]
  L3["3 · Notation<br/>not used"]
  L4["4 · Toolbox<br/>not used"]
  L5["5 · Constraints<br/>not used"]
  L6["6 · Behavior<br/>not used"]
  L7["7 · Layout<br/>not used"]
  L8["8 · Persistence<br/>4 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 empty
  class L6 empty
  class L7 empty
  class L8 filled
  • Layer 1 — Metamodel: 3 items
  • Layer 2 — Coordinates: not used
  • Layer 3 — Notation: not used
  • Layer 4 — Toolbox: not used
  • Layer 5 — Constraints: not used
  • Layer 6 — Behavior: not used
  • Layer 7 — Layout: not used
  • Layer 8 — Persistence: 4 items

The file

Download minimal-sections.des (3,214 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/desl/schema/0.1/desl.schema.json#/$defs/Specification",
  "desl": "0.4",
  "doc": "DESL's smallest page of sections (DESL 0.4, section 7.8): a trip log, whose trip is a record part and whose stops are a list part ordered by time, with a time strip that emphasises the departure and the arrival, a figure for the travel time and a mark on a stop without a note. minimal-sections.md is a document of it.",
  "language": { "id": "net.etalii.adp.example.trip-log", "version": "0.1.0", "origin": "example/trip-log", "label": "Trip log" },
  "metamodel": {
    "types": {
      "Trip": {
        "attributes": {
          "title": { "type": "string", "required": true },
          "traveller": { "type": "string" }
        },
        "labelAttribute": "title"
      },
      "Stop": {
        "attributes": {
          "at": { "type": "datetime", "timezone": "preserve", "doc": "When the stop was reached, RFC 3339 with its offset; a new stop has none until one is given." },
          "kind": { "type": "StopKind" },
          "place": { "type": "string", "required": true },
          "note": { "type": "text" }
        },
        "labelAttribute": "place"
      }
    },
    "enums": {
      "StopKind": { "values": { "departure": { "value": "Departure" }, "arrival": { "value": "Arrival" } } }
    }
  },
  "persistence": {
    "format": "fbl",
    "bindings": ["minimal-sections.fbl#markdown"],
    "ids": {
      "missing": "assign",
      "types": {
        "Trip": { "strategy": "derived", "expression": "'trip'", "ephemeral": true },
        "Stop": { "strategy": "derived", "expression": "'stop/' + string(self.positionIn(document.elementsOfType('Stop')))", "ephemeral": true }
      }
    }
  },
  "surface": {
    "kind": "sections",
    "parts": [
      {
        "id": "trip",
        "title": "Trip",
        "kind": "record",
        "type": "Trip",
        "fields": [{ "attribute": "title", "label": "Title" }, { "attribute": "traveller", "label": "Traveller" }]
      },
      {
        "id": "stops",
        "title": "Stops",
        "kind": "list",
        "type": "Stop",
        "fields": [{ "attribute": "at", "label": "Time" }, { "attribute": "kind", "label": "Kind" }, { "attribute": "place", "label": "Place" }, { "attribute": "note", "label": "Note", "widget": "text" }],
        "order": "has(self.at) ? string(self.at) : '~'",
        "add": "addStop",
        "timeStrip": { "at": "at", "highlight": "has(self.kind)", "label": "self.place" },
        "figures": {
          "travelTime": {
            "label": "Travel time",
            "value": "document.elementsOfType('Stop').filter(s, has(s.kind) && s.kind == 'arrival')[0].at - document.elementsOfType('Stop').filter(s, has(s.kind) && s.kind == 'departure')[0].at",
            "absentText": "No departure or arrival yet"
          }
        },
        "marks": {
          "noNote": { "when": "!has(self.note) || self.note == ''", "label": "No note", "style": "info" }
        }
      }
    ]
  },
  "operations": {
    "addStop": {
      "label": "New stop",
      "for": "document",
      "actions": [{ "create": { "type": "'Stop'", "attributes": { "place": "'New stop'" } } }]
    }
  }
}

In an IDE

No IDE host runs this example yet.