Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EObjectValidator Rationale(I am having a hard time understanding the EObjectValidator code)
icon5.gif  EObjectValidator Rationale [message #1716959] Wed, 09 December 2015 10:07 Go to next message
Josh Mengerink is currently offline Josh MengerinkFriend
Messages: 1
Registered: March 2015
Junior Member
Hi,

My name is Josh, I am a PhD student investigating model migration techniques. As part of my current research line I am attempting to understand precisely what the constraints are between models and their meta-models.

Unfortunately I was only able to find formal (OCL) specifications for meta-model conformance to meta-meta-models (Is there a formal specificiation in existence that I missed?).
Thus, I am attempting to distill these requirements myself from the EObjectValidator (org.eclipse.emf.ecore.util.EObjectValidator).

Some validation functions are clear. However, I have some questions to the rationale behind a few that I am hoping somebody can help me with:

* validate_UniqueID simply returns true?
* Why is validate_BidirectionalReferenceIsPaired only performed on references that has "isResolveProxies"? (in isResolveProxies).
* In validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context), why is there a recursive call to the 0th supertype? (result &= validate(eSuperTypes.get(0), eObject, diagnostics, context)Wink I would expect a call to all supertypes, or there to be a validation against the class itself, why are neither performed?

I hope somebody can help me with this Smile

Kind regards,

Josh
Re: EObjectValidator Rationale [message #1717022 is a reply to message #1716959] Wed, 09 December 2015 15:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Josh,

Comments below.

On 09/12/2015 4:15 PM, Josh Mengerink wrote:
> Hi,
>
> My name is Josh, I am a PhD student investigating model migration
> techniques. As part of my current research line I am attempting to
> understand precisely what the constraints are between models and their
> meta-models.
>
> Unfortunately I was only able to find formal (OCL) specifications for
> meta-model conformance to meta-meta-models (Is there a formal
> specificiation in existence that I missed?). Thus, I am attempting to
> distill these requirements myself from the EObjectValidator
> (org.eclipse.emf.ecore.util.EObjectValidator).
>
> Some validation functions are clear. However, I have some questions to
> the rationale behind a few that I am hoping somebody can help me with:
>
> * validate_UniqueID simply returns true?
EAttributes with isID true are used within a Resource to look up objects
based on that ID, i.e., in
org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObjectByID(String).
This constraints checks that all objects contained in the resource have
different IDs. This is the analog of the validation checking that
validating XML parsers to for attributes of type ID.
> * Why is validate_BidirectionalReferenceIsPaired only performed on
> references that has "isResolveProxies"? (in isResolveProxies).
Because it's impossible to violate this constraint using the
non-resolving bidirectional references. Only with inconsistent proxy
references is it possible for this referential integrity constraint to
be violated.
> * In validate(EClass eClass, EObject eObject, DiagnosticChain
> diagnostics, Map<Object, Object> context), why is there a recursive
> call to the 0th supertype? (result &= validate(eSuperTypes.get(0),
> eObject, diagnostics, context);) I would expect a call to all
> supertypes, or there to be a validation against the class itself, why
> are neither performed?
Because of so-called diamond inheritance, it's possible that recursive
visiting of all super types would visit the same constraints more than
once so that must be avoided. Also, in general, for dynamic models,
only the primary (first inherited) super type can be a generated type
and only it could have generated constraints so this logic is just
finding the right generated validator. If there are no generated
validators at all, it will just uses the EObjectValidator which does
just the intrinsic constraints. Generated validators know all the
constraints of all the supers and delegate properly, ensuring that no
constraint is checked more than once.
>
> I hope somebody can help me with this :)
>
> Kind regards,
>
> Josh


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Survey about new tool for modelling and DSL design
Next Topic:Serializing EMF objects to StringBuffer
Goto Forum:
  


Current Time: Tue Mar 19 05:44:28 GMT 2024

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

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

Back to the top