Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Some OCL beginner questions
Some OCL beginner questions [message #557267] Mon, 06 September 2010 11:18 Go to next message
Heiko is currently offline HeikoFriend
Messages: 43
Registered: July 2009
Member
Hi,
from an old application, I use the xsd-schmea to build a new EMF model.
This is also complete atthe most things, the only big point at the
moment are the attribute definitions and also the validation of it.

In our old xsd, we had many type definitions with inheritance and so one.

Now I want to dissolve theses type definitions and put the constrains of
it into ocl definitions for validating.

For this I test some things and also do rebuild the tutorial inside the
eclipse documentation, but I do have some stupid questions and I hope
somebody can answer me or can point me to a solution.

1. Reusing an OCL expression on some points:
Many of my needed expressions I need on more points, e.g.
the length of a String should not be longer than 30
( self.<attribute>.size()<30 )
It is possible to define this expression one time an use it for
a) diffrent attributes inside one class
b) diffrent attributes inside diffrent classes of one package
c) diffrent attributes inside diffrent classes of one package and his
subpackages?


2. Type definitions inside XML allows inheritence, it is poossible to
use the expression of quition 1 and extend it with an other expression
like: first char must be an "A" ?

3. Using RegEx expresion inside an OCL expression,
is at the moment only available with Customize the environment ?
http://www.eclipse.org/forums/index.php?t=tree&th=10433& amp;S=14a8a1aea530c5f36c12ae0b49a03269
http://www.eclipse.org/forums/index.php?t=msg&goto=49060 5&

Or comes up an better solution with the Helios release?


Thanks in advance for your answers

Heiko
Re: Some OCL beginner questions [message #557315 is a reply to message #557267] Mon, 06 September 2010 15:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Heiko

Inline...

On 06/09/2010 12:18, Heiko wrote:
> Hi,
> from an old application, I use the xsd-schmea to build a new EMF model.
> This is also complete atthe most things, the only big point at the
> moment are the attribute definitions and also the validation of it.
>
> In our old xsd, we had many type definitions with inheritance and so one.
>
> Now I want to dissolve theses type definitions and put the constrains of
> it into ocl definitions for validating.
>
> For this I test some things and also do rebuild the tutorial inside the
> eclipse documentation, but I do have some stupid questions and I hope
> somebody can answer me or can point me to a solution.
>
> 1. Reusing an OCL expression on some points:
> Many of my needed expressions I need on more points, e.g.
> the length of a String should not be longer than 30
> ( self.<attribute>.size()<30 )
> It is possible to define this expression one time an use it for
> a) diffrent attributes inside one class
> b) diffrent attributes inside diffrent classes of one package
> c) diffrent attributes inside diffrent classes of one package and his
> subpackages?

I can't see a question here.
>
>
> 2. Type definitions inside XML allows inheritence, it is poossible to
> use the expression of quition 1 and extend it with an other expression
> like: first char must be an "A" ?
>
Yes, The standard way to re-use partial expressions is to place them in
functions/operations/procedures.

> 3. Using RegEx expresion inside an OCL expression,
> is at the moment only available with Customize the environment ?
> http://www.eclipse.org/forums/index.php?t=tree&th=10433& amp;S=14a8a1aea530c5f36c12ae0b49a03269
>
> http://www.eclipse.org/forums/index.php?t=msg&goto=49060 5&

regex is a pending OMG OCL issue which MDT/OCL will track/anticipate.

Regards

