Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Nodes are combined from outside hierarchy in component diagram

0 votes

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
 

asked Feb 28 in bug by rcmaniac25 (150 points)

1 Answer

0 votes
 
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 ?

answered Feb 28 by plantuml (125,210 points)
selected Feb 28 by rcmaniac25
Ah, yes. That works. Thanks for the quick response.
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...