Skip to content

Instantly share code, notes, and snippets.

@mjhanninen
Created October 4, 2020 13:03
Show Gist options
  • Save mjhanninen/48fa4c4ec3fd9e0978458cbc825556ed to your computer and use it in GitHub Desktop.
Save mjhanninen/48fa4c4ec3fd9e0978458cbc825556ed to your computer and use it in GitHub Desktop.

PlantUML example for Malli

@startuml fig-malli-order-for-burgers.svg

  hide empty members

  class "Burger" {
    :name string?
    :description string?
    :origin [:maybe "Country"]
    :price pos-int?
  }

  class "Country" {
    :name [:enum :FI :PO]
    :neighbors [:vector [:ref "Country"]]
  }

  class "Order" {
    :lines [:vector "OrderLine"]
    :delivery Order$Delivery
  }

  class "Order$Delivery" {
    :delivered boolean?
    :address Order$Delivery$Address
  }

  class "Order$Delivery$Address" {
    :street string?
    :zip int?
    :country Country
  }

  class "OrderLine" {
    :burger Burger
    :amount int?
  }

  "Burger" o-- "Country"
  "Country" o-- "Country"
  "Order" o-- "OrderLine"
  "Order" *-- "Order$Delivery"
  "Order$Delivery" *-- "Order$Delivery$Address"
  "Order$Delivery$Address" o-- "Country"
  "OrderLine" o-- "Burger"

