subdiagram format does not match diagram

0 votes
asked Jun 27, 2022 in Question / help by filiscas (160 points)
hello, because the subdiagram format does not match diagram, it should replicate the include within the subdiagram, but it does not work either

@startuml
' incluir fichero personalizado de opciones
'-------------------------------------------------
 !include C:\PLANTUML\TemplateDB.puml
    ' =============================================
    ' =============================================
    '               NUEVAS TABLAS
    ' =============================================
    ' =============================================
    Tabla(TABLA1, "TABLITA  <size:14><&external-link></size>") {
        primary_key(COD_PERSONA)
        primary_key(FECHA)         
    }    
    rectangle T_PERSONAS [
        {{

            
            Tabla(TABLA2,"TABLA2") {
                primary_key(FECHA)
                primary_key(COD_PERSONA)
                primary_key(COD_COMPRA)
            }

            Tabla(TABLA3,"TABLA3") {
                primary_key(FECHA)        
                primary_key(COD_PERSONA)
                primary_key(COD_SOLICITUD)
            }
        }}
    ]

    PER_PERSONA_H -- T_PERSONA    
@enduml
commented Jun 27, 2022 by Martin (8,360 points)

You are right that subdiagrams don't inherit style info, you have to re-specify it all in the subdiagram itself.

eg

@startuml
!theme spacelab
rectangle Example [
  Theme spacelab
  {{
    rectangle Example2 [
      no theme
    ]
  }}
]
@enduml
@startuml
!theme spacelab
rectangle Example [
  Theme spacelab
  {{
    !theme spacelab
    rectangle Example2 [
      Theme spacelab
    ]
  }}
]
@enduml

I can see your point that you might expect the top level theme to cascade down.  Maybe @Plantuml could add a parameter to enable that.

commented Jun 27, 2022 by Alex
hello, that part I check and the include does not make me the definition well within the subdiagram

1 Answer

+1 vote
answered Jun 27, 2022 by The-Lu (64,340 points)
selected Jun 28, 2022 by filiscas
 
Best answer

Hello F.,

  • What is your issue?
  • Where is defined `PER_PERSONA_H` and `T_PERSONA` [in TemplateDB.puml]?

[New update with `!include_many`]

Could you test, with `!include_many` as:

@startuml
 !include_many C:\PLANTUML\TemplateDB.puml
    Tabla(TABLA1, "TABLITA  <size:14><&external-link></size>") {
        primary_key(COD_PERSONA)
        primary_key(FECHA)         
    }
    rectangle T_PERSONAS [
        {{
            !include_many C:\PLANTUML\TemplateDB.puml
            
            Tabla(TABLA2,"TABLA2") {
                primary_key(FECHA)
                primary_key(COD_PERSONA)
                primary_key(COD_COMPRA)
            }

            Tabla(TABLA3,"TABLA3") {
                primary_key(FECHA)        
                primary_key(COD_PERSONA)
                primary_key(COD_SOLICITUD)
            }
        }}
    ]

PER_PERSONA_H -- T_PERSONA    
@enduml

See similar pseudo issue here (not with include, but with sprite)...:

And see doc. about include here:

If that can help,
Regards.

commented Jun 28, 2022 by filiscas (160 points)
edited Jun 28, 2022 by filiscas

@startuml TemplateDB_UB

' PARAMETROS PERSONALIZADOS

' Colores corpotrativos 

' principales 

!define verde #278600

!define gris #154734

!define rojo #e1251b

' secundarios

!define negro #1d1d1b

!define grisoscuro #60605f

!define grisclaro #d0dad6

!define verdeblanco #dde5cd

!define rojovino #c10230

' otros

!define verdeoscuro #006241

!define blanco #FFFFFF

!define blancoroto #dde5cd

skinparam DefaultFontName Gill Sans MT 

skinparam DefaultFontSize 10

skinparam DefaultFontColor negro

skinparam DefaultMonospacedFontName Gill Sans MT

' tipo de escala

' -------------------------------------------------

skinparam dpi 150

' tipo de linea

' -------------------------------------------------

skinparam linetype ortho

' eliminar la sombra

' -------------------------------------------------

skinparam shadowing false

