Skip to main content



      Home
Home » Modeling » EMF » [EMF Validation] how can i control multiple context?
[EMF Validation] how can i control multiple context? [message #895678] Sat, 14 July 2012 15:13 Go to next message
Eclipse UserFriend
Hi;

Can I control multiple context at the same time with the same constraint created by EMF Validation Framework.

please help me;
Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895693 is a reply to message #895678] Sun, 15 July 2012 01:15 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure I understand your question. Core validation methods take a
context argument that's a map. You can use that map to store and to
extract information for reuse/caching during a single validation
invocation across all the objects visited by the validator during that
invocation.

On 14/07/2012 9:13 PM, wiwa wiwa wrote:
> Hi;
>
> Can I control multiple context at the same time with the same
> constraint created by EMF Validation Framework.
>
> please help me;
> Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895695 is a reply to message #895678] Sun, 15 July 2012 01:15 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure I understand your question. Core validation methods take a
context argument that's a map. You can use that map to store and to
extract information for reuse/caching during a single validation
invocation across all the objects visited by the validator during that
invocation.

On 14/07/2012 9:13 PM, wiwa wiwa wrote:
> Hi;
>
> Can I control multiple context at the same time with the same
> constraint created by EMF Validation Framework.
>
> please help me;
> Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895697 is a reply to message #895678] Sun, 15 July 2012 01:15 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure I understand your question. Core validation methods take a
context argument that's a map. You can use that map to store and to
extract information for reuse/caching during a single validation
invocation across all the objects visited by the validator during that
invocation.

On 14/07/2012 9:13 PM, wiwa wiwa wrote:
> Hi;
>
> Can I control multiple context at the same time with the same
> constraint created by EMF Validation Framework.
>
> please help me;
> Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895699 is a reply to message #895678] Sun, 15 July 2012 01:15 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure I understand your question. Core validation methods take a
context argument that's a map. You can use that map to store and to
extract information for reuse/caching during a single validation
invocation across all the objects visited by the validator during that
invocation.

On 14/07/2012 9:13 PM, wiwa wiwa wrote:
> Hi;
>
> Can I control multiple context at the same time with the same
> constraint created by EMF Validation Framework.
>
> please help me;
> Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895706 is a reply to message #895693] Sun, 15 July 2012 03:44 Go to previous messageGo to next message
Eclipse UserFriend
This map object match only one class in the source model(for example Book),or we can control several classes for example (book and writer) at the same time with the same constraint. So that,we can create a constraint to check the duplicated name (of attribute name of book and writer class) in the instance model.

Thank you for your help;
Re: [EMF Validation] how can i control multiple context? [message #895711 is a reply to message #895706] Sun, 15 July 2012 04:43 Go to previous messageGo to next message
Eclipse UserFriend
Comments below.

On 15/07/2012 9:44 AM, wiwa wiwa wrote:
> This map object match only one class in the source model(for example
> Book),or we can control several classes for example (book and writer)
> at the same time with the same constraint.
The same map is used throughout the validation invocation.
> So that,we can create a constraint to check the duplicated name (of
> attribute name of book and writer class) in the instance model.
Likely that's better implemented as a constraint on the library that
contains both these things. After all, such attributes probably don't
need to be unique cross two different library instances and you might
well invoke validation for a resource containing two libraries.
>
> Thank you for your help;
Re: [EMF Validation] how can i control multiple context? [message #895723 is a reply to message #895678] Sun, 15 July 2012 07:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I'm assuming you're asking about the org.eclipse.emf.validation API and
not Ecore validation.

Yes, whatever the constraint's descriptor accepts in the
targetsTypeOf() method, the constraint implementation must be prepared
to accept and check its condition on. A constraint can check any
number of different kinds of objects; presumably it would look at what
kind of object it is to determine how to check it.

If you're asking about client-context bindings, then yes, a constraint
may be bound to any number of client-contexts. There is no restriction.

HTH,

Christian

On 2012-07-14 19:13:17 +0000, wiwa wiwa said:

> Hi;
>
> Can I control multiple context at the same time with the same
> constraint created by EMF Validation Framework.
>
> please help me;
> Thank you;
Re: [EMF Validation] how can i control multiple context? [message #895854 is a reply to message #895723] Mon, 16 July 2012 06:29 Go to previous messageGo to next message
Eclipse UserFriend
Yes I asking about org.eclipse.emf.validation API.
But my main problem that I can't arrive to manipulate several class in the same constraint to compare their different instance????
As I have already said,I want compare the attribute "name" of all instance "Writer and Book" to check the duplicated name.
So ,when the constraint will be execute it must verify that all instance (of Book and Writer for example) does not have the same name.
Thank you for your help (ed Makers and Christian).
Re: [EMF Validation] how can i control multiple context? [message #895905 is a reply to message #895854] Mon, 16 July 2012 09:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

OK, so Ed's advice applies equally to this validation API. Your best
bet is probably a constraint on the Library class that checks for
uniqueness of all of the names of the Books within it, and another
constraint also on the Library class that checks for uniqueness of all
of the Writers. I suggest separate constraints because these logically
would seem to be separate namespaces. There shouldn't be any problem
having a Book that has a title equal to a Writer's name (it might be a
biography of the writer!).

But, perhaps the library is just an analogy for your specific proprietary case.

Anyhow, if your model has multiple Library instances and you need to
check uniqueness across all libraries, then it gets a bit more
interesting. Do your Libraries comprise a hierarchical containment
structure? If so, the topmost library (the first visited by
validation) can check all of the books and writers in its entire
subtree and then use the
IValidationContext::skipCurrentConstraintFor(…) API to tell the
validation service that the nested libraries have already been checked
and that it can skip them, to avoid redundant calculation and reporting
of problems.

HTH,

Christian

On 2012-07-16 10:29:55 +0000, wiwa wiwa said:

> Yes I asking about org.eclipse.emf.validation API.
> But my main problem that I can't arrive to manipulate several class in
> the same constraint to compare their different instance????
> As I have already said,I want compare the attribute "name" of all
> instance "Writer and Book" to check the duplicated name.
> So ,when the constraint will be execute it must verify that all
> instance (of Book and Writer for example) does not have the same name.
> Thank you for your help (ed Makers and Christian).
Re: [EMF Validation] how can i control multiple context? [message #895935 is a reply to message #895905] Mon, 16 July 2012 10:37 Go to previous messageGo to next message
Eclipse UserFriend
But the Library Model is just an analogue to the example that I treat it.
So, In the context of my model I need to verify this constraint which combine several class at the same time.
That why I can't seperate this constraint and treat each class aside.
Re: [EMF Validation] how can i control multiple context? [message #895939 is a reply to message #895935] Mon, 16 July 2012 10:59 Go to previous message
Eclipse UserFriend
Do the things you're trying to constrain have a common container? Ecore
itself has constraints not so different, as I already mentioned, e.g.,
the eClassifiers of an EPackage must have unique names. Also, the
eAllStructureFeatures of an eClass, i.e., the ones contained locally and
the ones inherited from the eSuperTypes must be unique. In both these
cases, the constraint is on that container object.


On 16/07/2012 4:37 PM, wiwa wiwa wrote:
> But the Library Model is just an analogue to the example that I treat
> it. So, In the context of my model I need to verify this constraint
> which combine several class at the same time.
> That why I can't seperate this constraint and treat each class aside.
Previous Topic:[CDO 4.1] : Reattachment issue with EOpposite
Next Topic:creating a registry for objects with certain identifying features
Goto Forum:
  


Current Time: Tue Jul 15 19:48:57 EDT 2025

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

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

Back to the top