Ed Willink
Re: Some OCL beginner questions [message #557567 is a reply to message #557315] Wed, 08 September 2010 06:41 Go to previous messageGo to next message
Heiko is currently offline HeikoFriend
Messages: 43
Registered: July 2009
Member
Hi Ed,
thanks for your quick answer,
I have forgotten to say, at the moment I try to define the OCL
expressions with the OCLInEcore Editor.

For point 1:
I have a model class Person with the attributes name and surename
and for both should work the same expression like
self.{attribute}.size()<30
but at the moment I only know to define this with:
self.name.size()<30
self.surename.size()<30

I would like a more dynamic way, but I doesn't know how.





Am 06.09.2010 17:43, schrieb Ed Willink:
> Hi Heiko
>
> Inline...
>
> On 06/09/2010 12:18, Heiko wrote:
>> Hi,
>> from an old application, I use the xsd-schmea to build a new EMF model.
>> This is also complete atthe most things, the only big point at the
>> moment are the attribute definitions and also the validation of it.
>>
>> In our old xsd, we had many type definitions with inheritance and so one.
>>
>> Now I want to dissolve theses type definitions and put the constrains of
>> it into ocl definitions for validating.
>>
>> For this I test some things and also do rebuild the tutorial inside the
>> eclipse documentation, but I do have some stupid questions and I hope
>> somebody can answer me or can point me to a solution.
>>
>> 1. Reusing an OCL expression on some points:
>> Many of my needed expressions I need on more points, e.g.
>> the length of a String should not be longer than 30
>> ( self.<attribute>.size()<30 )
>> It is possible to define this expression one time an use it for
>> a) diffrent attributes inside one class
>> b) diffrent attributes inside diffrent classes of one package
>> c) diffrent attributes inside diffrent classes of one package and his
>> subpackages?
>
> I can't see a question here.
>>
>>
>> 2. Type definitions inside XML allows inheritence, it is poossible to
>> use the expression of quition 1 and extend it with an other expression
>> like: first char must be an "A" ?
>>
> Yes, The standard way to re-use partial expressions is to place them in
> functions/operations/procedures.
>
>> 3. Using RegEx expresion inside an OCL expression,
>> is at the moment only available with Customize the environment ?
>> http://www.eclipse.org/forums/index.php?t=tree&th=10433& amp;S=14a8a1aea530c5f36c12ae0b49a03269
>>
>>
>> http://www.eclipse.org/forums/index.php?t=msg&goto=49060 5&
>
> regex is a pending OMG OCL issue which MDT/OCL will track/anticipate.
>
> Regards
>
> Ed Willink
Re: Some OCL beginner questions [message #557608 is a reply to message #557567] Wed, 08 September 2010 09:26 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Heiko

By more dynamic, I think you mean reflective. This is an ongoing
discussion topic and may appear in a future OCL specification and
MDT/OCL implementation.

Regards

Ed Willink

On 08/09/2010 07:41, Heiko wrote:
> Hi Ed,
> thanks for your quick answer,
> I have forgotten to say, at the moment I try to define the OCL
> expressions with the OCLInEcore Editor.
>
> For point 1:
> I have a model class Person with the attributes name and surename
> and for both should work the same expression like
> self.{attribute}.size()<30
> but at the moment I only know to define this with:
> self.name.size()<30
> self.surename.size()<30
>
> I would like a more dynamic way, but I doesn't know how.
>
>
>
>
>
> Am 06.09.2010 17:43, schrieb Ed Willink:
>> Hi Heiko
>>
>> Inline...
>>
>> On 06/09/2010 12:18, Heiko wrote:
>>> Hi,
>>> from an old application, I use the xsd-schmea to build a new EMF model.
>>> This is also complete atthe most things, the only big point at the
>>> moment are the attribute definitions and also the validation of it.
>>>
>>> In our old xsd, we had many type definitions with inheritance and so
>>> one.
>>>
>>> Now I want to dissolve theses type definitions and put the constrains of
>>> it into ocl definitions for validating.
>>>
>>> For this I test some things and also do rebuild the tutorial inside the
>>> eclipse documentation, but I do have some stupid questions and I hope
>>> somebody can answer me or can point me to a solution.
>>>
>>> 1. Reusing an OCL expression on some points:
>>> Many of my needed expressions I need on more points, e.g.
>>> the length of a String should not be longer than 30
>>> ( self.<attribute>.size()<30 )
>>> It is possible to define this expression one time an use it for
>>> a) diffrent attributes inside one class
>>> b) diffrent attributes inside diffrent classes of one package
>>> c) diffrent attributes inside diffrent classes of one package and his
>>> subpackages?
>>
>> I can't see a question here.
>>>
>>>
>>> 2. Type definitions inside XML allows inheritence, it is poossible to
>>> use the expression of quition 1 and extend it with an other expression
>>> like: first char must be an "A" ?
>>>
>> Yes, The standard way to re-use partial expressions is to place them in
>> functions/operations/procedures.
>>
>>> 3. Using RegEx expresion inside an OCL expression,
>>> is at the moment only available with Customize the environment ?
>>> http://www.eclipse.org/forums/index.php?t=tree&th=10433& amp;S=14a8a1aea530c5f36c12ae0b49a03269
>>>
>>>
>>>
>>> http://www.eclipse.org/forums/index.php?t=msg&goto=49060 5&
>>
>> regex is a pending OMG OCL issue which MDT/OCL will track/anticipate.
>>
>> Regards
>>
>> Ed Willink
>
Previous Topic:OCL check
Next Topic:Validation of OCL Constraints programmatically outside Eclipse
Goto Forum:
  


Current Time: Sat Apr 20 02:26:59 GMT 2024

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

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

Back to the top