Skip to content

Example definition minimal-hierarchy.des

Views generated from the file

These views are drawn by this site from minimal-hierarchy.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 Outline example. Class diagram of minimal-hierarchy.des: 4 node types (Section, Task, Note, Tag) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
Generated from minimal-hierarchy.des at 2f3c7aa
Diagram as text (Mermaid)
classDiagram
  accTitle: Metamodel of the Outline example
  accDescr: Class diagram of minimal-hierarchy.des: 4 node types (Section, Task, Note, Tag) and 0 relation types (none), with their typed attributes, inheritance, containment and relation ends.
  class Section {
    +string title
    +text description
    +string[] tags
  }
  class Task {
    +string title
    +text description
    +string[] tags
  }
  class Note {
    +string about
    +NoteKind kind
    +string text
    +text detail
    +bool resolved
  }
  class Tag {
    +string name
    +Colour colour
  }
  Section "1" *-- "0..*" Section : contains
  Section "1" *-- "0..*" Task : contains
Layers of minimal-hierarchy.des. The eight DISL layers in order. minimal-hierarchy.des fills 2 of them: Metamodel (7 items), Persistence (6 items). It leaves Coordinates, Notation, Toolbox, Constraints, Behavior, Layout empty.
Generated from minimal-hierarchy.des at 2f3c7aa
Diagram as text (Mermaid)
flowchart LR
  accTitle: Layers of minimal-hierarchy.des
  accDescr: The eight DISL layers in order. minimal-hierarchy.des fills 2 of them: Metamodel (7 items), Persistence (6 items). It leaves Coordinates, Notation, Toolbox, Constraints, Behavior, Layout empty.
  L1["1 · Metamodel<br/>7 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/>6 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: 7 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: 6 items

The file

Download minimal-hierarchy.des (4,659 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/desl/schema/0.1/desl.schema.json#/$defs/Specification",
  "desl": "0.2",
  "doc": "DESL's smallest hierarchy (DESL 0.2, section 7.7): an outline of sections that hold tasks and further sections, with counted ids, tags whose colours the registration keeps, mentions in a description, notes about an entry, and a move to another section.",
  "language": { "id": "net.etalii.adp.example.outline", "version": "0.1.0", "origin": "example/outline", "label": "Outline" },
  "metamodel": {
    "document": {
      "attributes": {
        "lastSection": { "type": "string", "doc": "The last section id the counter gave (DESL section 5.3.5)." },
        "lastTask": { "type": "string", "doc": "The last task id the counter gave." }
      }
    },
    "types": {
      "Section": {
        "attributes": {
          "title": { "type": "string", "required": true },
          "description": { "type": "text", "mentions": { "pattern": "\\[(?:S|T)-\\d+\\]\\([^)]*\\)|\\[(?<id>(?:S|T)-\\d+)\\]", "types": ["Section", "Task"] } },
          "tags": { "type": "string", "many": true }
        },
        "children": { "allowed": ["Section", "Task"], "ordered": true },
        "labelAttribute": "title"
      },
      "Task": {
        "attributes": {
          "title": { "type": "string", "required": true },
          "description": { "type": "text", "mentions": { "pattern": "\\[(?:S|T)-\\d+\\]\\([^)]*\\)|\\[(?<id>(?:S|T)-\\d+)\\]", "types": ["Section", "Task"] } },
          "tags": { "type": "string", "many": true }
        },
        "labelAttribute": "title"
      },
      "Note": {
        "attributes": {
          "about": { "type": "string", "required": true, "mentions": { "pattern": "^(?<id>(?:S|T)-\\d+)$", "types": ["Section", "Task"] } },
          "kind": { "type": "NoteKind", "required": true },
          "text": { "type": "string" },
          "detail": { "type": "text" },
          "resolved": { "type": "bool", "default": false }
        },
        "labelAttribute": "text"
      },
      "Tag": {
        "attributes": {
          "name": { "type": "string", "required": true, "pattern": "^[^\\s:]+$" },
          "colour": { "type": "Colour", "default": "default" }
        },
        "labelAttribute": "name"
      }
    },
    "enums": {
      "NoteKind": { "values": { "question": { "value": "Question", "icon": "help-circle" }, "remark": { "value": "Remark", "icon": "comment" } } },
      "Colour": { "values": { "default": {}, "gray": {}, "red": {}, "green": {}, "blue": {} } }
    }
  },
  "persistence": {
    "format": "fbl",
    "bindings": ["minimal-hierarchy.fbl#markdown"],
    "typeMap": {
      "Marks": { "as": "document", "doc": "Line 2 of the file holds the last ids the counters gave." }
    },
    "ids": {
      "missing": "assign",
      "types": {
        "Section": { "strategy": "counter", "prefix": "S-", "digits": 4, "mark": "lastSection", "placeholder": "NEW" },
        "Task": { "strategy": "counter", "prefix": "T-", "digits": 4, "mark": "lastTask", "placeholder": "NEW" },
        "Note": { "strategy": "derived", "expression": "'note/' + string(self.positionIn(document.elementsOfType('Note')))", "ephemeral": true },
        "Tag": { "strategy": "derived", "expression": "'tag/' + self.name.lowerAscii()" }
      }
    },
    "settings": {
      "tags": { "type": "Tag", "key": "name", "value": "colour", "initial": [] }
    }
  },
  "surface": {
    "kind": "hierarchy",
    "levels": { "type": "Section", "title": "title", "description": "description" },
    "entries": { "type": "Task", "title": "title", "description": "description" },
    "labels": { "tags": { "on": ["Section", "Task"], "options": { "type": "Tag", "name": "name", "colour": "colour" }, "prefix": "#" } },
    "notes": { "type": "Note", "about": "about", "kind": "kind", "text": "text", "detail": "detail", "resolved": "resolved" },
    "ids": "shown"
  },
  "operations": {
    "addTask": {
      "label": "New task",
      "for": ["Section"],
      "actions": [{ "create": { "type": "'Task'", "parent": "self", "attributes": { "title": "'New task'" } } }]
    },
    "moveTask": {
      "label": "Move to section",
      "for": ["Task"],
      "params": { "section": { "type": "Section", "required": true } },
      "unavailable": [{ "when": "document.elementsOfType('Section').size() < 2", "message": "There is no other section to move it to." }],
      "actions": [{ "move": { "parent": "p.section" } }]
    },
    "resolveNote": {
      "label": { "cel": "self.resolved ? 'Reopen' : 'Resolve'" },
      "for": ["Note"],
      "actions": [{ "set": { "resolved": "!self.resolved" } }]
    }
  }
}

In an IDE

No IDE host runs this example yet.