sirena 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/build_deploy.yml +59 -0
- data/.github/workflows/links.yml +85 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +27 -0
- data/.gitignore +68 -0
- data/.rspec +3 -0
- data/.rubocop.yml +14 -0
- data/.rubocop_todo.yml +70 -0
- data/ARCHITECTURE.md +744 -0
- data/Gemfile +12 -0
- data/LICENSE +25 -0
- data/README.adoc +357 -0
- data/Rakefile +11 -0
- data/docs/.gitignore +1 -0
- data/docs/Gemfile +13 -0
- data/docs/_config.yml +182 -0
- data/docs/_diagram_types/architecture-diagram.adoc +314 -0
- data/docs/_diagram_types/block-diagram.adoc +345 -0
- data/docs/_diagram_types/c4-diagram.adoc +559 -0
- data/docs/_diagram_types/class-diagram.adoc +816 -0
- data/docs/_diagram_types/er-diagram.adoc +719 -0
- data/docs/_diagram_types/error-diagram.adoc +114 -0
- data/docs/_diagram_types/examples/flowchart-examples.adoc +29 -0
- data/docs/_diagram_types/flowchart.adoc +488 -0
- data/docs/_diagram_types/gantt-chart.adoc +502 -0
- data/docs/_diagram_types/git-graph.adoc +600 -0
- data/docs/_diagram_types/index.adoc +192 -0
- data/docs/_diagram_types/info-diagram.adoc +103 -0
- data/docs/_diagram_types/kanban-diagram.adoc +262 -0
- data/docs/_diagram_types/mindmap.adoc +603 -0
- data/docs/_diagram_types/packet-diagram.adoc +378 -0
- data/docs/_diagram_types/pie-chart.adoc +335 -0
- data/docs/_diagram_types/quadrant-chart.adoc +406 -0
- data/docs/_diagram_types/radar-chart.adoc +528 -0
- data/docs/_diagram_types/requirement-diagram.adoc +416 -0
- data/docs/_diagram_types/sankey-diagram.adoc +357 -0
- data/docs/_diagram_types/sequence-diagram.adoc +664 -0
- data/docs/_diagram_types/state-diagram.adoc +658 -0
- data/docs/_diagram_types/timeline.adoc +352 -0
- data/docs/_diagram_types/treemap-diagram.adoc +462 -0
- data/docs/_diagram_types/user-journey.adoc +602 -0
- data/docs/_features/index.adoc +129 -0
- data/docs/_guides/cli-reference.adoc +203 -0
- data/docs/_guides/index.adoc +56 -0
- data/docs/_guides/installation.adoc +100 -0
- data/docs/_guides/quick-start.adoc +132 -0
- data/docs/_pages/comparison.adoc +441 -0
- data/docs/_pages/compatibility.adoc +300 -0
- data/docs/_pages/index.adoc +39 -0
- data/docs/_references/index.adoc +103 -0
- data/docs/_tutorials/index.adoc +57 -0
- data/docs/index.adoc +166 -0
- data/docs/lychee.toml +54 -0
- data/examples/.gitignore +10 -0
- data/examples/README.adoc +196 -0
- data/examples/README.md +64 -0
- data/examples/architecture/01-basic-services.mmd +9 -0
- data/examples/architecture/01-basic-services.svg +37 -0
- data/examples/architecture/02-service-groups.mmd +16 -0
- data/examples/architecture/02-service-groups.svg +55 -0
- data/examples/architecture/README.adoc +79 -0
- data/examples/block/01-basic-blocks.mmd +13 -0
- data/examples/block/01-basic-blocks.svg +44 -0
- data/examples/block/02-block-shapes.mmd +13 -0
- data/examples/block/02-block-shapes.svg +47 -0
- data/examples/block/README.adoc +85 -0
- data/examples/c4/01-context-diagram.mmd +10 -0
- data/examples/c4/01-context-diagram.svg +45 -0
- data/examples/c4/02-container-diagram.mmd +24 -0
- data/examples/c4/02-container-diagram.svg +105 -0
- data/examples/c4/README.adoc +92 -0
- data/examples/class_diagram/01-basic-classes.mmd +61 -0
- data/examples/class_diagram/01-basic-classes.svg +117 -0
- data/examples/class_diagram/02-relationships.mmd +61 -0
- data/examples/class_diagram/02-relationships.svg +129 -0
- data/examples/class_diagram/README.adoc +93 -0
- data/examples/er_diagram/01-basic-entities.mmd +64 -0
- data/examples/er_diagram/01-basic-entities.svg +5 -0
- data/examples/er_diagram/02-cardinality.mmd +57 -0
- data/examples/er_diagram/02-cardinality.svg +125 -0
- data/examples/er_diagram/README.adoc +88 -0
- data/examples/error/01-basic-error.mmd +1 -0
- data/examples/error/01-basic-error.svg +13 -0
- data/examples/error/02-error-display.mmd +1 -0
- data/examples/error/02-error-display.svg +13 -0
- data/examples/error/README.adoc +71 -0
- data/examples/error_message_example.svg +13 -0
- data/examples/flowchart/00-original.mmd +13 -0
- data/examples/flowchart/00-original.svg +5 -0
- data/examples/flowchart/01-basic-flow.mmd +7 -0
- data/examples/flowchart/01-basic-flow.svg +52 -0
- data/examples/flowchart/01-basic-flow.yml +13 -0
- data/examples/flowchart/02*.svg +87 -0
- data/examples/flowchart/02-node-shapes.mmd +9 -0
- data/examples/flowchart/02-node-shapes.svg +33 -0
- data/examples/flowchart/03-edge-types.mmd +7 -0
- data/examples/flowchart/03-edge-types.svg +53 -0
- data/examples/flowchart/04-subgraphs.mmd +9 -0
- data/examples/flowchart/04-subgraphs.svg +33 -0
- data/examples/flowchart/05-styling.mmd +9 -0
- data/examples/flowchart/05-styling.svg +33 -0
- data/examples/flowchart/06-complex-flow.mmd +8 -0
- data/examples/flowchart/06-complex-flow.svg +59 -0
- data/examples/flowchart/README.adoc +167 -0
- data/examples/gantt/01-simple-timeline.* +14 -0
- data/examples/gantt/01-simple-timeline.mmd +6 -0
- data/examples/gantt/01-simple-timeline.svg +26 -0
- data/examples/gantt/02-task-dependencies.mmd +6 -0
- data/examples/gantt/02-task-dependencies.svg +26 -0
- data/examples/gantt/README.adoc +86 -0
- data/examples/git_graph/01-linear-history.mmd +12 -0
- data/examples/git_graph/01-linear-history.svg +26 -0
- data/examples/git_graph/02-branching.mmd +12 -0
- data/examples/git_graph/02-branching.svg +26 -0
- data/examples/git_graph/README.adoc +73 -0
- data/examples/info/02-showinfo.mmd +1 -0
- data/examples/info/02-showinfo.svg +10 -0
- data/examples/info/README.adoc +58 -0
- data/examples/info_showinfo_example.svg +10 -0
- data/examples/kanban/01-simple-board.mmd +8 -0
- data/examples/kanban/01-simple-board.svg +43 -0
- data/examples/kanban/02-workflow.mmd +8 -0
- data/examples/kanban/02-workflow.svg +43 -0
- data/examples/kanban/README.adoc +79 -0
- data/examples/mindmap/01-simple-tree.mmd +19 -0
- data/examples/mindmap/01-simple-tree.svg +61 -0
- data/examples/mindmap/02-knowledge-map.mmd +19 -0
- data/examples/mindmap/02-knowledge-map.svg +61 -0
- data/examples/mindmap/README.adoc +77 -0
- data/examples/packet/01-basic-packet.* +17 -0
- data/examples/packet/01-basic-packet.mmd +4 -0
- data/examples/packet/01-basic-packet.svg +82 -0
- data/examples/packet/README.adoc +58 -0
- data/examples/pie/01-simple-chart.mmd +5 -0
- data/examples/pie/01-simple-chart.svg +17 -0
- data/examples/pie/02-labeled-slices.mmd +6 -0
- data/examples/pie/02-labeled-slices.svg +19 -0
- data/examples/pie/README.adoc +75 -0
- data/examples/quadrant/01-basic-quadrant.mmd +13 -0
- data/examples/quadrant/01-basic-quadrant.svg +33 -0
- data/examples/quadrant/02-positioned-items.mmd +14 -0
- data/examples/quadrant/02-positioned-items.svg +35 -0
- data/examples/quadrant/README.adoc +84 -0
- data/examples/radar/01-simple-radar.* +5 -0
- data/examples/radar/01-simple-radar.mmd +3 -0
- data/examples/radar/01-simple-radar.svg +25 -0
- data/examples/radar/02-multiple-curves.mmd +4 -0
- data/examples/radar/02-multiple-curves.svg +43 -0
- data/examples/radar/README.adoc +75 -0
- data/examples/requirement/01-basic-requirements.mmd +23 -0
- data/examples/requirement/01-basic-requirements.svg +49 -0
- data/examples/requirement/02-risk-levels.mmd +23 -0
- data/examples/requirement/02-risk-levels.svg +49 -0
- data/examples/requirement/README.adoc +85 -0
- data/examples/sankey/01-simple-flow.mmd +7 -0
- data/examples/sankey/01-simple-flow.svg +34 -0
- data/examples/sankey/02-multi-stage.mmd +11 -0
- data/examples/sankey/02-multi-stage.svg +44 -0
- data/examples/sankey/README.adoc +74 -0
- data/examples/sequence/01-basic-sequence.mmd +27 -0
- data/examples/sequence/01-basic-sequence.svg +5 -0
- data/examples/sequence/02-activations.mmd +17 -0
- data/examples/sequence/02-activations.svg +78 -0
- data/examples/sequence/README.adoc +86 -0
- data/examples/state_diagram/01-simple-states.mmd +29 -0
- data/examples/state_diagram/01-simple-states.svg +5 -0
- data/examples/state_diagram/02-composite.mmd +19 -0
- data/examples/state_diagram/02-composite.svg +81 -0
- data/examples/state_diagram/README.adoc +90 -0
- data/examples/timeline/01-simple-timeline.mmd +11 -0
- data/examples/timeline/01-simple-timeline.svg +36 -0
- data/examples/timeline/02-periods.mmd +15 -0
- data/examples/timeline/02-periods.svg +47 -0
- data/examples/timeline/README.adoc +78 -0
- data/examples/treemap/01-basic-treemap.mmd +12 -0
- data/examples/treemap/01-basic-treemap.svg +59 -0
- data/examples/treemap/README.adoc +59 -0
- data/examples/user_journey/01-simple-journey.mmd +23 -0
- data/examples/user_journey/01-simple-journey.svg +5 -0
- data/examples/user_journey/02-multi-actor.mmd +18 -0
- data/examples/user_journey/02-multi-actor.svg +129 -0
- data/examples/user_journey/README.adoc +81 -0
- data/examples/xychart/01-line-chart.mmd +5 -0
- data/examples/xychart/01-line-chart.svg +43 -0
- data/examples/xychart/02-bar-chart.mmd +7 -0
- data/examples/xychart/02-bar-chart.svg +48 -0
- data/examples/xychart/README.adoc +80 -0
- data/exe/sirena +7 -0
- data/lib/sirena/cli.rb +138 -0
- data/lib/sirena/commands/batch.rb +117 -0
- data/lib/sirena/commands/render.rb +80 -0
- data/lib/sirena/commands/types.rb +29 -0
- data/lib/sirena/commands/version.rb +24 -0
- data/lib/sirena/diagram/architecture.rb +46 -0
- data/lib/sirena/diagram/base.rb +61 -0
- data/lib/sirena/diagram/block.rb +81 -0
- data/lib/sirena/diagram/c4.rb +328 -0
- data/lib/sirena/diagram/class_diagram.rb +385 -0
- data/lib/sirena/diagram/er_diagram.rb +238 -0
- data/lib/sirena/diagram/error.rb +38 -0
- data/lib/sirena/diagram/flowchart.rb +160 -0
- data/lib/sirena/diagram/gantt.rb +71 -0
- data/lib/sirena/diagram/git_graph.rb +36 -0
- data/lib/sirena/diagram/info.rb +38 -0
- data/lib/sirena/diagram/kanban.rb +178 -0
- data/lib/sirena/diagram/mindmap.rb +54 -0
- data/lib/sirena/diagram/packet.rb +79 -0
- data/lib/sirena/diagram/pie.rb +115 -0
- data/lib/sirena/diagram/quadrant.rb +138 -0
- data/lib/sirena/diagram/radar.rb +52 -0
- data/lib/sirena/diagram/requirement.rb +133 -0
- data/lib/sirena/diagram/sankey.rb +217 -0
- data/lib/sirena/diagram/sequence.rb +242 -0
- data/lib/sirena/diagram/state_diagram.rb +237 -0
- data/lib/sirena/diagram/timeline.rb +171 -0
- data/lib/sirena/diagram/treemap.rb +84 -0
- data/lib/sirena/diagram/user_journey.rb +149 -0
- data/lib/sirena/diagram/xy_chart.rb +76 -0
- data/lib/sirena/diagram.rb +8 -0
- data/lib/sirena/diagram_registry.rb +101 -0
- data/lib/sirena/engine.rb +292 -0
- data/lib/sirena/parser/architecture.rb +41 -0
- data/lib/sirena/parser/base.rb +41 -0
- data/lib/sirena/parser/block.rb +72 -0
- data/lib/sirena/parser/c4.rb +53 -0
- data/lib/sirena/parser/class_diagram.rb +63 -0
- data/lib/sirena/parser/er_diagram.rb +40 -0
- data/lib/sirena/parser/error.rb +49 -0
- data/lib/sirena/parser/flowchart.rb +71 -0
- data/lib/sirena/parser/gantt.rb +60 -0
- data/lib/sirena/parser/git_graph.rb +95 -0
- data/lib/sirena/parser/grammars/architecture.rb +145 -0
- data/lib/sirena/parser/grammars/block.rb +190 -0
- data/lib/sirena/parser/grammars/c4.rb +226 -0
- data/lib/sirena/parser/grammars/class_diagram.rb +284 -0
- data/lib/sirena/parser/grammars/common.rb +84 -0
- data/lib/sirena/parser/grammars/er_diagram.rb +114 -0
- data/lib/sirena/parser/grammars/error.rb +40 -0
- data/lib/sirena/parser/grammars/flowchart.rb +298 -0
- data/lib/sirena/parser/grammars/gantt.rb +252 -0
- data/lib/sirena/parser/grammars/git_graph.rb +167 -0
- data/lib/sirena/parser/grammars/info.rb +58 -0
- data/lib/sirena/parser/grammars/kanban.rb +83 -0
- data/lib/sirena/parser/grammars/mindmap.rb +115 -0
- data/lib/sirena/parser/grammars/packet.rb +73 -0
- data/lib/sirena/parser/grammars/pie.rb +128 -0
- data/lib/sirena/parser/grammars/quadrant.rb +199 -0
- data/lib/sirena/parser/grammars/radar.rb +150 -0
- data/lib/sirena/parser/grammars/requirement.rb +188 -0
- data/lib/sirena/parser/grammars/sankey.rb +104 -0
- data/lib/sirena/parser/grammars/sequence.rb +247 -0
- data/lib/sirena/parser/grammars/state_diagram.rb +172 -0
- data/lib/sirena/parser/grammars/timeline.rb +142 -0
- data/lib/sirena/parser/grammars/treemap.rb +120 -0
- data/lib/sirena/parser/grammars/xy_chart.rb +120 -0
- data/lib/sirena/parser/info.rb +49 -0
- data/lib/sirena/parser/kanban.rb +97 -0
- data/lib/sirena/parser/mindmap.rb +106 -0
- data/lib/sirena/parser/packet.rb +76 -0
- data/lib/sirena/parser/pie.rb +49 -0
- data/lib/sirena/parser/quadrant.rb +57 -0
- data/lib/sirena/parser/radar.rb +104 -0
- data/lib/sirena/parser/requirement.rb +70 -0
- data/lib/sirena/parser/sankey.rb +64 -0
- data/lib/sirena/parser/sequence.rb +51 -0
- data/lib/sirena/parser/state_diagram.rb +69 -0
- data/lib/sirena/parser/timeline.rb +57 -0
- data/lib/sirena/parser/transforms/architecture.rb +97 -0
- data/lib/sirena/parser/transforms/block.rb +254 -0
- data/lib/sirena/parser/transforms/c4.rb +347 -0
- data/lib/sirena/parser/transforms/class_diagram.rb +352 -0
- data/lib/sirena/parser/transforms/er_diagram.rb +169 -0
- data/lib/sirena/parser/transforms/error.rb +58 -0
- data/lib/sirena/parser/transforms/flowchart.rb +293 -0
- data/lib/sirena/parser/transforms/gantt.rb +215 -0
- data/lib/sirena/parser/transforms/git_graph.rb +160 -0
- data/lib/sirena/parser/transforms/info.rb +58 -0
- data/lib/sirena/parser/transforms/kanban.rb +176 -0
- data/lib/sirena/parser/transforms/mindmap.rb +227 -0
- data/lib/sirena/parser/transforms/packet.rb +63 -0
- data/lib/sirena/parser/transforms/pie.rb +143 -0
- data/lib/sirena/parser/transforms/quadrant.rb +177 -0
- data/lib/sirena/parser/transforms/radar.rb +126 -0
- data/lib/sirena/parser/transforms/requirement.rb +272 -0
- data/lib/sirena/parser/transforms/sankey.rb +122 -0
- data/lib/sirena/parser/transforms/sequence.rb +342 -0
- data/lib/sirena/parser/transforms/state_diagram.rb +292 -0
- data/lib/sirena/parser/transforms/timeline.rb +177 -0
- data/lib/sirena/parser/transforms/treemap.rb +81 -0
- data/lib/sirena/parser/transforms/xy_chart.rb +132 -0
- data/lib/sirena/parser/treemap.rb +98 -0
- data/lib/sirena/parser/user_journey.rb +120 -0
- data/lib/sirena/parser/xy_chart.rb +114 -0
- data/lib/sirena/parser.rb +8 -0
- data/lib/sirena/renderer/architecture.rb +251 -0
- data/lib/sirena/renderer/base.rb +251 -0
- data/lib/sirena/renderer/block.rb +286 -0
- data/lib/sirena/renderer/c4.rb +490 -0
- data/lib/sirena/renderer/class_diagram.rb +499 -0
- data/lib/sirena/renderer/er_diagram.rb +417 -0
- data/lib/sirena/renderer/error.rb +131 -0
- data/lib/sirena/renderer/flowchart.rb +301 -0
- data/lib/sirena/renderer/gantt.rb +331 -0
- data/lib/sirena/renderer/git_graph.rb +368 -0
- data/lib/sirena/renderer/info.rb +93 -0
- data/lib/sirena/renderer/kanban.rb +295 -0
- data/lib/sirena/renderer/mindmap.rb +396 -0
- data/lib/sirena/renderer/packet.rb +239 -0
- data/lib/sirena/renderer/pie.rb +235 -0
- data/lib/sirena/renderer/quadrant.rb +292 -0
- data/lib/sirena/renderer/radar.rb +323 -0
- data/lib/sirena/renderer/requirement.rb +371 -0
- data/lib/sirena/renderer/sankey.rb +255 -0
- data/lib/sirena/renderer/sequence.rb +424 -0
- data/lib/sirena/renderer/state_diagram.rb +328 -0
- data/lib/sirena/renderer/timeline.rb +304 -0
- data/lib/sirena/renderer/treemap.rb +152 -0
- data/lib/sirena/renderer/user_journey.rb +331 -0
- data/lib/sirena/renderer/xy_chart.rb +452 -0
- data/lib/sirena/renderer.rb +8 -0
- data/lib/sirena/svg/circle.rb +41 -0
- data/lib/sirena/svg/document.rb +103 -0
- data/lib/sirena/svg/element.rb +65 -0
- data/lib/sirena/svg/ellipse.rb +33 -0
- data/lib/sirena/svg/group.rb +71 -0
- data/lib/sirena/svg/line.rb +49 -0
- data/lib/sirena/svg/path.rb +76 -0
- data/lib/sirena/svg/polygon.rb +43 -0
- data/lib/sirena/svg/polyline.rb +35 -0
- data/lib/sirena/svg/rect.rb +57 -0
- data/lib/sirena/svg/style.rb +44 -0
- data/lib/sirena/svg/text.rb +72 -0
- data/lib/sirena/svg.rb +19 -0
- data/lib/sirena/text_measurement.rb +71 -0
- data/lib/sirena/theme/builtin/dark.yml +70 -0
- data/lib/sirena/theme/builtin/default.yml +80 -0
- data/lib/sirena/theme/builtin/high_contrast.yml +70 -0
- data/lib/sirena/theme/builtin/light.yml +70 -0
- data/lib/sirena/theme/color_palette.rb +48 -0
- data/lib/sirena/theme/effect_styles.rb +28 -0
- data/lib/sirena/theme/registry.rb +41 -0
- data/lib/sirena/theme/shape_styles.rb +28 -0
- data/lib/sirena/theme/spacing_config.rb +24 -0
- data/lib/sirena/theme/typography.rb +30 -0
- data/lib/sirena/theme.rb +69 -0
- data/lib/sirena/transform/architecture.rb +273 -0
- data/lib/sirena/transform/base.rb +199 -0
- data/lib/sirena/transform/block.rb +215 -0
- data/lib/sirena/transform/c4.rb +288 -0
- data/lib/sirena/transform/class_diagram.rb +296 -0
- data/lib/sirena/transform/er_diagram.rb +204 -0
- data/lib/sirena/transform/error.rb +39 -0
- data/lib/sirena/transform/flowchart.rb +161 -0
- data/lib/sirena/transform/gantt.rb +253 -0
- data/lib/sirena/transform/git_graph.rb +283 -0
- data/lib/sirena/transform/info.rb +39 -0
- data/lib/sirena/transform/kanban.rb +180 -0
- data/lib/sirena/transform/mindmap.rb +251 -0
- data/lib/sirena/transform/packet.rb +185 -0
- data/lib/sirena/transform/pie.rb +62 -0
- data/lib/sirena/transform/quadrant.rb +167 -0
- data/lib/sirena/transform/radar.rb +227 -0
- data/lib/sirena/transform/requirement.rb +233 -0
- data/lib/sirena/transform/sankey.rb +212 -0
- data/lib/sirena/transform/sequence.rb +143 -0
- data/lib/sirena/transform/state_diagram.rb +228 -0
- data/lib/sirena/transform/timeline.rb +139 -0
- data/lib/sirena/transform/treemap.rb +120 -0
- data/lib/sirena/transform/user_journey.rb +207 -0
- data/lib/sirena/transform/xy_chart.rb +273 -0
- data/lib/sirena/transform.rb +8 -0
- data/lib/sirena/version.rb +5 -0
- data/lib/sirena.rb +328 -0
- data/lib/tasks/benchmark.rake +532 -0
- data/lib/tasks/examples.rake +468 -0
- data/lib/tasks/generate_mermaid_fixtures.rake +363 -0
- data/lib/tasks/mermaid_fixtures.rake +46 -0
- data/scripts/extract_mermaid_tests.rb +493 -0
- data/scripts/rename_to_sirena.rb +73 -0
- data/sirena.gemspec +47 -0
- metadata +529 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="811.0"
|
|
3
|
+
height="674.0"
|
|
4
|
+
viewBox="0 0 811.0 674"
|
|
5
|
+
version="1.2"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<g id="defs"/>
|
|
9
|
+
<g id="rel-Mammal_to_Animal">
|
|
10
|
+
<line stroke="#000000" stroke-width="2" x1="300.0" y1="127.56420233463035" x2="196.0" y2="147.7976653696498"/>
|
|
11
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="196.0,147.7976653696498 205.4557258882203,151.0517778334163 203.5460070045035,141.2358227711121"/>
|
|
12
|
+
</g>
|
|
13
|
+
<g id="rel-Bird_to_Animal">
|
|
14
|
+
<line stroke="#000000" stroke-width="2" x1="550.0" y1="120.74396135265701" x2="196.0" y2="154.94685990338164"/>
|
|
15
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="196.0,154.94685990338164 205.10096526003713,159.09082314351747 204.1392600683251,149.13717440929776"/>
|
|
16
|
+
</g>
|
|
17
|
+
<g id="rel-Dog_to_Mammal">
|
|
18
|
+
<line stroke="#000000" stroke-width="2" x1="196.0" y1="262.35019455252916" x2="300.0" y2="177.36964980544747"/>
|
|
19
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="300,177.36964980544747 290.13011958355173,178.9775865470548 296.4575738576862,186.7211853492099"/>
|
|
20
|
+
</g>
|
|
21
|
+
<g id="rel-Cat_to_Mammal">
|
|
22
|
+
<line stroke="#000000" stroke-width="2" x1="373.72727272727275" y1="250.0" x2="377.1818181818182" y2="174.0"/>
|
|
23
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="377.1818181818182,174 371.7937336019469,182.4242830294425 381.7834190040499,182.878359638629"/>
|
|
24
|
+
</g>
|
|
25
|
+
<g id="rel-Eagle_to_Bird">
|
|
26
|
+
<line stroke="#000000" stroke-width="2" x1="629.0" y1="250.0" x2="635.3333333333334" y2="174.0"/>
|
|
27
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="635.3333333333334,174 629.631409589881,182.21511202746822 639.5968671723297,183.04556682600563"/>
|
|
28
|
+
</g>
|
|
29
|
+
<g id="rel-Penguin_to_Bird">
|
|
30
|
+
<line stroke="#000000" stroke-width="2" x1="190.0" y1="458.20557156580213" x2="550.0" y2="181.54851104707012"/>
|
|
31
|
+
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="550,181.54851104707012 540.0865104828309,182.8610374631773 546.1799364609025,190.79010801714284"/>
|
|
32
|
+
</g>
|
|
33
|
+
<g id="rel-Owner_to_Animal">
|
|
34
|
+
<line stroke="#000000" stroke-width="2" x1="334.2" y1="450.0" x2="205.13333333333333" y2="274.0"/>
|
|
35
|
+
<text fill="#000000" x="269.66666666666663" y="357.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">owns</text>
|
|
36
|
+
<text fill="#000000" x="339.2" y="445.0" font-family="Arial, sans-serif" font-size="10">1</text>
|
|
37
|
+
<text fill="#000000" x="200.13333333333333" y="269.0" text-anchor="end" font-family="Arial, sans-serif" font-size="10">*</text>
|
|
38
|
+
</g>
|
|
39
|
+
<g id="class-Animal">
|
|
40
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="50.0" y="50.0" width="146.0" height="224.0" rx="3.0" ry="3.0"/>
|
|
41
|
+
<text fill="#000000" x="123.0" y="60.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Animal</text>
|
|
42
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="83.0" x2="196.0" y2="83.0"/>
|
|
43
|
+
<text fill="#000000" x="60.0" y="93.0" font-family="monospace" font-size="12">+ name: String</text>
|
|
44
|
+
<text fill="#000000" x="60.0" y="111.0" font-family="monospace" font-size="12">+ age: int</text>
|
|
45
|
+
<text fill="#000000" x="60.0" y="129.0" font-family="monospace" font-size="12">+ species: String</text>
|
|
46
|
+
<text fill="#000000" x="60.0" y="147.0" font-family="monospace" font-size="12">+ void</text>
|
|
47
|
+
<text fill="#000000" x="60.0" y="165.0" font-family="monospace" font-size="12">+ void</text>
|
|
48
|
+
<text fill="#000000" x="60.0" y="183.0" font-family="monospace" font-size="12">+ void</text>
|
|
49
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="206.0" x2="196.0" y2="206.0"/>
|
|
50
|
+
<text fill="#000000" x="60.0" y="216.0" font-family="monospace" font-size="12">+ makeSound()</text>
|
|
51
|
+
<text fill="#000000" x="60.0" y="234.0" font-family="monospace" font-size="12">+ eat(food Food)</text>
|
|
52
|
+
<text fill="#000000" x="60.0" y="252.0" font-family="monospace" font-size="12">+ sleep()</text>
|
|
53
|
+
</g>
|
|
54
|
+
<g id="class-Mammal">
|
|
55
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="300.0" y="50.0" width="160.0" height="124.0" rx="3.0" ry="3.0"/>
|
|
56
|
+
<text fill="#000000" x="380.0" y="60.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Mammal</text>
|
|
57
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="83.0" x2="460.0" y2="83.0"/>
|
|
58
|
+
<text fill="#000000" x="310.0" y="93.0" font-family="monospace" font-size="12">+ furColor: String</text>
|
|
59
|
+
<text fill="#000000" x="310.0" y="111.0" font-family="monospace" font-size="12">+ warmBlooded: bool</text>
|
|
60
|
+
<text fill="#000000" x="310.0" y="129.0" font-family="monospace" font-size="12">+ void</text>
|
|
61
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="152.0" x2="460.0" y2="152.0"/>
|
|
62
|
+
<text fill="#000000" x="310.0" y="162.0" font-family="monospace" font-size="12">+ giveBirth()</text>
|
|
63
|
+
</g>
|
|
64
|
+
<g id="class-Bird">
|
|
65
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="550.0" y="50.0" width="181.0" height="124.0" rx="3.0" ry="3.0"/>
|
|
66
|
+
<text fill="#000000" x="640.5" y="60.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Bird</text>
|
|
67
|
+
<line stroke="#000000" stroke-width="1" x1="550.0" y1="83.0" x2="731.0" y2="83.0"/>
|
|
68
|
+
<text fill="#000000" x="560.0" y="93.0" font-family="monospace" font-size="12">+ canFly: bool</text>
|
|
69
|
+
<text fill="#000000" x="560.0" y="111.0" font-family="monospace" font-size="12">+ featherColor: String</text>
|
|
70
|
+
<text fill="#000000" x="560.0" y="129.0" font-family="monospace" font-size="12">+ void</text>
|
|
71
|
+
<line stroke="#000000" stroke-width="1" x1="550.0" y1="152.0" x2="731.0" y2="152.0"/>
|
|
72
|
+
<text fill="#000000" x="560.0" y="162.0" font-family="monospace" font-size="12">+ layEggs()</text>
|
|
73
|
+
</g>
|
|
74
|
+
<g id="class-Dog">
|
|
75
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="50.0" y="250.0" width="146.0" height="144.0" rx="3.0" ry="3.0"/>
|
|
76
|
+
<text fill="#000000" x="123.0" y="260.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Dog</text>
|
|
77
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="283.0" x2="196.0" y2="283.0"/>
|
|
78
|
+
<text fill="#000000" x="60.0" y="293.0" font-family="monospace" font-size="12">+ breed: String</text>
|
|
79
|
+
<text fill="#000000" x="60.0" y="311.0" font-family="monospace" font-size="12">+ void</text>
|
|
80
|
+
<text fill="#000000" x="60.0" y="329.0" font-family="monospace" font-size="12">+ void</text>
|
|
81
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="352.0" x2="196.0" y2="352.0"/>
|
|
82
|
+
<text fill="#000000" x="60.0" y="362.0" font-family="monospace" font-size="12">+ bark()</text>
|
|
83
|
+
<text fill="#000000" x="60.0" y="380.0" font-family="monospace" font-size="12">+ fetch(item Item)</text>
|
|
84
|
+
</g>
|
|
85
|
+
<g id="class-Cat">
|
|
86
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="300.0" y="250.0" width="140.0" height="164.0" rx="3.0" ry="3.0"/>
|
|
87
|
+
<text fill="#000000" x="370.0" y="260.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Cat</text>
|
|
88
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="283.0" x2="440.0" y2="283.0"/>
|
|
89
|
+
<text fill="#000000" x="310.0" y="293.0" font-family="monospace" font-size="12">+ indoor: bool</text>
|
|
90
|
+
<text fill="#000000" x="310.0" y="311.0" font-family="monospace" font-size="12">+ lives: int</text>
|
|
91
|
+
<text fill="#000000" x="310.0" y="329.0" font-family="monospace" font-size="12">+ void</text>
|
|
92
|
+
<text fill="#000000" x="310.0" y="347.0" font-family="monospace" font-size="12">+ void</text>
|
|
93
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="370.0" x2="440.0" y2="370.0"/>
|
|
94
|
+
<text fill="#000000" x="310.0" y="380.0" font-family="monospace" font-size="12">+ meow()</text>
|
|
95
|
+
<text fill="#000000" x="310.0" y="398.0" font-family="monospace" font-size="12">+ purr()</text>
|
|
96
|
+
</g>
|
|
97
|
+
<g id="class-Eagle">
|
|
98
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="550.0" y="250.0" width="146.0" height="144.0" rx="3.0" ry="3.0"/>
|
|
99
|
+
<text fill="#000000" x="623.0" y="260.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Eagle</text>
|
|
100
|
+
<line stroke="#000000" stroke-width="1" x1="550.0" y1="283.0" x2="696.0" y2="283.0"/>
|
|
101
|
+
<text fill="#000000" x="560.0" y="293.0" font-family="monospace" font-size="12">+ wingSpan: float</text>
|
|
102
|
+
<text fill="#000000" x="560.0" y="311.0" font-family="monospace" font-size="12">+ void</text>
|
|
103
|
+
<text fill="#000000" x="560.0" y="329.0" font-family="monospace" font-size="12">+ void</text>
|
|
104
|
+
<line stroke="#000000" stroke-width="1" x1="550.0" y1="352.0" x2="696.0" y2="352.0"/>
|
|
105
|
+
<text fill="#000000" x="560.0" y="362.0" font-family="monospace" font-size="12">+ hunt()</text>
|
|
106
|
+
<text fill="#000000" x="560.0" y="380.0" font-family="monospace" font-size="12">+ soar()</text>
|
|
107
|
+
</g>
|
|
108
|
+
<g id="class-Penguin">
|
|
109
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="50.0" y="450.0" width="140.0" height="124.0" rx="3.0" ry="3.0"/>
|
|
110
|
+
<text fill="#000000" x="120.0" y="460.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Penguin</text>
|
|
111
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="483.0" x2="190.0" y2="483.0"/>
|
|
112
|
+
<text fill="#000000" x="60.0" y="493.0" font-family="monospace" font-size="12">+ void</text>
|
|
113
|
+
<text fill="#000000" x="60.0" y="511.0" font-family="monospace" font-size="12">+ void</text>
|
|
114
|
+
<line stroke="#000000" stroke-width="1" x1="50.0" y1="534.0" x2="190.0" y2="534.0"/>
|
|
115
|
+
<text fill="#000000" x="60.0" y="544.0" font-family="monospace" font-size="12">+ swim()</text>
|
|
116
|
+
<text fill="#000000" x="60.0" y="562.0" font-family="monospace" font-size="12">+ slide()</text>
|
|
117
|
+
</g>
|
|
118
|
+
<g id="class-Owner">
|
|
119
|
+
<rect fill="#ffffff" stroke="#000000" stroke-width="2" x="300.0" y="450.0" width="174.0" height="144.0" rx="3.0" ry="3.0"/>
|
|
120
|
+
<text fill="#000000" x="387.0" y="460.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">Owner</text>
|
|
121
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="483.0" x2="474.0" y2="483.0"/>
|
|
122
|
+
<text fill="#000000" x="310.0" y="493.0" font-family="monospace" font-size="12">+ name: String</text>
|
|
123
|
+
<text fill="#000000" x="310.0" y="511.0" font-family="monospace" font-size="12">+ address: String</text>
|
|
124
|
+
<text fill="#000000" x="310.0" y="529.0" font-family="monospace" font-size="12">+ pets: List~Animal~</text>
|
|
125
|
+
<text fill="#000000" x="310.0" y="547.0" font-family="monospace" font-size="12">+ void</text>
|
|
126
|
+
<line stroke="#000000" stroke-width="1" x1="300.0" y1="570.0" x2="474.0" y2="570.0"/>
|
|
127
|
+
<text fill="#000000" x="310.0" y="580.0" font-family="monospace" font-size="12">+ adoptPet(pet Animal)</text>
|
|
128
|
+
</g>
|
|
129
|
+
</svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
= Class Diagram Examples
|
|
2
|
+
|
|
3
|
+
== Purpose
|
|
4
|
+
|
|
5
|
+
Class diagrams visualize the structure of object-oriented systems, showing classes, their attributes, methods, and relationships. They are fundamental for software design, architecture documentation, and understanding system structure.
|
|
6
|
+
|
|
7
|
+
== When to Use
|
|
8
|
+
|
|
9
|
+
* Object-oriented design and architecture documentation
|
|
10
|
+
* Data model and entity relationship visualization
|
|
11
|
+
* Interface and abstract class hierarchies
|
|
12
|
+
* Design pattern documentation
|
|
13
|
+
* System structure and component relationships
|
|
14
|
+
|
|
15
|
+
== Syntax Overview
|
|
16
|
+
|
|
17
|
+
[source,mermaid]
|
|
18
|
+
----
|
|
19
|
+
classDiagram
|
|
20
|
+
class Animal {
|
|
21
|
+
+String name
|
|
22
|
+
+int age
|
|
23
|
+
+makeSound() void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class Dog {
|
|
27
|
+
+String breed
|
|
28
|
+
+bark() void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Animal <|-- Dog
|
|
32
|
+
----
|
|
33
|
+
|
|
34
|
+
**Class Definition**: Define classes with attributes and methods
|
|
35
|
+
|
|
36
|
+
**Visibility**:
|
|
37
|
+
- `+` - Public
|
|
38
|
+
- `-` - Private
|
|
39
|
+
- `#` - Protected
|
|
40
|
+
- `~` - Package/Internal
|
|
41
|
+
|
|
42
|
+
**Relationship Types**:
|
|
43
|
+
- `<|--` - Inheritance
|
|
44
|
+
- `*--` - Composition
|
|
45
|
+
- `o--` - Aggregation
|
|
46
|
+
- `-->` - Association
|
|
47
|
+
- `..>` - Dependency
|
|
48
|
+
- `..|>` - Realization
|
|
49
|
+
|
|
50
|
+
== Examples
|
|
51
|
+
|
|
52
|
+
=== 01: Basic Classes
|
|
53
|
+
|
|
54
|
+
Demonstrates a complete class hierarchy with inheritance, showing the Animal base class with Mammal and Bird subclasses, and an Owner class with composition.
|
|
55
|
+
|
|
56
|
+
**File**: link:01-basic-classes.mmd[01-basic-classes.mmd]
|
|
57
|
+
|
|
58
|
+
[source,mermaid]
|
|
59
|
+
----
|
|
60
|
+
include::01-basic-classes.mmd[]
|
|
61
|
+
----
|
|
62
|
+
|
|
63
|
+
image::01-basic-classes.svg[]
|
|
64
|
+
|
|
65
|
+
== Features Demonstrated
|
|
66
|
+
|
|
67
|
+
[%header,cols="1,1"]
|
|
68
|
+
|===
|
|
69
|
+
| Feature | Example
|
|
70
|
+
|
|
71
|
+
| Class definition with attributes
|
|
72
|
+
| 01
|
|
73
|
+
|
|
74
|
+
| Methods and signatures
|
|
75
|
+
| 01
|
|
76
|
+
|
|
77
|
+
| Inheritance relationships
|
|
78
|
+
| 01
|
|
79
|
+
|
|
80
|
+
| Association with cardinality
|
|
81
|
+
| 01
|
|
82
|
+
|
|
83
|
+
| Multi-level hierarchy
|
|
84
|
+
| 01
|
|
85
|
+
|
|
86
|
+
| Generic types
|
|
87
|
+
| 01
|
|
88
|
+
|===
|
|
89
|
+
|
|
90
|
+
== Additional Resources
|
|
91
|
+
|
|
92
|
+
* link:../../README.adoc[Main Documentation]
|
|
93
|
+
* https://mermaid.js.org/syntax/classDiagram.html[Mermaid Class Diagram Documentation]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
erDiagram
|
|
2
|
+
USER ||--o{ POST : writes
|
|
3
|
+
USER ||--o{ COMMENT : writes
|
|
4
|
+
POST ||--o{ COMMENT : has
|
|
5
|
+
POST }o--|| CATEGORY : belongs_to
|
|
6
|
+
POST }o--o{ TAG : tagged_with
|
|
7
|
+
USER ||--o{ LIKE : gives
|
|
8
|
+
POST ||--o{ LIKE : receives
|
|
9
|
+
COMMENT ||--o{ LIKE : receives
|
|
10
|
+
|
|
11
|
+
USER {
|
|
12
|
+
int id PK
|
|
13
|
+
string username UK
|
|
14
|
+
string email UK
|
|
15
|
+
string password_hash
|
|
16
|
+
datetime created_at
|
|
17
|
+
datetime updated_at
|
|
18
|
+
boolean is_active
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
POST {
|
|
22
|
+
int id PK
|
|
23
|
+
int user_id FK
|
|
24
|
+
int category_id FK
|
|
25
|
+
string title
|
|
26
|
+
text content
|
|
27
|
+
string slug UK
|
|
28
|
+
datetime published_at
|
|
29
|
+
datetime created_at
|
|
30
|
+
datetime updated_at
|
|
31
|
+
int view_count
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
COMMENT {
|
|
35
|
+
int id PK
|
|
36
|
+
int post_id FK
|
|
37
|
+
int user_id FK
|
|
38
|
+
int parent_id FK
|
|
39
|
+
text content
|
|
40
|
+
datetime created_at
|
|
41
|
+
datetime updated_at
|
|
42
|
+
boolean is_approved
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
CATEGORY {
|
|
46
|
+
int id PK
|
|
47
|
+
string name UK
|
|
48
|
+
string slug UK
|
|
49
|
+
text description
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
TAG {
|
|
53
|
+
int id PK
|
|
54
|
+
string name UK
|
|
55
|
+
string slug UK
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
LIKE {
|
|
59
|
+
int id PK
|
|
60
|
+
int user_id FK
|
|
61
|
+
int post_id FK
|
|
62
|
+
int comment_id FK
|
|
63
|
+
datetime created_at
|
|
64
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="400" height="200" viewBox="0 0 400 200" version="1.2" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<rect x="50" y="50" width="300" height="100" fill="#f0f0f0" stroke="#000000" stroke-width="2"/>
|
|
4
|
+
<text x="200" y="100" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" fill="#000000">ER Diagram (parser needs fixes)</text>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
erDiagram
|
|
2
|
+
CUSTOMER ||--o{ ORDER : places
|
|
3
|
+
CUSTOMER {
|
|
4
|
+
int customer_id PK
|
|
5
|
+
string name
|
|
6
|
+
string email UK
|
|
7
|
+
string phone
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
ORDER ||--|{ ORDER_ITEM : contains
|
|
11
|
+
ORDER {
|
|
12
|
+
int order_id PK
|
|
13
|
+
int customer_id FK
|
|
14
|
+
date order_date
|
|
15
|
+
decimal total_amount
|
|
16
|
+
string status
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ORDER_ITEM }o--|| PRODUCT : references
|
|
20
|
+
ORDER_ITEM {
|
|
21
|
+
int order_item_id PK
|
|
22
|
+
int order_id FK
|
|
23
|
+
int product_id FK
|
|
24
|
+
int quantity
|
|
25
|
+
decimal unit_price
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
PRODUCT ||--o{ INVENTORY : tracked_in
|
|
29
|
+
PRODUCT {
|
|
30
|
+
int product_id PK
|
|
31
|
+
string name
|
|
32
|
+
string sku UK
|
|
33
|
+
decimal price
|
|
34
|
+
int category_id FK
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
CATEGORY ||--o{ PRODUCT : categorizes
|
|
38
|
+
CATEGORY {
|
|
39
|
+
int category_id PK
|
|
40
|
+
string name
|
|
41
|
+
string description
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
INVENTORY {
|
|
45
|
+
int inventory_id PK
|
|
46
|
+
int product_id FK
|
|
47
|
+
int warehouse_id FK
|
|
48
|
+
int quantity
|
|
49
|
+
date last_updated
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
WAREHOUSE ||--o{ INVENTORY : stores
|
|
53
|
+
WAREHOUSE {
|
|
54
|
+
int warehouse_id PK
|
|
55
|
+
string name
|
|
56
|
+
string location
|
|
57
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="800.0"
|
|
3
|
+
height="630.0"
|
|
4
|
+
viewBox="0 0 800 630"
|
|
5
|
+
version="1.2"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<g id="rel-CUSTOMER_to_ORDER">
|
|
9
|
+
<line stroke="#333333" stroke-width="2" x1="220.0" y1="110.0" x2="300.0" y2="120.0" stroke-dasharray="5,5"/>
|
|
10
|
+
<line stroke="#333333" stroke-width="2" x1="219.13175685787553" y1="116.94594513699568" x2="220.86824314212447" y2="103.05405486300432"/>
|
|
11
|
+
<circle fill="none" stroke="#333333" stroke-width="2" cx="293.05405486300435" cy="119.13175685787554" r="5.0"/>
|
|
12
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="118.13947898116187" x2="296.95611510993984" y2="108.93036977843806"/>
|
|
13
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="118.13947898116187" x2="300.0" y2="120.0"/>
|
|
14
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="118.13947898116187" x2="294.3249410520188" y2="129.97976224180675"/>
|
|
15
|
+
<text fill="#000000" x="260.0" y="110.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">places</text>
|
|
16
|
+
</g>
|
|
17
|
+
<g id="rel-ORDER_to_ORDER_ITEM">
|
|
18
|
+
<line stroke="#333333" stroke-width="2" x1="470.0" y1="120.0" x2="550.0" y2="120.0" stroke-dasharray="5,5"/>
|
|
19
|
+
<line stroke="#333333" stroke-width="2" x1="470.0" y1="127.0" x2="470.0" y2="113.0"/>
|
|
20
|
+
<line stroke="#333333" stroke-width="2" x1="550.0" y1="113.0" x2="550.0" y2="127.0"/>
|
|
21
|
+
<line stroke="#333333" stroke-width="2" x1="535.0" y1="120.0" x2="545.6066017177982" y2="109.39339828220179"/>
|
|
22
|
+
<line stroke="#333333" stroke-width="2" x1="535.0" y1="120.0" x2="550.0" y2="120.0"/>
|
|
23
|
+
<line stroke="#333333" stroke-width="2" x1="535.0" y1="120.0" x2="545.6066017177982" y2="130.6066017177982"/>
|
|
24
|
+
<text fill="#000000" x="510.0" y="115.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">contains</text>
|
|
25
|
+
</g>
|
|
26
|
+
<g id="rel-ORDER_ITEM_to_PRODUCT">
|
|
27
|
+
<line stroke="#333333" stroke-width="2" x1="550.0" y1="205.0" x2="220.0" y2="235.0" stroke-dasharray="5,5"/>
|
|
28
|
+
<circle fill="none" stroke="#333333" stroke-width="2" cx="543.0287475547261" cy="205.63375022229764" r="5.0"/>
|
|
29
|
+
<line stroke="#333333" stroke-width="2" x1="549.3662497777024" y1="198.02874755472607" x2="550.6337502222976" y2="211.97125244527393"/>
|
|
30
|
+
<line stroke="#333333" stroke-width="2" x1="220.63375022229764" y1="241.97125244527393" x2="219.36624977770236" y2="228.02874755472607"/>
|
|
31
|
+
<text fill="#000000" x="385.0" y="215.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">references</text>
|
|
32
|
+
</g>
|
|
33
|
+
<g id="rel-PRODUCT_to_INVENTORY">
|
|
34
|
+
<line stroke="#333333" stroke-width="2" x1="220.0" y1="320.0" x2="300.0" y2="320.0" stroke-dasharray="5,5"/>
|
|
35
|
+
<line stroke="#333333" stroke-width="2" x1="220.0" y1="327.0" x2="220.0" y2="313.0"/>
|
|
36
|
+
<circle fill="none" stroke="#333333" stroke-width="2" cx="293.0" cy="320.0" r="5.0"/>
|
|
37
|
+
<line stroke="#333333" stroke-width="2" x1="285.0" y1="320.0" x2="295.6066017177982" y2="309.39339828220176"/>
|
|
38
|
+
<line stroke="#333333" stroke-width="2" x1="285.0" y1="320.0" x2="300.0" y2="320.0"/>
|
|
39
|
+
<line stroke="#333333" stroke-width="2" x1="285.0" y1="320.0" x2="295.60660171779824" y2="330.6066017177982"/>
|
|
40
|
+
<text fill="#000000" x="260.0" y="315.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">tracked_in</text>
|
|
41
|
+
</g>
|
|
42
|
+
<g id="rel-CATEGORY_to_PRODUCT">
|
|
43
|
+
<line stroke="#333333" stroke-width="2" x1="550.0" y1="385.0" x2="220.0" y2="235.0" stroke-dasharray="5,5"/>
|
|
44
|
+
<line stroke="#333333" stroke-width="2" x1="552.8966206101082" y1="378.62743465776174" x2="547.1033793898918" y2="391.37256534223826"/>
|
|
45
|
+
<circle fill="none" stroke="#333333" stroke-width="2" cx="226.37256534223823" cy="237.8966206101083" r="5.0"/>
|
|
46
|
+
<line stroke="#333333" stroke-width="2" x1="233.65549716193908" y1="241.20704416451775" x2="219.6105594984034" y2="246.47389578834364"/>
|
|
47
|
+
<line stroke="#333333" stroke-width="2" x1="233.65549716193908" y1="241.20704416451775" x2="220.0" y2="235.0"/>
|
|
48
|
+
<line stroke="#333333" stroke-width="2" x1="233.65549716193908" y1="241.20704416451775" x2="228.3886455381132" y2="227.16210650098208"/>
|
|
49
|
+
<text fill="#000000" x="385.0" y="305.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">categorizes</text>
|
|
50
|
+
</g>
|
|
51
|
+
<g id="rel-WAREHOUSE_to_INVENTORY">
|
|
52
|
+
<line stroke="#333333" stroke-width="2" x1="220.0" y1="415.0" x2="300.0" y2="405.0" stroke-dasharray="5,5"/>
|
|
53
|
+
<line stroke="#333333" stroke-width="2" x1="220.86824314212447" y1="421.94594513699565" x2="219.13175685787553" y2="408.05405486300435"/>
|
|
54
|
+
<circle fill="none" stroke="#333333" stroke-width="2" cx="293.05405486300435" cy="405.86824314212447" r="5.0"/>
|
|
55
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="406.86052101883814" x2="294.3249410520188" y2="395.0202377581932"/>
|
|
56
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="406.86052101883814" x2="300.0" y2="405.0"/>
|
|
57
|
+
<line stroke="#333333" stroke-width="2" x1="285.115831849295" y1="406.86052101883814" x2="296.9561151099399" y2="416.06963022156197"/>
|
|
58
|
+
<text fill="#000000" x="260.0" y="405.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="11">stores</text>
|
|
59
|
+
</g>
|
|
60
|
+
<g id="entity-CUSTOMER">
|
|
61
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="50.0" y="50.0" width="170.0" height="120.0"/>
|
|
62
|
+
<text fill="#000000" x="135.0" y="76.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">CUSTOMER</text>
|
|
63
|
+
<line stroke="#333333" stroke-width="1" x1="50.0" y1="94.0" x2="220.0" y2="94.0"/>
|
|
64
|
+
<text fill="#000000" x="60.0" y="116.0" font-family="monospace" font-size="12">PK customer_id int</text>
|
|
65
|
+
<text fill="#000000" x="60.0" y="134.0" font-family="monospace" font-size="12">name string</text>
|
|
66
|
+
<text fill="#000000" x="60.0" y="152.0" font-family="monospace" font-size="12">UK email string</text>
|
|
67
|
+
<text fill="#000000" x="60.0" y="170.0" font-family="monospace" font-size="12">phone string</text>
|
|
68
|
+
</g>
|
|
69
|
+
<g id="entity-ORDER">
|
|
70
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="300.0" y="50.0" width="170.0" height="140.0"/>
|
|
71
|
+
<text fill="#000000" x="385.0" y="76.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">ORDER</text>
|
|
72
|
+
<line stroke="#333333" stroke-width="1" x1="300.0" y1="94.0" x2="470.0" y2="94.0"/>
|
|
73
|
+
<text fill="#000000" x="310.0" y="116.0" font-family="monospace" font-size="12">PK order_id int</text>
|
|
74
|
+
<text fill="#000000" x="310.0" y="134.0" font-family="monospace" font-size="12">FK customer_id int</text>
|
|
75
|
+
<text fill="#000000" x="310.0" y="152.0" font-family="monospace" font-size="12">order_date date</text>
|
|
76
|
+
<text fill="#000000" x="310.0" y="170.0" font-family="monospace" font-size="12">total_amount decimal</text>
|
|
77
|
+
<text fill="#000000" x="310.0" y="188.0" font-family="monospace" font-size="12">status string</text>
|
|
78
|
+
</g>
|
|
79
|
+
<g id="entity-ORDER_ITEM">
|
|
80
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="550.0" y="50.0" width="170.0" height="140.0"/>
|
|
81
|
+
<text fill="#000000" x="635.0" y="76.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">ORDER_ITEM</text>
|
|
82
|
+
<line stroke="#333333" stroke-width="1" x1="550.0" y1="94.0" x2="720.0" y2="94.0"/>
|
|
83
|
+
<text fill="#000000" x="560.0" y="116.0" font-family="monospace" font-size="12">PK order_item_id int</text>
|
|
84
|
+
<text fill="#000000" x="560.0" y="134.0" font-family="monospace" font-size="12">FK order_id int</text>
|
|
85
|
+
<text fill="#000000" x="560.0" y="152.0" font-family="monospace" font-size="12">FK product_id int</text>
|
|
86
|
+
<text fill="#000000" x="560.0" y="170.0" font-family="monospace" font-size="12">quantity int</text>
|
|
87
|
+
<text fill="#000000" x="560.0" y="188.0" font-family="monospace" font-size="12">unit_price decimal</text>
|
|
88
|
+
</g>
|
|
89
|
+
<g id="entity-PRODUCT">
|
|
90
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="50.0" y="250.0" width="170.0" height="140.0"/>
|
|
91
|
+
<text fill="#000000" x="135.0" y="276.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">PRODUCT</text>
|
|
92
|
+
<line stroke="#333333" stroke-width="1" x1="50.0" y1="294.0" x2="220.0" y2="294.0"/>
|
|
93
|
+
<text fill="#000000" x="60.0" y="316.0" font-family="monospace" font-size="12">PK product_id int</text>
|
|
94
|
+
<text fill="#000000" x="60.0" y="334.0" font-family="monospace" font-size="12">name string</text>
|
|
95
|
+
<text fill="#000000" x="60.0" y="352.0" font-family="monospace" font-size="12">UK sku string</text>
|
|
96
|
+
<text fill="#000000" x="60.0" y="370.0" font-family="monospace" font-size="12">price decimal</text>
|
|
97
|
+
<text fill="#000000" x="60.0" y="388.0" font-family="monospace" font-size="12">FK category_id int</text>
|
|
98
|
+
</g>
|
|
99
|
+
<g id="entity-INVENTORY">
|
|
100
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="300.0" y="250.0" width="170.0" height="140.0"/>
|
|
101
|
+
<text fill="#000000" x="385.0" y="276.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">INVENTORY</text>
|
|
102
|
+
<line stroke="#333333" stroke-width="1" x1="300.0" y1="294.0" x2="470.0" y2="294.0"/>
|
|
103
|
+
<text fill="#000000" x="310.0" y="316.0" font-family="monospace" font-size="12">PK inventory_id int</text>
|
|
104
|
+
<text fill="#000000" x="310.0" y="334.0" font-family="monospace" font-size="12">FK product_id int</text>
|
|
105
|
+
<text fill="#000000" x="310.0" y="352.0" font-family="monospace" font-size="12">FK warehouse_id int</text>
|
|
106
|
+
<text fill="#000000" x="310.0" y="370.0" font-family="monospace" font-size="12">quantity int</text>
|
|
107
|
+
<text fill="#000000" x="310.0" y="388.0" font-family="monospace" font-size="12">last_updated date</text>
|
|
108
|
+
</g>
|
|
109
|
+
<g id="entity-CATEGORY">
|
|
110
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="550.0" y="250.0" width="170.0" height="100.0"/>
|
|
111
|
+
<text fill="#000000" x="635.0" y="276.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">CATEGORY</text>
|
|
112
|
+
<line stroke="#333333" stroke-width="1" x1="550.0" y1="294.0" x2="720.0" y2="294.0"/>
|
|
113
|
+
<text fill="#000000" x="560.0" y="316.0" font-family="monospace" font-size="12">PK category_id int</text>
|
|
114
|
+
<text fill="#000000" x="560.0" y="334.0" font-family="monospace" font-size="12">name string</text>
|
|
115
|
+
<text fill="#000000" x="560.0" y="352.0" font-family="monospace" font-size="12">description string</text>
|
|
116
|
+
</g>
|
|
117
|
+
<g id="entity-WAREHOUSE">
|
|
118
|
+
<rect fill="#f9f9f9" stroke="#333333" stroke-width="2" x="50.0" y="450.0" width="170.0" height="100.0"/>
|
|
119
|
+
<text fill="#000000" x="135.0" y="476.0" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="bold">WAREHOUSE</text>
|
|
120
|
+
<line stroke="#333333" stroke-width="1" x1="50.0" y1="494.0" x2="220.0" y2="494.0"/>
|
|
121
|
+
<text fill="#000000" x="60.0" y="516.0" font-family="monospace" font-size="12">PK warehouse_id int</text>
|
|
122
|
+
<text fill="#000000" x="60.0" y="534.0" font-family="monospace" font-size="12">name string</text>
|
|
123
|
+
<text fill="#000000" x="60.0" y="552.0" font-family="monospace" font-size="12">location string</text>
|
|
124
|
+
</g>
|
|
125
|
+
</svg>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
= Entity-Relationship Diagram Examples
|
|
2
|
+
|
|
3
|
+
== Purpose
|
|
4
|
+
|
|
5
|
+
Entity-Relationship (ER) diagrams model database schemas, showing entities (tables), their attributes, and the relationships between them. Essential for database design and documentation.
|
|
6
|
+
|
|
7
|
+
== When to Use
|
|
8
|
+
|
|
9
|
+
* Database schema design and documentation
|
|
10
|
+
* Data modeling and normalization
|
|
11
|
+
* System architecture planning
|
|
12
|
+
* Understanding existing database structures
|
|
13
|
+
* Communicating data requirements
|
|
14
|
+
|
|
15
|
+
== Syntax Overview
|
|
16
|
+
|
|
17
|
+
[source,mermaid]
|
|
18
|
+
----
|
|
19
|
+
erDiagram
|
|
20
|
+
CUSTOMER ||--o{ ORDER : places
|
|
21
|
+
ORDER ||--|{ LINE-ITEM : contains
|
|
22
|
+
PRODUCT ||--o{ LINE-ITEM : "ordered in"
|
|
23
|
+
----
|
|
24
|
+
|
|
25
|
+
**Cardinality Notation**:
|
|
26
|
+
- `||--||` - Exactly one
|
|
27
|
+
- `}o--o{` - Zero or more (many)
|
|
28
|
+
- `||--o{` - One to many
|
|
29
|
+
- `}o--||` - Many to one
|
|
30
|
+
|
|
31
|
+
**Relationship Types**:
|
|
32
|
+
- Identifying relationships (solid line)
|
|
33
|
+
- Non-identifying relationships (dashed line)
|
|
34
|
+
|
|
35
|
+
== Examples
|
|
36
|
+
|
|
37
|
+
=== 01: Basic Entities
|
|
38
|
+
|
|
39
|
+
Demonstrates fundamental ER diagram with simple entities and relationships.
|
|
40
|
+
|
|
41
|
+
**File**: link:01-basic-entities.mmd[01-basic-entities.mmd]
|
|
42
|
+
|
|
43
|
+
[source,mermaid]
|
|
44
|
+
----
|
|
45
|
+
include::01-basic-entities.mmd[]
|
|
46
|
+
----
|
|
47
|
+
|
|
48
|
+
image::01-basic-entities.svg[]
|
|
49
|
+
|
|
50
|
+
=== 02: Cardinality
|
|
51
|
+
|
|
52
|
+
Showcases all relationship cardinalities: one-to-one, one-to-many, many-to-many.
|
|
53
|
+
|
|
54
|
+
**File**: link:02-cardinality.mmd[02-cardinality.mmd]
|
|
55
|
+
|
|
56
|
+
[source,mermaid]
|
|
57
|
+
----
|
|
58
|
+
include::02-cardinality.mmd[]
|
|
59
|
+
----
|
|
60
|
+
|
|
61
|
+
image::02-cardinality.svg[]
|
|
62
|
+
|
|
63
|
+
== Features Demonstrated
|
|
64
|
+
|
|
65
|
+
[%header,cols="1,1"]
|
|
66
|
+
|===
|
|
67
|
+
| Feature | Example
|
|
68
|
+
|
|
69
|
+
| Basic entity definition
|
|
70
|
+
| 01, 02
|
|
71
|
+
|
|
72
|
+
| One-to-many relationships
|
|
73
|
+
| 01, 02
|
|
74
|
+
|
|
75
|
+
| Many-to-many relationships
|
|
76
|
+
| 02
|
|
77
|
+
|
|
78
|
+
| Relationship labels
|
|
79
|
+
| 01, 02
|
|
80
|
+
|
|
81
|
+
| Cardinality notation
|
|
82
|
+
| 02
|
|
83
|
+
|===
|
|
84
|
+
|
|
85
|
+
== Additional Resources
|
|
86
|
+
|
|
87
|
+
* link:../../README.adoc[Main Documentation]
|
|
88
|
+
* https://mermaid.js.org/syntax/entityRelationshipDiagram.html[Mermaid ER Diagram Documentation]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Error Diagrams
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="500.0"
|
|
3
|
+
height="220.0"
|
|
4
|
+
viewBox="0 0 500 220"
|
|
5
|
+
version="1.2"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<rect fill="#FFEBEE" stroke="#D32F2F" stroke-width="2" x="50.0" y="50.0" width="400.0" height="120.0" rx="8.0" ry="8.0"/>
|
|
9
|
+
<circle fill="#D32F2F" stroke="#B71C1C" stroke-width="2" cx="100.0" cy="110.0" r="20.0"/>
|
|
10
|
+
<rect fill="#FFFFFF" x="98.0" y="100.0" width="4.0" height="12.0" rx="2.0"/>
|
|
11
|
+
<circle fill="#FFFFFF" cx="100.0" cy="116.0" r="2.0"/>
|
|
12
|
+
<text fill="#C62828" x="140.0" y="105.0" text-anchor="start" font-family="Arial, Helvetica, sans-serif" font-size="16" font-weight="bold">Diagrams</text>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
error Critical System Error
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="500.0"
|
|
3
|
+
height="220.0"
|
|
4
|
+
viewBox="0 0 500 220"
|
|
5
|
+
version="1.2"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<rect fill="#FFEBEE" stroke="#D32F2F" stroke-width="2" x="50.0" y="50.0" width="400.0" height="120.0" rx="8.0" ry="8.0"/>
|
|
9
|
+
<circle fill="#D32F2F" stroke="#B71C1C" stroke-width="2" cx="100.0" cy="110.0" r="20.0"/>
|
|
10
|
+
<rect fill="#FFFFFF" x="98.0" y="100.0" width="4.0" height="12.0" rx="2.0"/>
|
|
11
|
+
<circle fill="#FFFFFF" cx="100.0" cy="116.0" r="2.0"/>
|
|
12
|
+
<text fill="#C62828" x="140.0" y="105.0" text-anchor="start" font-family="Arial, Helvetica, sans-serif" font-size="16" font-weight="bold">Critical System Error</text>
|
|
13
|
+
</svg>
|