@enduml
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="509px" preserveAspectRatio="none" style="width:366px;height:509px;" version="1.1" viewBox="0 0 366 509" width="366px" zoomAndPan="magnify"><defs><filter height="300%" id="f15c6svnuasxhr" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--MD5=[5dba5505e6746325cb79590d5d36b5f8]
class Burger--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="97.1996" id="Burger" style="stroke: #A80036; stroke-width: 1.5;" width="139" x="208.5" y="265"/><ellipse cx="255.75" cy="281" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M255.625,287.2031 Q253.2344,287.2031 252.0938,285.5938 Q250.9531,283.9844 250.9531,281.0625 Q250.9531,278.1406 252.0938,276.5469 Q253.2344,274.9375 255.625,274.9375 Q256.5469,274.9375 257.25,275.1875 Q257.9531,275.4219 258.4531,275.875 Q258.9688,276.3125 259.2969,276.9375 Q259.6406,277.5625 259.8281,278.3438 L257.4375,278.9219 Q257.3438,278.5 257.2031,278.1406 Q257.0625,277.7813 256.8438,277.5313 Q256.6406,277.2813 256.3281,277.1406 Q256.0156,276.9844 255.5781,276.9844 Q254.5313,276.9844 254.0938,277.7969 Q253.6719,278.6094 253.6719,280.0313 L253.6719,282.1094 Q253.6719,283.5313 254.0938,284.3438 Q254.5313,285.1406 255.5781,285.1406 Q256.4531,285.1406 256.8438,284.6094 Q257.25,284.0625 257.4375,283.2031 L259.8281,283.7813 Q259.6406,284.5625 259.2969,285.2031 Q258.9688,285.8281 258.4531,286.2813 Q257.9531,286.7344 257.25,286.9688 Q256.5469,287.2031 255.625,287.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="36" x="276.25" y="285.5">Burger</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="209.5" x2="346.5" y1="297" y2="297"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="67" x="214.5" y="312.2749">:name string?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="94" x="214.5" y="326.5748">:description string?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="127" x="214.5" y="340.8747">:origin [:maybe "Country"]</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="70" x="214.5" y="355.1746">:price pos-int?</text><!--MD5=[deb4e1f6eb1e3c1256fdb830f96abfbb]
class Country--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="68.5998" id="Country" style="stroke: #A80036; stroke-width: 1.5;" width="183" x="92.5" y="422"/><ellipse cx="158.75" cy="438" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M158.625,444.2031 Q156.2344,444.2031 155.0938,442.5938 Q153.9531,440.9844 153.9531,438.0625 Q153.9531,435.1406 155.0938,433.5469 Q156.2344,431.9375 158.625,431.9375 Q159.5469,431.9375 160.25,432.1875 Q160.9531,432.4219 161.4531,432.875 Q161.9688,433.3125 162.2969,433.9375 Q162.6406,434.5625 162.8281,435.3438 L160.4375,435.9219 Q160.3438,435.5 160.2031,435.1406 Q160.0625,434.7813 159.8438,434.5313 Q159.6406,434.2813 159.3281,434.1406 Q159.0156,433.9844 158.5781,433.9844 Q157.5313,433.9844 157.0938,434.7969 Q156.6719,435.6094 156.6719,437.0313 L156.6719,439.1094 Q156.6719,440.5313 157.0938,441.3438 Q157.5313,442.1406 158.5781,442.1406 Q159.4531,442.1406 159.8438,441.6094 Q160.25,441.0625 160.4375,440.2031 L162.8281,440.7813 Q162.6406,441.5625 162.2969,442.2031 Q161.9688,442.8281 161.4531,443.2813 Q160.9531,443.7344 160.25,443.9688 Q159.5469,444.2031 158.625,444.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="42" x="179.25" y="442.5">Country</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="93.5" x2="274.5" y1="454" y2="454"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="108" x="98.5" y="469.2749">:name [:enum :FI :PO]</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="171" x="98.5" y="483.5748">:neighbors [:vector [:ref "Country"]]</text><!--MD5=[cf4d6237fcae255cd2e1656cf84a30e2]
class Order--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="68.5998" id="Order" style="stroke: #A80036; stroke-width: 1.5;" width="143" x="112.5" y="7"/><ellipse cx="164.25" cy="23" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M164.125,29.2031 Q161.7344,29.2031 160.5938,27.5938 Q159.4531,25.9844 159.4531,23.0625 Q159.4531,20.1406 160.5938,18.5469 Q161.7344,16.9375 164.125,16.9375 Q165.0469,16.9375 165.75,17.1875 Q166.4531,17.4219 166.9531,17.875 Q167.4688,18.3125 167.7969,18.9375 Q168.1406,19.5625 168.3281,20.3438 L165.9375,20.9219 Q165.8438,20.5 165.7031,20.1406 Q165.5625,19.7813 165.3438,19.5313 Q165.1406,19.2813 164.8281,19.1406 Q164.5156,18.9844 164.0781,18.9844 Q163.0313,18.9844 162.5938,19.7969 Q162.1719,20.6094 162.1719,22.0313 L162.1719,24.1094 Q162.1719,25.5313 162.5938,26.3438 Q163.0313,27.1406 164.0781,27.1406 Q164.9531,27.1406 165.3438,26.6094 Q165.75,26.0625 165.9375,25.2031 L168.3281,25.7813 Q168.1406,26.5625 167.7969,27.2031 Q167.4688,27.8281 166.9531,28.2813 Q166.4531,28.7344 165.75,28.9688 Q165.0469,29.2031 164.125,29.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="31" x="184.75" y="27.5">Order</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="113.5" x2="254.5" y1="39" y2="39"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="131" x="118.5" y="54.2749">:lines [:vector "OrderLine"]</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="118" x="118.5" y="68.5748">:delivery Order$Delivery</text><!--MD5=[03c0c0eb517985999fb1eccdf44070c9]
class Order$Delivery--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="68.5998" id="Order$Delivery" style="stroke: #A80036; stroke-width: 1.5;" width="176" x="13" y="136"/><ellipse cx="55.9" cy="152" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M55.775,158.2031 Q53.3844,158.2031 52.2438,156.5938 Q51.1031,154.9844 51.1031,152.0625 Q51.1031,149.1406 52.2438,147.5469 Q53.3844,145.9375 55.775,145.9375 Q56.6969,145.9375 57.4,146.1875 Q58.1031,146.4219 58.6031,146.875 Q59.1188,147.3125 59.4469,147.9375 Q59.7906,148.5625 59.9781,149.3438 L57.5875,149.9219 Q57.4938,149.5 57.3531,149.1406 Q57.2125,148.7813 56.9938,148.5313 Q56.7906,148.2813 56.4781,148.1406 Q56.1656,147.9844 55.7281,147.9844 Q54.6813,147.9844 54.2438,148.7969 Q53.8219,149.6094 53.8219,151.0313 L53.8219,153.1094 Q53.8219,154.5313 54.2438,155.3438 Q54.6813,156.1406 55.7281,156.1406 Q56.6031,156.1406 56.9938,155.6094 Q57.4,155.0625 57.5875,154.2031 L59.9781,154.7813 Q59.7906,155.5625 59.4469,156.2031 Q59.1188,156.8281 58.6031,157.2813 Q58.1031,157.7344 57.4,157.9688 Q56.6969,158.2031 55.775,158.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="82" x="76.1" y="156.5">Order$Delivery</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="14" x2="188" y1="168" y2="168"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="95" x="19" y="183.2749">:delivered boolean?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="164" x="19" y="197.5748">:address Order$Delivery$Address</text><!--MD5=[5dd9b029bf90fb73ae1251e2cba1581f]
class Order$Delivery$Address--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="82.8997" id="Order$Delivery$Address" style="stroke: #A80036; stroke-width: 1.5;" width="166" x="7" y="272"/><ellipse cx="22" cy="288" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M21.875,294.2031 Q19.4844,294.2031 18.3438,292.5938 Q17.2031,290.9844 17.2031,288.0625 Q17.2031,285.1406 18.3438,283.5469 Q19.4844,281.9375 21.875,281.9375 Q22.7969,281.9375 23.5,282.1875 Q24.2031,282.4219 24.7031,282.875 Q25.2188,283.3125 25.5469,283.9375 Q25.8906,284.5625 26.0781,285.3438 L23.6875,285.9219 Q23.5938,285.5 23.4531,285.1406 Q23.3125,284.7813 23.0938,284.5313 Q22.8906,284.2813 22.5781,284.1406 Q22.2656,283.9844 21.8281,283.9844 Q20.7813,283.9844 20.3438,284.7969 Q19.9219,285.6094 19.9219,287.0313 L19.9219,289.1094 Q19.9219,290.5313 20.3438,291.3438 Q20.7813,292.1406 21.8281,292.1406 Q22.7031,292.1406 23.0938,291.6094 Q23.5,291.0625 23.6875,290.2031 L26.0781,290.7813 Q25.8906,291.5625 25.5469,292.2031 Q25.2188,292.8281 24.7031,293.2813 Q24.2031,293.7344 23.5,293.9688 Q22.7969,294.2031 21.875,294.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="134" x="36" y="292.5">Order$Delivery$Address</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="8" x2="172" y1="304" y2="304"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="68" x="13" y="319.2749">:street string?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="38" x="13" y="333.5748">:zip int?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="81" x="13" y="347.8747">:country Country</text><!--MD5=[057726cf5a7b0036039cd1ed4902be71]
class OrderLine--><rect fill="#FEFECE" filter="url(#f15c6svnuasxhr)" height="68.5998" id="OrderLine" style="stroke: #A80036; stroke-width: 1.5;" width="86" x="229" y="136"/><ellipse cx="244" cy="152" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M243.875,158.2031 Q241.4844,158.2031 240.3438,156.5938 Q239.2031,154.9844 239.2031,152.0625 Q239.2031,149.1406 240.3438,147.5469 Q241.4844,145.9375 243.875,145.9375 Q244.7969,145.9375 245.5,146.1875 Q246.2031,146.4219 246.7031,146.875 Q247.2188,147.3125 247.5469,147.9375 Q247.8906,148.5625 248.0781,149.3438 L245.6875,149.9219 Q245.5938,149.5 245.4531,149.1406 Q245.3125,148.7813 245.0938,148.5313 Q244.8906,148.2813 244.5781,148.1406 Q244.2656,147.9844 243.8281,147.9844 Q242.7813,147.9844 242.3438,148.7969 Q241.9219,149.6094 241.9219,151.0313 L241.9219,153.1094 Q241.9219,154.5313 242.3438,155.3438 Q242.7813,156.1406 243.8281,156.1406 Q244.7031,156.1406 245.0938,155.6094 Q245.5,155.0625 245.6875,154.2031 L248.0781,154.7813 Q247.8906,155.5625 247.5469,156.2031 Q247.2188,156.8281 246.7031,157.2813 Q246.2031,157.7344 245.5,157.9688 Q244.7969,158.2031 243.875,158.2031 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="54" x="258" y="156.5">OrderLine</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="230" x2="314" y1="168" y2="168"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="71" x="235" y="183.2749">:burger Burger</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="62" x="235" y="197.5748">:amount int?</text><!--MD5=[84e37cc47782961cf2d4e1aa92469817]
reverse link Burger to Country--><path d="M238.71,373.43 C227.76,389.86 216.23,407.16 206.59,421.61 " fill="none" id="Burger&lt;-Country" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="246.18,362.24,239.5228,365.0115,239.5206,372.2226,246.1778,369.4511,246.18,362.24" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[1c3b7ccc282c386533adb23ef65b8612]
reverse link Country to Country--><path d="M288.33,433.2 C301.69,437.26 310.5,445.02 310.5,456.5 C310.5,471.34 295.77,479.97 275.54,482.41 " fill="none" id="Country&lt;-Country" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="275.54,430.59,280.6192,435.7088,287.2978,432.989,282.2185,427.8703,275.54,430.59" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[89886c64ded1b4cb5ba3d356e90c7574]
reverse link Order to OrderLine--><path d="M214.79,86.93 C225.87,102.92 238.18,120.7 248.54,135.64 " fill="none" id="Order&lt;-OrderLine" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="207.35,76.2,207.484,83.4099,214.1908,86.0592,214.0568,78.8493,207.35,76.2" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[218faba77f1e147cd3517c5412ebfb44]
reverse link Order to Order$Delivery--><path d="M154.66,87.39 C144.29,103.27 132.8,120.84 123.13,135.64 " fill="none" id="Order&lt;-Order$Delivery" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="161.98,76.2,155.3492,79.0342,155.4151,86.245,162.0459,83.4108,161.98,76.2" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[29401b57ada2552f5a2a4829e3b307b6]
reverse link Order$Delivery to Order$Delivery$Address--><path d="M97.35,218.34 C95.99,235.7 94.47,255.22 93.16,271.98 " fill="none" id="Order$Delivery&lt;-Order$Delivery$Address" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="98.37,205.27,93.914,210.9395,97.4335,217.2334,101.8896,211.5639,98.37,205.27" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[7a0c6740e08194bba76f314acab1a7ac]
reverse link Order$Delivery$Address to Country--><path d="M124.51,366.26 C136.9,384.84 150.53,405.3 161.62,421.93 " fill="none" id="Order$Delivery$Address&lt;-Country" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="117.19,355.28,117.1812,362.4911,123.8342,365.2727,123.843,358.0616,117.19,355.28" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[119d89e4f294b2ec71d5e325b01bbf00]
reverse link OrderLine to Burger--><path d="M274,218.45 C274.63,233.38 275.34,249.9 275.97,264.87 " fill="none" id="OrderLine&lt;-Burger" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="273.44,205.27,269.6938,211.4317,273.9407,217.2596,277.6868,211.0979,273.44,205.27" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[59234af5ab8448c68f35887024aa77a9]
@startuml fig-malli-order-for-burgers.svg
hide empty members
class "Burger" {
:name string?
:description string?
:origin [:maybe "Country"]
:price pos-int?
}
class "Country" {
:name [:enum :FI :PO]
:neighbors [:vector [:ref "Country"]]
}
class "Order" {
:lines [:vector "OrderLine"]
:delivery Order$Delivery
}
class "Order$Delivery" {
:delivered boolean?
:address Order$Delivery$Address
}
class "Order$Delivery$Address" {
:street string?
:zip int?
:country Country
}
class "OrderLine" {
:burger Burger
:amount int?
}
"Burger" o- - "Country"
"Country" o- - "Country"
"Order" o- - "OrderLine"
"Order" *- - "Order$Delivery"
"Order$Delivery" *- - "Order$Delivery$Address"
"Order$Delivery$Address" o- - "Country"
"OrderLine" o- - "Burger"
@enduml
PlantUML version 1.2020.15(Sun Jun 28 14:39:45 EEST 2020)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment