Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: bernardm on January 10, 2013, 10:35:10 pm

Title: Displaying attribute-level constraints
Post 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
Title: Re: Displaying attribute-level constraints
Post by: qwerty on January 11, 2013, 03:23:24 am
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.
Title: Re: Displaying attribute-level constraints
Post by: bernardm on January 14, 2013, 06:50:23 pm
Thanks for the tip.
Have a good day,
Bernard
Title: Re: Displaying attribute-level constraints
Post by: Takeshi K on January 18, 2013, 01:21:57 pm
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,
Title: Re: Displaying attribute-level constraints
Post by: bernardm on January 18, 2013, 07:41:25 pm
Excellent! I'm just wondering where you catched this "hidden feature" from...  ;)
Title: Re: Displaying attribute-level constraints
Post by: qwerty on January 18, 2013, 07:54:07 pm
He's a friendly Sparxian.

q.
Title: Re: Displaying attribute-level constraints
Post by: philchudley on January 18, 2013, 08:16:04 pm
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
Title: Re: Displaying attribute-level constraints
Post by: bernardm on January 18, 2013, 09:19:48 pm
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!
Title: Re: Displaying attribute-level constraints
Post by: Takeshi K on January 19, 2013, 01:09:04 pm
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.


Title: xUML also for operations
Post by: Helmut Ortmann on January 21, 2013, 07:32:34 pm
Hello,

nice feature. I could use it for #ifdef .... in C/C++ Code generation.

I would also like it for operations.

Kind regards,

Helmut

Title: Re:  xUML also for operations
Post by: g.makulik on January 22, 2013, 06:55:23 am
Quote
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:
Quote
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
Title: Re: Displaying attribute-level constraints
Post by: Helmut Ortmann on January 22, 2013, 04:54:52 pm
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
Title: Re: Displaying attribute-level constraints
Post by: bernardm on January 22, 2013, 07:06:48 pm
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.