LPG Modeler
Getting started

From an empty file to generated DDL

Install the extension, write eight lines of YAML, open the canvas beside it, and generate a schema. Nothing here needs a running database.

  1. Install the extension

    From the Extensions view in VS Code, search for LPG Modeler. Or from the command line:

    code --install-extension pavlyshyn.lpg-modeler

    To build it yourself instead, clone the repository and package it:

    git clone https://github.com/Volland/lpg-modeler
    cd lpg-modeler
    npm install
    npm run build
    npx @vscode/vsce package --no-dependencies # run inside packages/vscode

    Then install the resulting .vsix with Extensions: Install from VSIX… in the command palette.

  2. Create a model file

    The file name matters: the extension activates on *.lpg.yaml and *.lpg.yml. Create catalog.lpg.yaml with a namespace and one node type.

    namespace:
      prefix: catalog
      iri: https://example.org/vocab/catalog#
    
    nodes:
      Product:
        key: [sku]
        props:
          sku: { type: string, required: true }
          title: { type: string, required: true }
          price: { type: float }

    Completion and hover work immediately — the model format ships as a JSON Schema the extension contributes to the YAML tooling, so you get structural errors as you type.

    Every concrete node type needs a key. Validation fails without one, because LadybugDB refuses to create a node table with no primary key. A key declared once on an abstract parent covers every subtype.

  3. Open the canvas

    Run LPG: Open Canvas from the command palette. The diagram opens beside the file, with an ERD box per node type and one row per property.

    From there you can add a node type, add a property, rename in place, draw an edge by dragging from one box to another, set an abstract parent, and choose which key a type uses. Each of those becomes a targeted edit to the YAML — you will see the file change under the diagram.

    Typing in the YAML works the same way in reverse: the canvas redraws from the file on every keystroke. If the file stops being valid YAML mid-edit, the last good diagram stays on screen with a notice rather than blanking.

  4. Generate a schema

    Run LPG: Generate Schema and pick a target. The artifact is written next to the model and opened beside it:

    catalog.lpg.yaml       # yours
    catalog.ladybug.cypher # generated
    catalog.neo4j.cypher   # generated
    catalog.shacl.ttl      # generated
    catalog.owl.ttl        # generated

    If the target cannot enforce something the model asks for, you get a warning telling you how many downgrades occurred, a diagnostic per downgrade in the Problems panel, and a comment at the exact line of the artifact where the loss happens.

    A model with errors never produces an artifact at all.

  5. Split the diagram into views

    One diagram of a whole model stops being readable somewhere past a few dozen types. Create a view from the canvas, or write the sidecar by hand as catalog.views.yaml:

    views:
      overview:
        include: ["*"]
      pricing:
        include: ["Product", "PriceBand"]
        expand: 1   # also pull in immediate neighbours

    Validation reports any type that has fallen out of every view, so diagrams do not quietly stop covering the model as it grows.

  6. Check it in CI

    The command line tool runs the same resolution and validation as the editor, with no editor present:

    npx @lpg/cli check catalog.lpg.yaml
    npx @lpg/cli emit  catalog.lpg.yaml --target ladybug --out ./schema

    check exits non-zero when the model has errors, so a pull request can be gated on schema validity. See the CLI reference for every flag.


Commands and settings

CommandWhat it does
LPG: Open CanvasOpens the diagram beside the active model file. Requires a .lpg.yaml file in the active editor.
LPG: Generate SchemaPrompts for a target and writes the artifact next to the model.
SettingDefaultEffect
lpg.targets.neo4j.edition community Community cannot enforce existence or node key constraints, so under it those are reported as downgrades and emitted as comments. Set to enterprise to emit them for real.

Where to go next