2

I try to draw interconnected tables (not Eentities!) with PlantUml. Unfortunately, I could not find any possibility to name a table. The only solution I could use is to define it in another component, eg. an object, to be able to make interconnections between them.

@startuml

object Organization {
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
}


object OrgCust {
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
}

object Customer {
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
}

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

It looks not that bad, but the extra frames disturb me a bit. Would be possible to avoid these frames and connect the tables directly (but maybe still have a caption for the tables)?

enter image description here

ald mike
  • 95
  • 1
  • 9

1 Answers1

3

You can try to draw them as notes (the Creole syntax doesn't work in Rectangle or Package elements unfortunately). You have to hide the note outline and background:

@startuml

<style>
note {
    backgroundcolor white
    shadowing 0
    linecolor transparent
}
</style>

note as Organization 
  <#lightblue,#black>|=  organizationNo  |=  name  |=  address  |
  <#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |
  <#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |
  <#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |
end note

note as OrgCust
  <#lightblue,#black>|= organizationNo  |=  customerNo  |
  <#white>|  OS07  |  CM67  |
  <#white>|  OS7  |  CM67  |
  <#white>|  OC11  |  CH11  |
end note

note as Customer
  <#lightblue,#black>|=  customerNo  |=  fName  |=  lName  |=  creditLimit  |
  <#white>|  CJ13  |  John  |  Jeschke  |  5000  |
  <#white>|  CK37  |  Nina  |  Knabel  |  2000  |
  <#white>|  CM67  |  Felix  |  Magee  |  1300  |
  <#white>|  CH11  |  Lilla  |  Hopka  |  3000  |
end note

Organization -[hidden]-> OrgCust
OrgCust -[hidden]-> Customer

Organization ||--o{ OrgCust
Customer ||--o{ OrgCust

@enduml

PlantUML Diagram

To get a caption for the tables, you could format it in the table somehow? Or add <b>Caption here</b> on a line inside the note (beginning or end)?

EDIT

I also discovered that you can embed the table in the name of a class, such as:

@startuml
<style>
class {
    BackgroundColor transparent
    linecolor transparent
}
</style>

hide empty members
hide circle
class "<#lightblue,#black>|=  organizationNo  |=  name  |=  address  |\n\
<#white>|  OS07  |  Sphereways  | 22 Rabbit Rd, London |\n\
<#white>|  OO7  |  Orco  | 16 Adam St, Nuremberg |\n\
<#white>|  OC11  |  Cruxolutions  | 163 Olga St, Budapest |" as Organization {
}
@enduml

enter image description here

Fuhrmanator
  • 11,459
  • 6
  • 62
  • 111