Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: bernardm on January 10, 2013, 10:35:10 pm
-
Hi,
In a class diagram, is there a way to display attribute-level constraints in the attribute compartment?
Thanks for your help!
Bernard
-
You can create Constraint elements and link these to the class and further via Link to Element Feature/Attribute. But you can't use the constraints defined in the attributes section.
q.
-
Thanks for the tip.
Have a good day,
Bernard
-
If an attribute has a tagged value 'xUML', its value will be shown in the attribute compartment. Adding this value and enter a constraint will solve your problem.
HTH,
-
Excellent! I'm just wondering where you catched this "hidden feature" from... ;)
-
He's a friendly Sparxian.
q.
-
Cool!
I have been looking for a way to this for years and up to now have used the class constraints and showing the constraints compartment for the class.
Sparx certainly kept this well hidden! Makes you wonder how many other secrets there are ;)
Cheers
Phil
-
Yep, this is top notch!
By the way I've just introduced a new feature request to have attribute- level constraints shown natively in the attribute compartment.
In the meantime, xUML will be heavily used!
-
The reason why I know this xUML tag is that I am the man who requested this feature in several years ago.
xUML means eXecutable UML, and this notation is used in some book about executable UML.
-
Hello,
nice feature. I could use it for #ifdef .... in C/C++ Code generation.
I would also like it for operations.
Kind regards,
Helmut
-
I would also like it for operations.
Yes! That would make sense.
I agree that #ifdef is a constraint, and should be modeled as such, but 'xUML' tag isn't really a constraint in the UML model, or maps to one, does it?
Or should we think of TVs as kind of 'specialized' constraints? Then 'xUML' is a pretty broad one IMHO.
So it's still all about visibility of the attributes'/operations' constraints, right?
1. Following the UML (2.3) specs a constraint should render within braces after the elements textual notation:
7.3.10 Constraint (from Kernel)
For an element whose notation is a text string (such as an attribute, etc.), the constraint string may follow the element text
string in braces
'xUML' unfortunately doesn't (you can use the braces explicitly though).
2. Before everyone starts to use 'xUML' as a surrogate for rendered constraints, it should be implemented as a native feature of EA (=> feature request (http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1358804431/0#0)) to select the constraints, that should be shown for an element feature (attribute,operation, maybe others ...) on a diagram (similar as with linked notes). This would keep UML constraints usable for other processes like transformations, code generation and model validation.
Just my 0.02 EUR,
Günther
-
Hello Günther,
thanks for your valuable remarks.
In my opinion: xUML is a nice and low cost solution.
In long term I would prefer additional the UML solution mentioned by Günther.
In terms of diagram I think constraints of features are the right thing to visualize.
Kind regards,
Helmut
-
200% agree that xUml should be considered as a temporary work-around until Sparx provides a real uml-compliant solution.
Thanks guys for your supporting this.