Documentation · Structure
Package diagram
Declare the packages, nesting each inside the package that holds it, then the dependencies between them. A package that holds others has its name in its tab.
When to use it
Show how a system is organised into packages, which packages hold which, and how they depend on one another: the layers of an application, a codebase's modules or a model's namespaces.
Nest a package inside another to say it belongs there, and draw dependencies only between packages that do not hold each other. A dependency points from the package that needs another to the one it needs.
Working example
Copy this complete example into the Source tab, then press Generate. Change its labels or values to make your first version.
package "Online Shop" {
package WEB "Web front end" {
package PAGES "Pages"
package WIDGETS "Components"
PAGES -> WIDGETS
}
package APP "Application" {
package ORDER "Ordering"
package PAY "Payments"
package CAT "Catalogue"
ORDER -> CAT
ORDER -> PAY
}
package DATA "Persistence"
package GATEWAY "Payment gateway"
import PAGES -> ORDER
import ORDER -> DATA
access CAT -> DATA
use PAY -> GATEWAY
}Syntax reference
The same reference used by the editor and AI briefing. Syntax is notation-specific; use the keywords listed here.
Diagram
| Syntax | Meaning |
|---|---|
package "Title" { | open a UML package diagram |
Packages
| Syntax | Meaning |
|---|---|
package ID "Name" | a package that holds nothing; its name in its body |
package ID "Name" { ... } | a package holding the packages declared inside; its name in its tab |
Dependencies
| Syntax | Meaning |
|---|---|
A -> B | A depends on B (dashed, open arrow); also A -.-> B |
import A -> B | «import»: A uses B's public names |
access A -> B | «access»: A imports B privately |
merge A -> B | «merge»: B's contents are merged into A |
use A -> B | «use»: A needs B to work |
A -> B "«call»" | a dependency with words of your own |
# comment | line comment (also //) |
Language rules
- The file is one package "Title" { ... } block.
- A package is package ID "Name". To nest packages inside it, open a block after its name and declare them there: package APP "Application" { package ORDER "Ordering" }. Nest as deep as you need.
- A dependency points from the package that needs another to the one it needs: UI -> APP. Write import, access, merge or use before it for those kinds; the keyword is written on the line for you. A quoted caption after the second package replaces it.
- Dependencies may be written inside a package's block or at the end, between packages nested anywhere, but never between a package and one it holds, or a package and itself.
- Declare every package once, with a unique ID, before or after the dependencies that name it.
Edit on the canvas
- Move a package and what it holds moves with it; double-click to step inside and move or rename a package it holds.
- Draw a dependency, an import, an access, a merge or a use from the connector rail; its keyword is written on it.
Generate replaces the drawing from source. Save before generating again if you want to preserve manual finishing touches.
Read Saving & exportingWrite it with an assistant
Tingraph AI already knows this notation. For another assistant, copy the tutorial below, describe your diagram under MY DIAGRAM, then paste the returned source into the editor. This prompt includes every syntax row, rule and working example above.
Read the complete prompt
You are writing Tingraph source. Tingraph is a small text language that draws a UML package diagram. Answer with Tingraph source only.
SYNTAX
Diagram
package "Title" { open a UML package diagram
Packages
package ID "Name" a package that holds nothing; its name in its body
package ID "Name" { ... } a package holding the packages declared inside; its name in its tab
Dependencies
A -> B A depends on B (dashed, open arrow); also A -.-> B
import A -> B «import»: A uses B's public names
access A -> B «access»: A imports B privately
merge A -> B «merge»: B's contents are merged into A
use A -> B «use»: A needs B to work
A -> B "«call»" a dependency with words of your own
# comment line comment (also //)
RULES
- The file is one `package "Title" { ... }` block.
- A package is `package ID "Name"`. To nest packages inside it, open a block after its name and declare them there: `package APP "Application" { package ORDER "Ordering" }`. Nest as deep as you need.
- A dependency points from the package that needs another to the one it needs: `UI -> APP`. Write `import`, `access`, `merge` or `use` before it for those kinds; the keyword is written on the line for you. A quoted caption after the second package replaces it.
- Dependencies may be written inside a package's block or at the end, between packages nested anywhere, but never between a package and one it holds, or a package and itself.
- Declare every package once, with a unique ID, before or after the dependencies that name it.
WORKED EXAMPLE
package "Online Shop" {
package WEB "Web front end" {
package PAGES "Pages"
package WIDGETS "Components"
PAGES -> WIDGETS
}
package APP "Application" {
package ORDER "Ordering"
package PAY "Payments"
package CAT "Catalogue"
ORDER -> CAT
ORDER -> PAY
}
package DATA "Persistence"
package GATEWAY "Payment gateway"
import PAGES -> ORDER
import ORDER -> DATA
access CAT -> DATA
use PAY -> GATEWAY
}
OUTPUT
- Reply with one fenced code block and nothing else.
- The block starts with `package "…" {` and ends with `}`.
- Do not invent keywords: use only the ones listed above.
- Keep labels short enough to read inside a box, and keep every ID unique.
MY DIAGRAM
Describe what you want here, then send this message.Something unclear? Contact support or read the Privacy Policy.