Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: Paolo F Cantoni on June 13, 2005, 08:09:18 pm

Title: Multiplicity expressions
Post by: Paolo F Cantoni on June 13, 2005, 08:09:18 pm
In standard UML, you can express multiplicities in non-literal terms:
Quote
[4] If a non-literal ValueSpecification is used for the lower or upper bound, then evaluating that specification must not have side effects.
[5] If a non-literal ValueSpecification is used for the lower or upper bound, then that specification must be a constant expression.
(from: ptc-04-10-02: 7.3.32 MultiplicityElement (from Kernel))
8) 8)

It seems to me this allows one to specify the multiplicity of one attribute in terms of the value of another attribute.  For example, I may define an autobus to have a maximumDoorCount.  I may define a vector of Doors whose cardinality is [1..maximumDoorCount].  This would make the (conceptual) model more expressive.  BTW: EA appears to accept this input with no problem.

Should I use this feature in my conceptual models?

NOTE: I'm not, primarily, concerned with code generation (or synchronisation) here.  For my environment, that's a problem left to a downstream process that takes output emitted from the EA conceptual model.

Anyone suggest why I shouldn't do this?

Cheerz,
Paolo

BTW: I have taken constant expression to mean that the expression itself is a constant not that it references a constant value.  (In C++ terms a const pointer not a pointer to a const) ;)
Title: Re: Multiplicity expressions
Post by: sargasso on June 13, 2005, 08:47:24 pm
I thought the constant expression had the opposite meaning, i.e. an expresssion whose value is constant.  However, I could be geting confused with C#.  

But to get back to your... I have no problemo's at all with the cardinality of a vector being a computed value, many modern [sic] languages provide such a feature.  In fact at implementation the vector size could be constant, variable or even random  (many examples of software around seem to use the latter  ;) ;)   ).

But finally, I've got to ask the question, what the heck is multiplicity of an attribute?  This class contains between 0 and n attributes of this name?

If as I understand it, at instantiation of the parent class say "autobus" as an object, say "3:15pm Peppermint Grove" that instance has a value of 67.3 set for its maximumDoorCount attribute then I can create up to 67.3 owned :door objects and stick them in some anonymous collection within the 3:15 Peppermint Grove object somehow.  How one can then reference these beasts seems not to be addressed by UML and is left to the language implementers.

To get back to your... (again)  the only question of ambiguity arising from your proposition is the constraining of using a varying value for a bound to only owned elements of the defining object. IOW the maximumDoorCount of the 3:15 Peppermint Grove  cannot and should not be used or usable as a bound on the doors in the 769 DeeWhy West instance.
Title: Re: Multiplicity expressions
Post by: Paolo F Cantoni on June 13, 2005, 09:12:58 pm
Quote
I thought the constant expression had the opposite meaning, i.e. an expression whose value is constant.  However, I could be getting confused with C#.
Yeah, we discussed that here and figured that UML was ambiguous here - hence my clarification.
Quote
But to get back to your... I have no problemo's at all with the cardinality of a vector being a computed value, many modern [sic] languages provide such a feature.  In fact at implementation the vector size could be constant, variable or even random  (many examples of software around seem to use the latter  ;) ;)   ).

But finally, I've got to ask the question, what the heck is multiplicity of an attribute?  This class contains between 0 and n attributes of this name?
That's the way I read it.  This attribute is a vector.  See my posting on Attributive Associations vs Associative Attributes.
Quote
If as I understand it, at instantiation of the parent class say "autobus" as an object, say "3:15pm Peppermint Grove" that instance has a value of 67.3 set for its maximumDoorCount attribute then I can create up to 67.3 owned :door objects and stick them in some anonymous collection within the 3:15 Peppermint Grove object somehow.  How one can then reference these beasts seems not to be addressed by UML and is left to the language implementers.
The vector is not anonymous...  (Sorry for not being more explicit)  comprisedDoors [1..maximumDoorCount].  maximumDoorCount is of type NonNegativeInteger thus 67.3 is invalid (it's invalid by definition since multiplicities are defined as lower bound integer, upper bound natural numbers) ;D
Yes, the how is left to the implementation, I'm concerned here with the what.  For example: -/ comprisedDoorCount Count = comprisedDoors.Count
(I have a concept comprisedDoorCount (private) which is of datatype Count and which I formally define (derive) as the count attribute of the comprisedDoors collection)
Quote
To get back to your... (again)  the only question of ambiguity arising from your proposition is the constraining of using a varying value for a bound to only owned elements of the defining object. IOW the maximumDoorCount of the 3:15 Peppermint Grove  cannot and should not be used or usable as a bound on the doors in the 769 Dee Why West instance.
As you implicitly assert, the run-time value is instance specific.

Clarifyingly?
Paolo
Title: Re: Multiplicity expressions
Post by: sargasso on June 13, 2005, 09:45:01 pm
No, no, no.  I'm not saying your instance is anonymous.
Quote
The vector is not anonymous...  (Sorry for not being more explicit)  comprisedDoors [1..maximumDoorCount].  maximumDoorCount is of type NonNegativeInteger thus 67.3 is invalid (it's invalid by definition since multiplicities are defined as lower bound integer, upper bound natural numbers)
.

I'm saying that the UML does not specify or imply an implementation of this "multiplicity" bezerker at the attribute level.  They say an attribute can have a multiplicity - and OK, OK natural numbers only. What they dont say is how this multiplicity is to be interpreted or implemented. You chose a vector,  EA provides for up to three explicit stand by implementations of these collections (default, ordered and qualified).  As someone said before (you?)  multiplicity of an object aint the same thing as cardinality of a set.  All I'm saying is that UML is - yet again - silent on  the things they cant groke.  In this case, what they really mean by the multiplicity of an attribute in a classifier.


yipb
bruce

edit:  but to use that good old engineering expression "I suppose its good enough for practical purposes"  :)
Title: Re: Multiplicity expressions
Post by: Paolo F Cantoni on June 13, 2005, 10:06:20 pm
Quote
No, no, no.  I'm not saying your instance is anonymous.

I'm saying that the UML does not specify or imply an implementation of this "multiplicity" bezerker at the attribute level.  They say an attribute can have a multiplicity - and OK, OK natural numbers only. What they don't say is how this multiplicity is to be interpreted or implemented. You chose a vector,  EA provides for up to three explicit stand by implementations of these collections (default, ordered and qualified).  As someone said before (you?)  multiplicity of an object ain't the same thing as cardinality of a set.  All I'm saying is that UML is - yet again - silent on  the things they cant groke.  In this case, what they really mean by the multiplicity of an attribute in a classifier.


yipb
bruce

edit:  but to use that good old engineering expression "I suppose its good enough for practical purposes"  :)
bruce,  I meant vector in the mathematical sense :)  Conceptually, it may be thought of as a one-dimensional array.  How it is actually implemented is, as you say, another issue.

Multiplicity is a cardinality wot can be zero...

I suspect we are now in violent agreement! ;D

And as a trained engineer I applaud your last statement!

Paolo

BTW I thought it was grok... (slip of the fingers?)

Also: yipb?
Title: Re: Multiplicity expressions
Post by: sargasso on June 13, 2005, 11:57:01 pm
We of the upper north shore prefer the more formally polite form "groke" ;D

yipb = yours in perpetual bewilderment  (aka the battle cry of the beleagured specification reader)

ttfn
bruce