BESSER icon indicating copy to clipboard operation
BESSER copied to clipboard

Unidirectional association

Open EmidioStani opened this issue 7 months ago • 2 comments

Is your feature request related to a problem?

I want to depict just a unidirectional association, like those in this diagram: https://semiceu.github.io/Core-Person-Vocabulary/releases/2.1.1/#specoverview

when I use b-uml in python, I get error that "An association must have more than one end"

Describe the solution you'd like

when I create an association just define 1 end only

EmidioStani avatar May 14 '25 12:05 EmidioStani

Hi @EmidioStani, thanks for your suggestion!

You're right that our current implementation requires associations to have at least two ends, this is because an Association in UML represents a relationship between at least two elements (even if the relationship is unidirectional), and without two ends, it's unclear where it's connected.

If you want to model a full association between two classes (even if one direction is not navigable):

Author_Book: BinaryAssociation = BinaryAssociation(
    name="Author_Book",
    ends={
        Property(name="writtenBy", type=Author, multiplicity=Multiplicity(1, 9999), is_navigable=False),
        Property(name="publishes", type=Book, multiplicity=Multiplicity(0, 9999))
    }
)

ArmenSl avatar May 14 '25 14:05 ArmenSl

All associations in B-uml must have two ends. I know some languages also support associations with one end but this is not in our plans.

But as Armen says, what you can indeed do is to draw an association between two classes with a undirectional navigation which I feel is what you want. This is possible even in the online editor.

jcabot avatar May 14 '25 21:05 jcabot