Nodes are combined from outside hierarchy in component diagram

0 votes
asked Feb 28, 2017 in Bug by rcmaniac25 (140 points)

The diagram produced by this is not correct:

@startuml

node "outer1" {
    node "Should not contain sub-subnode Bob" {
        node "NotBob" {
        }
    }
    
    node "NotBob" {
        node "Bob" {
        }
    }
}

@enduml
 

I expect it's supposed to look like the diagram produced by this (but with NotBob still being named "NotBob"):

@startuml

node "outer1" {
    node "Should not contain sub-subnode Bob" {
        node "NotBob" {
        }
    }
    
    node "NotSam" {
        node "Bob" {
        }
    }
}

@enduml
 

1 Answer

0 votes
answered Feb 28, 2017 by plantuml (294,960 points)
selected Feb 28, 2017 by rcmaniac25
 
Best answer

The main issue is that PlantUML does not define any namespace.

Even if "NotBob" is defined twice, from a PlantUML point-of-view, there are only one "NotBob".

This is really a initial design decision which is not easy to change now (because it may impact existing diagrams).

However, a workaround is possible by renaming nodes:

@startuml
node "outer1" {
    node "Should not contain sub-subnode Bob" {
        node "NotBob" as NotBob1 {
        }
    }
    
    node "NotBob" {
        node "Bob" {
        }
    }
}
@enduml

Is it an acceptable solution for you ?

commented Feb 28, 2017 by rcmaniac25 (140 points)
Ah, yes. That works. Thanks for the quick response.
...