Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Model instance constraints/rules
Model instance constraints/rules [message #417852] Thu, 27 March 2008 08:39 Go to next message
Eclipse UserFriend
Originally posted by: nima.mazloumi.gmx.de

Hi,

is there a way to model constraints/rules for model instances?

Here is the scenario:

Class A has the attribute name (EString). At runtime there can be many A instances but only one with the attribute name "foo".
I could customize the generated code for that but I was wondering if there is some kind of constraint/rule language that could be used for this purpose.

Thanks,
Nima
Re: Model instance constraints/rules [message #417858 is a reply to message #417852] Thu, 27 March 2008 12:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040308060203070005050300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Nima,

You could implement this as a named constraint on class A and write the
logic for the constraint in Java in the generated validator class as
described in

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc//references/overview/EMF.Validation.html

I could imagine you might be able to describe the constraint using OCL.
Christian has written some nice articles about how the generator
templates could be specialized to generate OCL-based constraints.


Nima Mazloumi wrote:
> Hi,
>
> is there a way to model constraints/rules for model instances?
>
> Here is the scenario:
>
> Class A has the attribute name (EString). At runtime there can be many
> A instances but only one with the attribute name "foo".
> I could customize the generated code for that but I was wondering if
> there is some kind of constraint/rule language that could be used for
> this purpose.
>
> Thanks,
> Nima


--------------040308060203070005050300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Nima,<br>
<br>
You could implement this as a named constraint on class A and write the
logic for the constraint in Java in the generated validator class as
described in<br>
<blockquote><a
href=" http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc//references/overview/EMF.Validation.html"> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc//references/overview/EMF.Validation.html</a><br>
</blockquote>
I could imagine you might be able to describe the constraint using
OCL.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Model instance constraints/rules [message #417868 is a reply to message #417858] Thu, 27 March 2008 17:05 Go to previous message
Eclipse UserFriend
Originally posted by: nima.mazloumi.gmx.de

Thank you

Ed Merks schrieb:
> Nima,
>
> You could implement this as a named constraint on class A and write the
> logic for the constraint in Java in the generated validator class as
> described in
>
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc//references/overview/EMF.Validation.html
>
> I could imagine you might be able to describe the constraint using OCL.
> Christian has written some nice articles about how the generator
> templates could be specialized to generate OCL-based constraints.
>
>
> Nima Mazloumi wrote:
>> Hi,
>>
>> is there a way to model constraints/rules for model instances?
>>
>> Here is the scenario:
>>
>> Class A has the attribute name (EString). At runtime there can be many
>> A instances but only one with the attribute name "foo".
>> I could customize the generated code for that but I was wondering if
>> there is some kind of constraint/rule language that could be used for
>> this purpose.
>>
>> Thanks,
>> Nima
>
Previous Topic:Creating an RCP Application with EMF
Next Topic:Creating a simple Dialog (Button, Textfield, Label)
Goto Forum:
  


Current Time: Thu Apr 25 19:54:29 GMT 2024

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

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

Back to the top