Home » Modeling » UML2 » Can enumerations specialize primitive types ?
|
Re: Can enumerations specialize primitive types ? [message #471925 is a reply to message #471821] |
Tue, 27 March 2007 16:44 |
Dave Carlson Messages: 402 Registered: July 2009 |
Senior Member |
|
|
Andy,
The UML2 spec prohibits this, so the UML2 implementation cannot support
it. Or at a minimum, must create a validation error if your model
includes such structures.
I use a model structure almost exactly like what you describe in my XSD
modeling tools, except that I define my datatype model libraries using
instances of DataType instead of PrimitiveType. Modeling this way, an
Enumeration *can* extend a DataType -- this is allowed by the spec. And
a DataType can extend a DataType. But a DataType cannot extend a
PrimitiveType.
Cheers,
Dave Carlson
Andreas Maier wrote:
> A UML Enumeration (metaclass) is a kind of UML Classifier (metaclass),
> and the same is true for the UML PrimitiveType.
>
> As we all know, Classifiers can have a Generalization association (and
> relationship) between them.
>
> Questions:
>
> 1. Does UML2 (i.e. the specs) allow that enumerations in a user model
> specialize (via instance of the UML Generalization metaclass) primitive
> types defined in a user model (e.g. in a model library) ?
>
> Our specific use case would be that the user model defines an
> enumeration which specalizes a primitive type defined in a model library
> which specializes one of the UML defined primitive types (that latter
> specialization we have working, the question is about the former).
>
> 2. Does the UML2 implementation of Eclipse support that ?
>
> Andy
|
|
|
Re: Can enumerations specialize primitive types ? [message #471941 is a reply to message #471925] |
Wed, 28 March 2007 10:13 |
Andreas Maier Messages: 32 Registered: July 2009 |
Member |
|
|
Dave,
would you mind pointing me to the place in the UML specs where it says
that an Enumeration instance cannot specialize an PrimitiveType instance
by means of a Generalization instance ? I did not find any such
restriction in the UML Superstructure Spec V2.1.1.
Andy
Dave Carlson wrote:
> Andy,
> The UML2 spec prohibits this, so the UML2 implementation cannot support
> it. Or at a minimum, must create a validation error if your model
> includes such structures.
>
> I use a model structure almost exactly like what you describe in my XSD
> modeling tools, except that I define my datatype model libraries using
> instances of DataType instead of PrimitiveType. Modeling this way, an
> Enumeration *can* extend a DataType -- this is allowed by the spec. And
> a DataType can extend a DataType. But a DataType cannot extend a
> PrimitiveType.
>
> Cheers,
> Dave Carlson
>
> Andreas Maier wrote:
>> A UML Enumeration (metaclass) is a kind of UML Classifier (metaclass),
>> and the same is true for the UML PrimitiveType.
>>
>> As we all know, Classifiers can have a Generalization association (and
>> relationship) between them.
>>
>> Questions:
>>
>> 1. Does UML2 (i.e. the specs) allow that enumerations in a user model
>> specialize (via instance of the UML Generalization metaclass)
>> primitive types defined in a user model (e.g. in a model library) ?
>>
>> Our specific use case would be that the user model defines an
>> enumeration which specalizes a primitive type defined in a model
>> library which specializes one of the UML defined primitive types (that
>> latter specialization we have working, the question is about the former).
>>
>> 2. Does the UML2 implementation of Eclipse support that ?
>>
>> Andy
|
|
| |
Re: Can enumerations specialize primitive types ? [message #471949 is a reply to message #471944] |
Wed, 28 March 2007 12:47 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
In case it isn't clear, the wording of this query might rather use the term
"metaclass" than "type". So, read it as:
The query maySpecializeType() determines whether this classifier may
have a generalization relationship to classifiers of the specified
[metaclass]. By default a classifier may specialize classifiers
of the same or a more general [metaclass]. It is intended to be
redefined by classifiers that have different specialization constraints.
Another important consequence of this constraint is that AssociationClasses
may specialize Classes, but not vice-versa.
I'll pick on the OCL representation of this constraint, too: note that
"oclType" is not a property (nor is "oclType()" an operation) defined by
OCL. As it stands, today, this constraint cannot be specified in OCL; OCL
provides no facility for reflection on the metamodel.
Cheers,
Christian
Dave Carlson wrote:
> Andy,
> It is a constraint on all Classifier generalizations, p. 54 of the 2.1.1
> spec. PrimitiveType is a peer metaclass with Enumeration, both have
> DataType as their superclass. Thus, PrimitiveType is not of the same or
> more general type wrt Enumeration.
>
> I investigated this a year ago, because I wanted to do exactly what you
> are trying to do...
>
> [8] The query maySpecializeType() determines whether this classifier may
> have a generalization relationship to classifiers of
> the specified type. By default a classifier may specialize classifiers
> of the same or a more general type. It is intended to be
> redefined by classifiers that have different specialization constraints.
>
> Classifier::maySpecializeType(c : Classifier) : Boolean;
> maySpecializeType = self.oclIsKindOf(c.oclType)
>
> Andreas Maier wrote:
>> Dave,
>> would you mind pointing me to the place in the UML specs where it says
>> that an Enumeration instance cannot specialize an PrimitiveType instance
>> by means of a Generalization instance ? I did not find any such
>> restriction in the UML Superstructure Spec V2.1.1.
>>
|
|
|
Re: Can enumerations specialize primitive types ? [message #471962 is a reply to message #471949] |
Wed, 28 March 2007 15:26 |
Andreas Maier Messages: 32 Registered: July 2009 |
Member |
|
|
Dave, Christian,
I think it is clear now. Thanks!
I first was confused whether you are talking about specialization in a
user model, vs. specialization in the UML metaclass hierarchy, but the
key to understand is that the query maySpecializeType() defines a
default rule that (sort of) maps the UML metaclass inheritance hierarchy
into the type inheritance hierarchy of the user model.
I agree with Christian that the clarity of the text would benefit from
talking about metaclasses.
Let me know if you are aware of an existing OMG issue about this,
otherwise I'd submit one.
Thanks again for your help!
Andy
Christian W. Damus wrote:
> Hi,
>
> In case it isn't clear, the wording of this query might rather use the term
> "metaclass" than "type". So, read it as:
>
> The query maySpecializeType() determines whether this classifier may
> have a generalization relationship to classifiers of the specified
> [metaclass]. By default a classifier may specialize classifiers
> of the same or a more general [metaclass]. It is intended to be
> redefined by classifiers that have different specialization constraints.
>
> Another important consequence of this constraint is that AssociationClasses
> may specialize Classes, but not vice-versa.
>
> I'll pick on the OCL representation of this constraint, too: note that
> "oclType" is not a property (nor is "oclType()" an operation) defined by
> OCL. As it stands, today, this constraint cannot be specified in OCL; OCL
> provides no facility for reflection on the metamodel.
>
> Cheers,
>
> Christian
>
>
> Dave Carlson wrote:
>
>> Andy,
>> It is a constraint on all Classifier generalizations, p. 54 of the 2.1.1
>> spec. PrimitiveType is a peer metaclass with Enumeration, both have
>> DataType as their superclass. Thus, PrimitiveType is not of the same or
>> more general type wrt Enumeration.
>>
>> I investigated this a year ago, because I wanted to do exactly what you
>> are trying to do...
>>
>> [8] The query maySpecializeType() determines whether this classifier may
>> have a generalization relationship to classifiers of
>> the specified type. By default a classifier may specialize classifiers
>> of the same or a more general type. It is intended to be
>> redefined by classifiers that have different specialization constraints.
>>
>> Classifier::maySpecializeType(c : Classifier) : Boolean;
>> maySpecializeType = self.oclIsKindOf(c.oclType)
>>
>> Andreas Maier wrote:
>>> Dave,
>>> would you mind pointing me to the place in the UML specs where it says
>>> that an Enumeration instance cannot specialize an PrimitiveType instance
>>> by means of a Generalization instance ? I did not find any such
>>> restriction in the UML Superstructure Spec V2.1.1.
>>>
>
|
|
| |
Re: Can enumerations specialize primitive types ? [message #603261 is a reply to message #471821] |
Tue, 27 March 2007 16:44 |
Dave Carlson Messages: 402 Registered: July 2009 |
Senior Member |
|
|
Andy,
The UML2 spec prohibits this, so the UML2 implementation cannot support
it. Or at a minimum, must create a validation error if your model
includes such structures.
I use a model structure almost exactly like what you describe in my XSD
modeling tools, except that I define my datatype model libraries using
instances of DataType instead of PrimitiveType. Modeling this way, an
Enumeration *can* extend a DataType -- this is allowed by the spec. And
a DataType can extend a DataType. But a DataType cannot extend a
PrimitiveType.
Cheers,
Dave Carlson
Andreas Maier wrote:
> A UML Enumeration (metaclass) is a kind of UML Classifier (metaclass),
> and the same is true for the UML PrimitiveType.
>
> As we all know, Classifiers can have a Generalization association (and
> relationship) between them.
>
> Questions:
>
> 1. Does UML2 (i.e. the specs) allow that enumerations in a user model
> specialize (via instance of the UML Generalization metaclass) primitive
> types defined in a user model (e.g. in a model library) ?
>
> Our specific use case would be that the user model defines an
> enumeration which specalizes a primitive type defined in a model library
> which specializes one of the UML defined primitive types (that latter
> specialization we have working, the question is about the former).
>
> 2. Does the UML2 implementation of Eclipse support that ?
>
> Andy
|
|
|
Re: Can enumerations specialize primitive types ? [message #604049 is a reply to message #471925] |
Wed, 28 March 2007 10:13 |
Andreas Maier Messages: 32 Registered: July 2009 |
Member |
|
|
Dave,
would you mind pointing me to the place in the UML specs where it says
that an Enumeration instance cannot specialize an PrimitiveType instance
by means of a Generalization instance ? I did not find any such
restriction in the UML Superstructure Spec V2.1.1.
Andy
Dave Carlson wrote:
> Andy,
> The UML2 spec prohibits this, so the UML2 implementation cannot support
> it. Or at a minimum, must create a validation error if your model
> includes such structures.
>
> I use a model structure almost exactly like what you describe in my XSD
> modeling tools, except that I define my datatype model libraries using
> instances of DataType instead of PrimitiveType. Modeling this way, an
> Enumeration *can* extend a DataType -- this is allowed by the spec. And
> a DataType can extend a DataType. But a DataType cannot extend a
> PrimitiveType.
>
> Cheers,
> Dave Carlson
>
> Andreas Maier wrote:
>> A UML Enumeration (metaclass) is a kind of UML Classifier (metaclass),
>> and the same is true for the UML PrimitiveType.
>>
>> As we all know, Classifiers can have a Generalization association (and
>> relationship) between them.
>>
>> Questions:
>>
>> 1. Does UML2 (i.e. the specs) allow that enumerations in a user model
>> specialize (via instance of the UML Generalization metaclass)
>> primitive types defined in a user model (e.g. in a model library) ?
>>
>> Our specific use case would be that the user model defines an
>> enumeration which specalizes a primitive type defined in a model
>> library which specializes one of the UML defined primitive types (that
>> latter specialization we have working, the question is about the former).
>>
>> 2. Does the UML2 implementation of Eclipse support that ?
>>
>> Andy
|
|
| |
Re: Can enumerations specialize primitive types ? [message #604059 is a reply to message #471944] |
Wed, 28 March 2007 12:47 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi,
In case it isn't clear, the wording of this query might rather use the term
"metaclass" than "type". So, read it as:
The query maySpecializeType() determines whether this classifier may
have a generalization relationship to classifiers of the specified
[metaclass]. By default a classifier may specialize classifiers
of the same or a more general [metaclass]. It is intended to be
redefined by classifiers that have different specialization constraints.
Another important consequence of this constraint is that AssociationClasses
may specialize Classes, but not vice-versa.
I'll pick on the OCL representation of this constraint, too: note that
"oclType" is not a property (nor is "oclType()" an operation) defined by
OCL. As it stands, today, this constraint cannot be specified in OCL; OCL
provides no facility for reflection on the metamodel.
Cheers,
Christian
Dave Carlson wrote:
> Andy,
> It is a constraint on all Classifier generalizations, p. 54 of the 2.1.1
> spec. PrimitiveType is a peer metaclass with Enumeration, both have
> DataType as their superclass. Thus, PrimitiveType is not of the same or
> more general type wrt Enumeration.
>
> I investigated this a year ago, because I wanted to do exactly what you
> are trying to do...
>
> [8] The query maySpecializeType() determines whether this classifier may
> have a generalization relationship to classifiers of
> the specified type. By default a classifier may specialize classifiers
> of the same or a more general type. It is intended to be
> redefined by classifiers that have different specialization constraints.
>
> Classifier::maySpecializeType(c : Classifier) : Boolean;
> maySpecializeType = self.oclIsKindOf(c.oclType)
>
> Andreas Maier wrote:
>> Dave,
>> would you mind pointing me to the place in the UML specs where it says
>> that an Enumeration instance cannot specialize an PrimitiveType instance
>> by means of a Generalization instance ? I did not find any such
>> restriction in the UML Superstructure Spec V2.1.1.
>>
|
|
|
Re: Can enumerations specialize primitive types ? [message #604079 is a reply to message #471949] |
Wed, 28 March 2007 15:26 |
Andreas Maier Messages: 32 Registered: July 2009 |
Member |
|
|
Dave, Christian,
I think it is clear now. Thanks!
I first was confused whether you are talking about specialization in a
user model, vs. specialization in the UML metaclass hierarchy, but the
key to understand is that the query maySpecializeType() defines a
default rule that (sort of) maps the UML metaclass inheritance hierarchy
into the type inheritance hierarchy of the user model.
I agree with Christian that the clarity of the text would benefit from
talking about metaclasses.
Let me know if you are aware of an existing OMG issue about this,
otherwise I'd submit one.
Thanks again for your help!
Andy
Christian W. Damus wrote:
> Hi,
>
> In case it isn't clear, the wording of this query might rather use the term
> "metaclass" than "type". So, read it as:
>
> The query maySpecializeType() determines whether this classifier may
> have a generalization relationship to classifiers of the specified
> [metaclass]. By default a classifier may specialize classifiers
> of the same or a more general [metaclass]. It is intended to be
> redefined by classifiers that have different specialization constraints.
>
> Another important consequence of this constraint is that AssociationClasses
> may specialize Classes, but not vice-versa.
>
> I'll pick on the OCL representation of this constraint, too: note that
> "oclType" is not a property (nor is "oclType()" an operation) defined by
> OCL. As it stands, today, this constraint cannot be specified in OCL; OCL
> provides no facility for reflection on the metamodel.
>
> Cheers,
>
> Christian
>
>
> Dave Carlson wrote:
>
>> Andy,
>> It is a constraint on all Classifier generalizations, p. 54 of the 2.1.1
>> spec. PrimitiveType is a peer metaclass with Enumeration, both have
>> DataType as their superclass. Thus, PrimitiveType is not of the same or
>> more general type wrt Enumeration.
>>
>> I investigated this a year ago, because I wanted to do exactly what you
>> are trying to do...
>>
>> [8] The query maySpecializeType() determines whether this classifier may
>> have a generalization relationship to classifiers of
>> the specified type. By default a classifier may specialize classifiers
>> of the same or a more general type. It is intended to be
>> redefined by classifiers that have different specialization constraints.
>>
>> Classifier::maySpecializeType(c : Classifier) : Boolean;
>> maySpecializeType = self.oclIsKindOf(c.oclType)
>>
>> Andreas Maier wrote:
>>> Dave,
>>> would you mind pointing me to the place in the UML specs where it says
>>> that an Enumeration instance cannot specialize an PrimitiveType instance
>>> by means of a Generalization instance ? I did not find any such
>>> restriction in the UML Superstructure Spec V2.1.1.
>>>
>
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 14:54:50 GMT 2024
Powered by FUDForum. Page generated in 0.05251 seconds
|