Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Can Validation handle inter-model constraints?
Can Validation handle inter-model constraints? [message #62586] |
Thu, 23 November 2006 14:27 |
Eclipse User |
|
|
|
Originally posted by: rasmusmodsat.hotmail.com
Hi,
can the Validation framework handle constraints that span different EMF
models? So far, I've only seen examples of constraints on a single model.
My concrete problem is that I have two models a.ecore and b.ecore where the
following constraint should hold: forall instances of class A in a.ecore
there should be a corresponding instance of class B in b.ecore with the same
attribute values. The way I'm solving it at the moment is by writing some
custom java code.
I would prefer to write a constraint in an OCL-like manner. This seems to be
more concise and maintainable.
Idea: perhaps I could specify an extent which spanned two models in the
Query API's setExtentMap(..) method?
If anyone have ideas, references, links or anything else, I would be very
interested. Open source solutions, code snippets or even academic papers ;)
-- HW
|
|
| |
Re: Can Validation handle inter-model constraints? [message #62878 is a reply to message #62586] |
Tue, 28 November 2006 15:06 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hubertus,
Yes, validation can handle such cases. A constraint implemented in Java
(extending AbstractModelConstraint) can certainly do this, as it has access
to all models via the ResourceSet.
In the OCL case, you would have to define your own extent map, as you
suggested, that encompasses multiple resources (perhaps the entire
ResourceSet?). For this to work, however, you would need to define your
own 'constraint language' as indicated in the recent discussion in another
thread ("Custom EnvironmentFactory for OCL Constraints") in this newsgroup,
to plug in your extent map implementation.
Cheers,
Christian
Hubertus Wilder wrote:
> Hi,
>
> can the Validation framework handle constraints that span different EMF
> models? So far, I've only seen examples of constraints on a single model.
>
> My concrete problem is that I have two models a.ecore and b.ecore where
> the following constraint should hold: forall instances of class A in
> a.ecore there should be a corresponding instance of class B in b.ecore
> with the same attribute values. The way I'm solving it at the moment is by
> writing some custom java code.
>
> I would prefer to write a constraint in an OCL-like manner. This seems to
> be more concise and maintainable.
>
> Idea: perhaps I could specify an extent which spanned two models in the
> Query API's setExtentMap(..) method?
>
> If anyone have ideas, references, links or anything else, I would be very
> interested. Open source solutions, code snippets or even academic papers
> ;)
>
> -- HW
|
|
| |
Re: Can Validation handle inter-model constraints? [message #596261 is a reply to message #62586] |
Tue, 28 November 2006 15:06 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hubertus,
Yes, validation can handle such cases. A constraint implemented in Java
(extending AbstractModelConstraint) can certainly do this, as it has access
to all models via the ResourceSet.
In the OCL case, you would have to define your own extent map, as you
suggested, that encompasses multiple resources (perhaps the entire
ResourceSet?). For this to work, however, you would need to define your
own 'constraint language' as indicated in the recent discussion in another
thread ("Custom EnvironmentFactory for OCL Constraints") in this newsgroup,
to plug in your extent map implementation.
Cheers,
Christian
Hubertus Wilder wrote:
> Hi,
>
> can the Validation framework handle constraints that span different EMF
> models? So far, I've only seen examples of constraints on a single model.
>
> My concrete problem is that I have two models a.ecore and b.ecore where
> the following constraint should hold: forall instances of class A in
> a.ecore there should be a corresponding instance of class B in b.ecore
> with the same attribute values. The way I'm solving it at the moment is by
> writing some custom java code.
>
> I would prefer to write a constraint in an OCL-like manner. This seems to
> be more concise and maintainable.
>
> Idea: perhaps I could specify an extent which spanned two models in the
> Query API's setExtentMap(..) method?
>
> If anyone have ideas, references, links or anything else, I would be very
> interested. Open source solutions, code snippets or even academic papers
> ;)
>
> -- HW
|
|
|
Goto Forum:
Current Time: Sat Nov 09 04:52:13 GMT 2024
Powered by FUDForum. Page generated in 0.03022 seconds
|