Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » UML OCL and Date
UML OCL and Date [message #370966] Wed, 29 July 2009 03:48 Go to next message
RefuX Zanzeebarr is currently offline RefuX ZanzeebarrFriend
Messages: 51
Registered: July 2009
Member
Well color me a newbie, but I've run into an unexpected problem. I am
creating an attribute with a Date type in UML (RSA 7.5.1) and there is
no Date type :(
So I try to be smart and Import the Ecore datatypes and make the type of
my attribute EDate.

Then I add a classic OCL example constraint self.effectiveDate <
self.expirationDate

Of course I'm not completely excited about using an EDate, since I
really want to do a comparison on calendar days, not seconds.

So anyhoo... I generate my EMF code, OCL included in it (w00t!), run
validate:
java.lang.UnsupportedOperationException: Cannot find operation
(<(EDate)) for the type (EDate)


So I guess this leads to a few questions:
* Is there is standard UML type for Dates?
* Is there is standard way to dealing with this Date issue?
* Can I define a < operation of an EDate?
* If I use a custom Data Type (CalendarDate mayhaps?), how to I make it
'run' in OCL? (thought occurs to me, I create a daysSince1920 attribute
of type int and I write self.effectiveDate.daysSince1920 <
self.expirationDate.daysSince1920)

Answers to my late night rambling appreciated :)
Re: UML OCL and Date [message #371434 is a reply to message #370966] Wed, 29 July 2009 05:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi ReFuX

This seems like a query for the UML newsgroup; certainly OCL has no Date
type.

However any Java datatype can be used in your models by declaring it as
the instance type of an EDataType for your Ecore model.

Regards

Ed Willink


RefuX wrote:
> Well color me a newbie, but I've run into an unexpected problem. I am
> creating an attribute with a Date type in UML (RSA 7.5.1) and there is
> no Date type :(
> So I try to be smart and Import the Ecore datatypes and make the type of
> my attribute EDate.
>
> Then I add a classic OCL example constraint self.effectiveDate <
> self.expirationDate
>
> Of course I'm not completely excited about using an EDate, since I
> really want to do a comparison on calendar days, not seconds.
>
> So anyhoo... I generate my EMF code, OCL included in it (w00t!), run
> validate:
> java.lang.UnsupportedOperationException: Cannot find operation
> (<(EDate)) for the type (EDate)
>
>
> So I guess this leads to a few questions:
> * Is there is standard UML type for Dates?
> * Is there is standard way to dealing with this Date issue?
> * Can I define a < operation of an EDate?
> * If I use a custom Data Type (CalendarDate mayhaps?), how to I make it
> 'run' in OCL? (thought occurs to me, I create a daysSince1920 attribute
> of type int and I write self.effectiveDate.daysSince1920 <
> self.expirationDate.daysSince1920)
>
> Answers to my late night rambling appreciated :)
Re: UML OCL and Date [message #373316 is a reply to message #370966] Wed, 29 July 2009 13:50 Go to previous message
Eclipse UserFriend
Originally posted by: Alexander.Igdalov.borland.com

Hi RefuX,

> * Can I define a < operation of an EDate?

See
http://help.eclipse.org/galileo/topic/org.eclipse.ocl.doc/re ferences/overview/advanced/customization.html


HTH,
Alex.

RefuX wrote:
> Well color me a newbie, but I've run into an unexpected problem. I am
> creating an attribute with a Date type in UML (RSA 7.5.1) and there is
> no Date type :(
> So I try to be smart and Import the Ecore datatypes and make the type of
> my attribute EDate.
>
> Then I add a classic OCL example constraint self.effectiveDate <
> self.expirationDate
>
> Of course I'm not completely excited about using an EDate, since I
> really want to do a comparison on calendar days, not seconds.
>
> So anyhoo... I generate my EMF code, OCL included in it (w00t!), run
> validate:
> java.lang.UnsupportedOperationException: Cannot find operation
> (<(EDate)) for the type (EDate)
>
>
> So I guess this leads to a few questions:
> * Is there is standard UML type for Dates?
> * Is there is standard way to dealing with this Date issue?
> * Can I define a < operation of an EDate?
> * If I use a custom Data Type (CalendarDate mayhaps?), how to I make it
> 'run' in OCL? (thought occurs to me, I create a daysSince1920 attribute
> of type int and I write self.effectiveDate.daysSince1920 <
> self.expirationDate.daysSince1920)
>
> Answers to my late night rambling appreciated :)
Previous Topic:Generating code with OCL constraints etc.. in it
Next Topic:OCLExpressions
Goto Forum:
  


Current Time: Tue Mar 19 08:02:27 GMT 2024

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

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

Back to the top