Skip to content

Service calls

Example definition service-calls.dis: A small map of services and the calls between them, used to show where a relation type's flags come from (DISL 0.6, sections 4.7 and 4.9).

Views generated from the file

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

The file

Download service-calls.dis (3,689 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/disl/schema/0.2/disl.schema.json#/$defs/Specification",
  "disl": "0.6",
  "language": {
    "id": "org.example.service-calls",
    "version": "1.0.0",
    "label": "Service calls",
    "doc": {
      "summary": "A small map of services and the calls between them, used to show where a relation type's flags come from (DISL 0.6, sections 4.7 and 4.9).",
      "description": "Every call type inherits `allowParallel: false` and `allowSelfLoops: true` from the abstract `Call`, so one pair of services has at most one call of each kind, and a service may call itself. `TracedCall` has two supertypes whose flags differ, and states both flags itself, as it must. The definition `service-calls.did` beside it gives the two `std.endpoints` findings of `service-calls.findings.json`."
    }
  },
  "metamodel": {
    "types": {
      "Service": {
        "doc": "A service that calls others.",
        "attributes": {
          "name": { "type": "string", "required": true, "key": true }
        }
      }
    },
    "relations": {
      "Call": {
        "abstract": true,
        "doc": "A call from one service to another. It states `allowParallel: false`, so one pair has at most one call of each kind, and `allowSelfLoops: true`, so a service may call itself; every call type below inherits both (4.7). `directed` is the default, `true`.",
        "source": "Service",
        "target": "Service",
        "allowParallel": false,
        "allowSelfLoops": true
      },
      "SyncCall": {
        "doc": "A call that waits for its answer. It states no flag: `allowParallel: false` and `allowSelfLoops: true` come from `Call`, `directed: true` is the default.",
        "extends": "Call"
      },
      "AsyncCall": {
        "doc": "A call that does not wait. It states no flag: `allowParallel: false` and `allowSelfLoops: true` come from `Call`, `directed: true` is the default.",
        "extends": "Call"
      },
      "Observation": {
        "abstract": true,
        "doc": "One service observing another. It states no flag, so it has the defaults of section 4.9: `directed: true`, `allowSelfLoops: false`, `allowParallel: true`.",
        "source": "Service",
        "target": "Service"
      },
      "TracedCall": {
        "doc": "A synchronous call that is also observed. Its supertypes differ in two flags: `SyncCall` has `allowSelfLoops: true` and `allowParallel: false`, `Observation` has `false` and `true`. It must state both (4.7), and states each with the narrower value, `false`; `directed: true` is what both supertypes have.",
        "extends": ["SyncCall", "Observation"],
        "allowParallel": false,
        "allowSelfLoops": false
      }
    }
  },
  "notation": {
    "nodes": {
      "Service": {
        "shape": "roundedRect",
        "size": { "default": [140, 48] },
        "labels": [{ "id": "name", "text": { "attribute": "name" }, "position": "center", "editable": "inline" }]
      }
    },
    "edges": {
      "SyncCall": { "targetMarker": { "type": "arrowFilled" } },
      "AsyncCall": { "line": { "stroke": { "dash": [5, 4] } }, "targetMarker": { "type": "arrowOpen" } },
      "TracedCall": { "line": { "stroke": { "width": 2 } }, "targetMarker": { "type": "arrowFilled" } }
    }
  },
  "toolbox": {
    "groups": [
      {
        "id": "services",
        "label": "Services",
        "tools": [
          { "id": "service", "creates": "Service" },
          { "id": "syncCall", "creates": "SyncCall", "mode": "drag" },
          { "id": "asyncCall", "creates": "AsyncCall", "mode": "drag" },
          { "id": "tracedCall", "creates": "TracedCall", "mode": "drag" }
        ]
      }
    ]
  }
}

In an IDE

No IDE host runs this example yet.