Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Context and UML Usage relationship
OCL Context and UML Usage relationship [message #656086] Thu, 24 February 2011 04:32 Go to next message
Eban Escott is currently offline Eban EscottFriend
Messages: 61
Registered: July 2009
Member
Hi Ed,

Is it possible to use UML Usage in a OCL expression?

Here is a link and search for Usage.

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. uml2.doc/references/javadoc/org/eclipse/uml2/uml/package-tre e.html

I can create 2 classes with an Association and refer to this association in an OCL expression, no worries. I do not want to use an Association as the relationship is a usage. So, I change the relationship to a Usage and can't get the OCL expression to work.

Any ideas?

Hope all is well
Eban
Re: OCL Context and UML Usage relationship [message #656088 is a reply to message #656086] Thu, 24 February 2011 05:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Eban

OCL navigation expressions are defined for Associations and not for
Usages as you have found.

I'm not sure what the link is demonstrating. My Type hierarchy browser
shows an org.eclipse.uml2.uml.Usage, so the UML2 project supports Usage.

You can use Usage by using the UML meta-model as your model, but I'm not
sure that is what you want.

I am proposing that the unstable OclAny::oclType() specification be
resolved to support reflection and so return an OCL::Class that would
allow operating at the meta-model level. However I've not come up with
any strong examples of why OCL reflection is a good idea.

Your requirement seems very strange. If you can encapsulate it simply
and demonstrate why it is sensible to navigate a Usage I would like to
see the example and use it to drive the specification evolution.

[The new modelled library for the OCL evaluator in
org.eclipse.ocl.examples.pivot supports reflection, but the UML support
is currently limited to UML class-like entities; no Profiles.]

Regards

Ed Willink

On 24/02/2011 04:33, Eban Escott wrote:
> Hi Ed,
>
> Is it possible to use UML Usage in a OCL expression?
> Here is a link and search for Usage.
>
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. uml2.doc/references/javadoc/org/eclipse/uml2/uml/package-tre e.html
>
>
> I can create 2 classes with an Association and refer to this association
> in an OCL expression, no worries. I do not want to use an Association as
> the relationship is a usage. So, I change the relationship to a Usage
> and can't get the OCL expression to work.
>
> Any ideas?
>
> Hope all is well
> Eban
Re: OCL Context and UML Usage relationship [message #657485 is a reply to message #656086] Wed, 02 March 2011 23:33 Go to previous messageGo to next message
Eban Escott is currently offline Eban EscottFriend
Messages: 61
Registered: July 2009
Member
Hi Ed, thanks for getting back to me Smile and yes, I am using UML2.

The example I am working on is this:

I have a Product class and a ProductManager class. The ProductManager uses the Product class and I want to write some OCL on the ProductManager class that references a Product. Having a manager for a corresponding domain model entities is standard practice for some software architectures.

The relationship between the two classes is not a one-to-one, one-to-many, or many-to-many relationship like, for example, a one-to-many relationship between a Brand class and a Product class. So, I thought it would make more sense to use the UML2 usage as the ProductManager uses a Product.

I guess I need to spend some more time understanding the ins and outs of the OCL context and what I can use where. In the meantime, should I just use an association instead?

Hope all is well
Eban
Re: OCL Context and UML Usage relationship [message #657511 is a reply to message #657485] Thu, 03 March 2011 05:52 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Eban

UML provides a (too) large set of facilities, but not large enough to
cover modeling of specifications in natural language. You must map your
terminology to UML or use UML terminology.

UML associations, particularly multi-way Association Classes can model
many different relationships, you name the association as the
relationship. However they cannot do everything, such as re-Classing and
you may need to introduce intermediate Role classes.

Saying that your ProductManager to Product relationship is not 1:1, 1:*
or *:* so you'll use a Usage seems to me rather like, 'I don't know what
the relationship is so I'll use something else'. I think you need to
work much harder on understanding the realtionship so that you can them
model it. If it's really vague/flexible, you may need to introduce a
polymorphic hierarchy of ProductManagement classes for each category of
relationship.

The above is nothing to do with OCL or OCL contexts. Once you have a
UML model you can then add OCL to specify those aspects that cannot be
captured directly in UML.

Regards

Ed Willink

On 02/03/2011 23:33, Eban Escott wrote:
> Hi Ed, thanks for getting back to me :) and yes, I am using UML2.
>
> The example I am working on is this:
>
> I have a Product class and a ProductManager class. The ProductManager
> uses the Product class and I want to write some OCL on the
> ProductManager class that references a Product. Having a manager for a
> corresponding domain model entities is standard practice for some
> software architectures.
>
> The relationship between the two classes is not a one-to-one,
> one-to-many, or many-to-many relationship like, for example, a
> one-to-many relationship between a Brand class and a Product class.
> So, I thought it would make more sense to use the UML2 usage as the
> ProductManager uses a Product.
>
> I guess I need to spend some more time understanding the ins and outs
> of the OCL context and what I can use where. In the meantime, should I
> just use an association instead?
>
> Hope all is well
> Eban
Previous Topic:Get best overlapping collections
Next Topic:[CompleteOCL]definition uses definition
Goto Forum:
  


Current Time: Thu Apr 25 21:54:45 GMT 2024

Powered by FUDForum. Page generated in 0.03859 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top