' agrupar en una unica flecha

' -------------------------------------------------

' separacion horizontal entre cajas

skinparam nodesep 30

' separacion vertical entre cajas

skinparam ranksep 20

' redondear forma

' -------------------------------------------------

skinparam roundcorner 20

' personalizacion de la fuente

' -------------------------------------------------

skinparam FontSize 10

skinparam ClassAttributeFontColor negro 

' personalizacion de la clase

' -------------------------------------------------

<style>

ClassDiagram {

class {

BackgroundColor blanco

BorderColor negro

ArrowColor negro

header {

FontStyle bold

FontColor white

BackgroundColor verde

}

  }

}

</style>

skinparam HyperlinkColor #C10230

skinparam HyperlinkUnderline false

skinparam Interface {

BackgroundColor verde

BorderColor negro

}

' personalizacion del frame

'-------------------------------------------------

skinparam frame {

FrameBackgroundcolor white

BorderColor negro

}

' personalizacion del label

'-------------------------------------------------

skinparam label {

BackgroundColor transparent

BorderColor negro

ArrowColor negro

}

' personalizacion del rectangulo

'-------------------------------------------------

skinparam rectangle {

BackgroundColor blanco

BorderColor negro

BorderThickness 2

}

' el paquete le damos estilo rectangulo

'-------------------------------------------------

' skinparam packageStyle rectangle

skinparam Package {

    BorderColor White

    BorderThickness 0

}

' centramos eltexto de las notas

skinparam noteTextAlignment center

skinparam ConditionEndStyle hline

commented Jun 28, 2022 by filiscas (160 points)

!function grupo($valor)        

!if %size($valor) == 0

!return ""

!else

!return "< "+$valor+" >"

!endif

' !return %size($valor)

!endfunction

!unquoted procedure Tabla($nombreTabla = "TAB", $desTabla = "", $desGrupoTabla = "")

!if (%substr($nombreTabla,0,3) =="DTS")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(H,#C1022E)>>

    !elseif (%substr($nombreTabla,0,3) =="AGR")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(A,#D7ADFE)>>

    !elseif (%substr($nombreTabla,0,3) =="REL")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(R,#FFBD00)>>

!elseif (%substr($nombreTabla,0,3) =="DIM")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(D,#DAF7A6)>>

!elseif (%substr($nombreTabla,0,3) =="TRD")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(T,#DAADFE)>>

    !elseif (%substr($nombreTabla,0,3) =="JER")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(J,#5BB2FC)>>

!elseif (%substr($nombreTabla,0,3) == "MST")

class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(M,#FFFFFF)>>

!elseif (%substr($nombreTabla,0,3) =="SCD")

    class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(S,#5FFF1D)>>    

!else

!if (%substr($nombreTabla,%size($nombreTabla)-2,2) =="_H")

class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(H,#C1022E)>>

!elseif (%substr($nombreTabla,%size($nombreTabla)-2,2) =="_E")

class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(E,#DDE5CD)>>

!else

class $nombreTabla as "$desTabla" grupo($desGrupoTabla) <<(O,#FFAAAA)>>

!endif

!endif

!endprocedure

@enduml
commented Jun 28, 2022 by The-Lu (64,340 points)

Is sub-diagram mandatory?

Could you test, simply, this:

@startuml
 !include_many C:\PLANTUML\TemplateDB.puml
    Tabla(TABLA1, "TABLITA  <size:14><&external-link></size>") {
        primary_key(COD_PERSONA)
        primary_key(FECHA)         
    }
    rectangle T_PERSONAS {
         
            Tabla(TABLA2,"TABLA2") {
                primary_key(FECHA)
                primary_key(COD_PERSONA)
                primary_key(COD_COMPRA)
            }

            Tabla(TABLA3,"TABLA3") {
                primary_key(FECHA)        
                primary_key(COD_PERSONA)
                primary_key(COD_SOLICITUD)
            }
}

PER_PERSONA_H -- T_PERSONA    
@enduml

If that can help,
Regards.

commented Jun 28, 2022 by filiscas (160 points)
yes, that's how it works perfectly.

it seems that it does not support well the include within {{ }}

thank you very much for the help
...