Skip to content

Placeholder tasks

Example definition placeholder-tasks.dis: Tasks and what each waits for, used to show a relation's end resolving to a derived node (DISL 0.8, 4.9).

Views generated from the file

These views are drawn by this site from placeholder-tasks.dis 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 Placeholder tasks example. Class diagram of placeholder-tasks.dis: 2 node types (Task, Placeholder) and 1 relation types (Dependency), with their typed attributes, inheritance, containment and relation ends.
Generated from placeholder-tasks.dis at 10c1ea0
Diagram as text (Mermaid)
classDiagram
  accTitle: Metamodel of the Placeholder tasks example
  accDescr: Class diagram of placeholder-tasks.dis: 2 node types (Task, Placeholder) and 1 relation types (Dependency), with their typed attributes, inheritance, containment and relation ends.
  class Task {
    +string name
  }
  class Placeholder {
  }
  class Dependency {
    <<relation>>
    +string upstream
  }
  Task <|-- Placeholder
  Dependency --> Task : source
  Dependency --> Task : target
Layers of placeholder-tasks.dis. The eight DISL layers in order. placeholder-tasks.dis fills 2 of them: Metamodel (3 items), Constraints (2 items). It leaves Coordinates, Notation, Toolbox, Behavior, Layout, Persistence empty.
Generated from placeholder-tasks.dis at 10c1ea0
Diagram as text (Mermaid)
flowchart LR
  accTitle: Layers of placeholder-tasks.dis
  accDescr: The eight DISL layers in order. placeholder-tasks.dis fills 2 of them: Metamodel (3 items), Constraints (2 items). It leaves Coordinates, Notation, Toolbox, Behavior, Layout, Persistence empty.
  L1["1 · Metamodel<br/>3 items"]
  L2["2 · Coordinate systems, placement and snapping<br/>not used"]
  L3["3 · Notation (visual definition)<br/>not used"]
  L4["4 · Toolbox, context tools and forms<br/>not used"]
  L5["5 · Constraints<br/>2 items"]
  L6["6 · Behavior<br/>not used"]
  L7["7 · Layout<br/>not used"]
  L8["8 · Persistence<br/>not used"]
  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 empty

The file

Download placeholder-tasks.dis (2,039 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/disl/schema/0.2/disl.schema.json#/$defs/Specification",
  "disl": "0.8",
  "language": {
    "id": "org.example.placeholder-tasks",
    "version": "1.0.0",
    "label": "Placeholder tasks",
    "doc": {
      "summary": "Tasks and what each waits for, used to show a relation's end resolving to a derived node (DISL 0.8, 4.9).",
      "description": "A dependency on a task nobody declares names no stored element, and `Placeholder` derives one node for each such name, under that id. The dependency's source is then that node, so its edge is drawn, and the rule `declaredUpstream` tells it from a stored source by `derived`."
    }
  },
  "metamodel": {
    "types": {
      "Task": {
        "doc": "A task of the plan.",
        "attributes": {
          "name": { "type": "string", "required": true, "key": true }
        }
      },
      "Placeholder": {
        "extends": "Task",
        "doc": "One per name a dependency states and no task has.",
        "derived": {
          "from": "diagram.relationsOfType('Dependency').filter(d, !has(d.source))",
          "key": "item.upstream",
          "id": "item.upstream",
          "attributes": { "name": "item.upstream" },
          "reason": "This task is not declared; declare it, or remove the dependency."
        }
      }
    },
    "relations": {
      "Dependency": {
        "doc": "From the task waited for to the task that waits. `upstream` keeps the name as written.",
        "source": "Task",
        "target": "Task",
        "attributes": {
          "upstream": { "type": "string", "required": true }
        }
      }
    }
  },
  "constraints": {
    "builtIn": {
      "std.references": { "enabled": false }
    },
    "rules": [
      {
        "id": "declaredUpstream",
        "scope": "Dependency",
        "rule": "has(self.source) && !self.source.derived",
        "severity": "error",
        "message": { "cel": "self.target.name + ' waits for ' + self.upstream + ', which is not declared.'" }
      }
    ]
  }
}

In an IDE

No IDE host runs this example yet.