Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Specifying constraints at Model Instance (M0) level.
Specifying constraints at Model Instance (M0) level. [message #670729] Sun, 15 May 2011 12:04 Go to next message
Nidhi  is currently offline Nidhi
Messages: 92
Registered: December 2009
Member

Hi,

I wanted to know if there is a mechanism to define constraints at the M0 or model instance level based on the created instances.

To give an overview my domain model in ECore looks something like this:

Service
- Parameter (0..n)

On instantiating this model I get something like this:

Pizza Delivery Service
- Customer Profile
- Geographic Location

I need to specify constraints such as:
if(Customer Profile == "Gold"), do this else do that...

As far as I understand about OCL, I can define constraints maximum at the domain model level (M1) and use it to validate the model instance (M0).

It would be really helpful to know if there is a mechanism for my above use case and if my understanding that I cannot use OCL for the same is correct.

Best Regards,
Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670769 is a reply to message #670729] Sun, 15 May 2011 12:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi Nidhi

It is Sunday.

This is an Open Source list.

Respondents are not paid.

You are more likely to get a response if you ask a clear question once,
rather than eight times, and if really necessary repeat it after a
couple of days.

Spam will generally be ignored.

Regards

Ed Willink



On 15/05/2011 13:04, Nidhi wrote:
> Hi,
>
> I wanted to know if there is a mechanism to define
> constraints at the M0 or model instance level based on the
> created instances.
>
> To give an overview my domain model in ECore looks something
> like this:
>
> Service
> - Parameter (0..n)
>
> On instantiating this model I get something like this:
>
> Pizza Delivery Service
> - Customer Profile
> - Geographic Location
>
> I need to specify constraints such as:
> if(Customer Profile == "Gold"), do this else do that...
>
> As far as I understand about OCL, I can define constraints
> maximum at the domain model level (M1) and use it to
> validate the model instance (M0).
>
> It would be really helpful to know if there is a mechanism
> for my above use case and if my understanding that I cannot
> use OCL for the same is correct.
>
> Best Regards,
> Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670783 is a reply to message #670769] Sun, 15 May 2011 14:45 Go to previous messageGo to next message
Nidhi  is currently offline Nidhi
Messages: 92
Registered: December 2009
Member

Hi Ed,

I am really sorry for the inconvenience, but this is NOT AT ALL intentional.

This seems to be a bug. I tried posting the question and every time I was taken to a blank page without my post but with "Quick Reply". Also when I tried clicking on the "Tree View" it simply said the link that led to the page was invalid and a notification was send to the Webmaster. The question was simply not getting posted.
As you can see many of the questions don't even have a subject, I am not sure if it is possible to create new posts without a subject.

I have reported this post to the moderators to help me delete all duplicate posts.

Hope I wont face any problem while trying to post this reply.

Best Regards,
Nidhi

[Updated on: Sun, 15 May 2011 15:00]

Report message to a moderator

Re: Specifying constraints at Model Instance (M0) level. [message #670812 is a reply to message #670783] Sun, 15 May 2011 17:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Nidhi,

I'm not sure I understand what you mean by instance level constraints.
Even your comments about "if something then do this else do that"
doesn't sound so much like a constraint; it sounds more like a rule for
actions. Maybe you should give a more complete example...


Nidhi wrote:
> Hi Ed,
>
> I am really sorry for the inconvenience, but this is NOT AT
> ALL intentional.
>
> This seems to be a bug. I tried posting the question and
> every time I was taken to a blank page with an option to
> respond. Also when I tried clicking on the "Tree View" it
> simply said the link that led to the page was invalid and a
> notification was send to the Webmaster. The question was
> simply not getting posted. As you can see many of the questions don't
> even have a
> subject, I am not sure if it is possible to create new
> posts without a subject.
>
> @Administrators: Can you please delete all these posts
> starting from "Sun, 15 May 2011 06:56" till this one.
> Hope I wont face any problem while trying to post this
> reply.
>
> Best Regards,
> Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670824 is a reply to message #670812] Sun, 15 May 2011 18:43 Go to previous messageGo to next message
Nidhi  is currently offline Nidhi
Messages: 92
Registered: December 2009
Member

Hi Ed,

Thanks for the quick response. My mistake, you are right these are rules not constraints.

I wanted to focus only on the expression: CustomerProfile == "Gold"

The use case is to just allow creation of these expressions, nothing to do with the action post the expression is evaluated.

This might be repetetive, but I'll try to rewrite the use case more clearly:

1. My domain Ecore model contains the following entities:
Stakeholder
- parameters : Parameter

2. On instantiating this model, I create the following entities:
Customer
- CustomerProfile

3. Now I need to define a expression on the instantiated Parameter entity such as the one above:
CustomerProfile == "Gold"

This expression would later be evaluated as a business rule and help identify the path in a business
process workflow to be taken. But for the time being I just need a mechanism to define the expression.

I tried using XText but it doesn't seem very apt and probably OCL is also the wrong place I am looking for.
I needed some pointers on what is a good mechanism to achieve this.

Or am I just thinking complicated and rather shall just create entity corresponding to an "Expression" in my
domain metamodel. The only thing is I would need to exhaustively consider all the artifacts of an expression
such as all types of Comparison Operators, ANDing and ORing various expressions, etc.

Ed, this might not be the right place to post the question but I really need some pointers to post it in the
right forum.

Thanks,
Best Regards,
Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670833 is a reply to message #670824] Sun, 15 May 2011 19:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Nidhi,

It seems to me you could easily use OCL to write such expressions (that
are evaluated against instances). Or course you could write them in
Java using the generated Java API for the model. Or you could look into
the XBase language provided by Xtext and use some derivative of that to
define your own expression language.


Nidhi wrote:
> Hi Ed,
>
> Thanks for the quick response. My mistake, you are right
> these are rules not constraints.
>
> I wanted to focus only on the expression: CustomerProfile ==
> "Gold"
>
> The use case is to just allow creation of these expressions,
> nothing to do with the action post the expression is
> evaluated.
>
> This might be repetetive, but I'll try to rewrite the use
> case more clearly:
>
> 1. My domain Ecore model contains the following entities:
> Stakeholder
> - parameters : Parameter
>
> 2. On instantiating this model, I create the following
> entities:
> Customer
> - CustomerProfile
>
> 3. Now I need to define a expression on the instantiated
> Parameter entity such as the one above:
> CustomerProfile == "Gold"
>
> This expression would later be evaluated as a business
> rule and help identify the path in a business
> process workflow to be taken. But for the time being I
> just need a mechanism to define the expression.
>
> I tried using XText but it doesn't seem very apt and
> probably OCL is also the wrong place I am looking for.
> I needed some pointers on what is a good mechanism to
> achieve this.
>
> Or am I just thinking complicated and rather shall just
> create entity corresponding to an "Expression" in my domain metamodel.
> The only thing is I would need to
> exhaustively consider all the artifacts of an expression
> such as all types of Comparison Operators, ANDing and ORing
> various expressions, etc.
>
> Ed, this might not be the right place to post the question
> but I really need some pointers to post it in the
> right forum.
>
> Thanks,
> Best Regards,
> Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670865 is a reply to message #670833] Mon, 16 May 2011 00:54 Go to previous messageGo to next message
Nidhi  is currently offline Nidhi
Messages: 92
Registered: December 2009
Member

Hi Ed,

So I was not very wrong in thinking of using OCL. But as far as I understand after reading on OCL is that it can help me
define constraints on the model (M1 level) and help evaluating these on the model instance (M0 level).

From the previous example, my model contains Stakeholder and Parameter and model instance contains Customer (corresponding to
Stakeholder) and CustomerProfile (corresponding to Parameter).

However, I need to enable end users of my tool to declaratively create expressions using the model instance CustomerProfile
and not model entity Parameter. So the end user first declaratively creates a model instance CustomerProfile and then declaratively defines the expression using it.(CustomerProfile == "Gold").

This leads to the first question I had asked, would it be possible to define constraints at M0 level using OCL. The reason of not using
JAVA API is because my tool should allow the end users (who are ideally business analysts) to declaratively create these expressions, hence
it would be good to have these expressions written in more intuitive format.
I shall have a look at XBase too in the mean while.

Best Regards,
Nidhi
Re: Specifying constraints at Model Instance (M0) level. [message #670897 is a reply to message #670865] Mon, 16 May 2011 05:50 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi Nidhi

The M0 discussion is an irrelevance; you want your users to program in
something.

Java is a GPL; you can do just about anything in it.

OCL is a DSL; much better for modelling; much worse for general purpose
work. You can make it more adequate with custom Java.

"end users (who are ideally business analysts)"

That is where you must start. What is acceptable/sellable to the users?
If they're not comfortable with meta-models then you may want to wrap
it up as SQL. I would not recommend OCL to users who are not keen on
models. If you've got to write a custom DSL, you will find Xbase much
easier to extend than OCL. Xbase perhaps has 90% of the functionality of
OCL; Xbase has very pragmatic support for models. Do you need the extra
10% that provides pedantic OMG compliance?

Regards

Ed Willink

On 16/05/2011 01:54, Nidhi wrote:
> Hi Ed,
>
> So I was not very wrong in thinking of using OCL. But as far
> as I understand after reading on OCL is that it can help me
> define constraints on the model (M1 level) and help
> evaluating these on the model instance (M0 level).
>
> From the previous example, my model contains Stakeholder and
> Parameter and model instance contains Customer
> (corresponding to
> Stakeholder) and CustomerProfile (corresponding to
> Parameter).
>
> However, I need to enable end users of my tool to
> declaratively create expressions using the model instance
> CustomerProfile
> and not model entity Parameter. So the end user first
> declaratively creates a model instance CustomerProfile and
> then declaratively defines the expression using
> it.(CustomerProfile == "Gold").
>
> This leads to the first question I had asked, would it be
> possible to define constraints at M0 level using OCL. The
> reason of not using
> JAVA API is because my tool should allow the end users (who
> are ideally business analysts) to declaratively create
> these expressions, hence
> it would be good to have these expressions written in more
> intuitive format. I shall have a look at XBase too in the mean while.
>
> Best Regards,
> Nidhi
Previous Topic:Identical models have (33) differences
Next Topic:[EMF4Net] Proposal
Goto Forum:
  


Current Time: Sun Sep 21 14:25:45 GMT 2014

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

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