Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Re: Basic validation
Re: Basic validation [message #427368] Sat, 14 February 2009 13:17 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Adrian,

Please use the EMF newsgroup, which I've included in the "to" list of
the reply, for asking questions about EMF.

Yes, it's possible to create a circular containment. We should ensure
that this doesn't break EcoreUtil.getURI with an out of memory exception
and should ensure that the Diagnostician diagnoses it rather then stack
overflowing. Please open an EMF bugzilla and I'll look into addressing
both issues.


Adrian Rutle wrote:
> Hi
> I want to learn how to validate Ecore models against basic constraints
> such as multiplicity and containment. I have created a simple Ecore
> model and generated code for it (attached). I have also written a test
> class to populate the model programmatically (attached).
>
> Have I done everything correct? If yes, why the validation of "re"
> returns true even though I have a cyclic containment: c1 contains e1 and
> e1 contains c1.
>
> I have also generated the edit and editor plugins. When I run the editor
> plugin, I still can create cyclic containment without getting any
> validation problems. However, I think in that case the names of the
> objects are not considered as identifiers.
>
> Best regards
>
> Adrian
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Basic validation [message #427370 is a reply to message #427368] Sat, 14 February 2009 14:37 Go to previous messageGo to next message
Adrian Rutle is currently offline Adrian RutleFriend
Messages: 20
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ed Merks wrote:
> Adrian,
>
> Please use the EMF newsgroup, which I've included in the "to" list of
> the reply, for asking questions about EMF.
Thanks, and sorry about this, I must have overseen the "to" field when I
sent the email ;-/
>
> Yes, it's possible to create a circular containment. We should ensure
> that this doesn't break EcoreUtil.getURI with an out of memory exception
> and should ensure that the Diagnostician diagnoses it rather then stack
> overflowing. Please open an EMF bugzilla and I'll look into addressing
> both issues.

A bug is reported. I assume the methods which I use to validate the
model are two of many existing validation methods, however, I am not
sure whether I have chosen the best way validate my model. Any comments
about this?

Best regards
Adrian

>
>
> Adrian Rutle wrote:
>> Hi
>> I want to learn how to validate Ecore models against basic constraints
>> such as multiplicity and containment. I have created a simple Ecore
>> model and generated code for it (attached). I have also written a test
>> class to populate the model programmatically (attached).
>>
>> Have I done everything correct? If yes, why the validation of "re"
>> returns true even though I have a cyclic containment: c1 contains e1 and
>> e1 contains c1.
>>
>> I have also generated the edit and editor plugins. When I run the editor
>> plugin, I still can create cyclic containment without getting any
>> validation problems. However, I think in that case the names of the
>> objects are not considered as identifiers.
>>
>> Best regards
>>
>> Adrian
>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkmW1zoACgkQtwhuhvDfdhiHOgCdGv4D00ZydTEBxaYKzLjw T2DH
VhEAn3bRpTjJimmPs4Xh+EvHil0TucUF
=GB+e
-----END PGP SIGNATURE-----
Re: Basic validation [message #427372 is a reply to message #427370] Sat, 14 February 2009 17:59 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.
--------------010808000803090908030104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Adrian,

Diagnostician.INSTANCE.validate is the best way. Using model specific
ones like EcoreValidator isn't generally a good idea because your actual
object might be of a derived class from another package...


Adrian Rutle wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ed Merks wrote:
>
>> Adrian,
>>
>> Please use the EMF newsgroup, which I've included in the "to" list of
>> the reply, for asking questions about EMF.
>>
> Thanks, and sorry about this, I must have overseen the "to" field when I
> sent the email ;-/
>
>> Yes, it's possible to create a circular containment. We should ensure
>> that this doesn't break EcoreUtil.getURI with an out of memory exception
>> and should ensure that the Diagnostician diagnoses it rather then stack
>> overflowing. Please open an EMF bugzilla and I'll look into addressing
>> both issues.
>>
>
> A bug is reported. I assume the methods which I use to validate the
> model are two of many existing validation methods, however, I am not
> sure whether I have chosen the best way validate my model. Any comments
> about this?
>
> Best regards
> Adrian
>
>
>> Adrian Rutle wrote:
>>
>>> Hi
>>> I want to learn how to validate Ecore models against basic constraints
>>> such as multiplicity and containment. I have created a simple Ecore
>>> model and generated code for it (attached). I have also written a test
>>> class to populate the model programmatically (attached).
>>>
>>> Have I done everything correct? If yes, why the validation of "re"
>>> returns true even though I have a cyclic containment: c1 contains e1 and
>>> e1 contains c1.
>>>
>>> I have also generated the edit and editor plugins. When I run the editor
>>> plugin, I still can create cyclic containment without getting any
>>> validation problems. However, I think in that case the names of the
>>> objects are not considered as identifiers.
>>>
>>> Best regards
>>>
>>> Adrian
>>>
>>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkmW1zoACgkQtwhuhvDfdhiHOgCdGv4D00ZydTEBxaYKzLjw T2DH
> VhEAn3bRpTjJimmPs4Xh+EvHil0TucUF
> =GB+e
> -----END PGP SIGNATURE-----
>

--------------010808000803090908030104
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Adrian,<br>
<br>
Diagnostician.INSTANCE.validate is the best way.&nbsp; Using model specific
ones like EcoreValidator isn't generally a good idea because your
actual object might be of a derived class from another package...<br>
<br>
<br>
Adrian Rutle wrote:
<blockquote cite="mid:gn6l0f$ud8$1@build.eclipse.org" type="cite">
<pre wrap="">-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ed Merks wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Adrian,

Please use the EMF newsgroup, which I've included in the "to" list of
the reply, for asking questions about EMF.
</pre>
</blockquote>
<pre wrap=""><!---->Thanks, and sorry about this, I must have overseen the "to" field when I
sent the email ;-/
</pre>
<blockquote type="cite">
<pre wrap="">Yes, it's possible to create a circular containment. We should ensure
that this doesn't break EcoreUtil.getURI with an out of memory exception
and should ensure that the Diagnostician diagnoses it rather then stack
overflowing. Please open an EMF bugzilla and I'll look into addressing
both issues.
</pre>
</blockquote>
<pre wrap=""><!---->
A bug is reported. I assume the methods which I use to validate the
model are two of many existing validation methods, however, I am not
sure whether I have chosen the best way validate my model. Any comments
about this?

Best regards
Adrian

</pre>
<blockquote type="cite">
<pre wrap="">
Adrian Rutle wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi
I want to learn how to validate Ecore models against basic constraints
such as multiplicity and containment. I have created a simple Ecore
model and generated code for it (attached). I have also written a test
class to populate the model programmatically (attached).

Have I done everything correct? If yes, why the validation of "re"
returns true even though I have a cyclic containment: c1 contains e1 and
e1 contains c1.

I have also generated the edit and editor plugins. When I run the editor
plugin, I still can create cyclic containment without getting any
validation problems. However, I think in that case the names of the
objects are not considered as identifiers.

Best regards

Adrian

</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - <a class="moz-txt-link-freetext" href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a>

iEYEARECAAYFAkmW1zoACgkQtwhuhvDfdhiHOgCdGv4D00ZydTEBxaYKzLjw T2DH
VhEAn3bRpTjJimmPs4Xh+EvHil0TucUF
=GB+e
-----END PGP SIGNATURE-----
</pre>
</blockquote>
</body>
</html>

--------------010808000803090908030104--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Basic validation [message #427373 is a reply to message #427372] Sun, 15 February 2009 10:17 Go to previous message
Adrian Rutle is currently offline Adrian RutleFriend
Messages: 20
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ed Merks wrote:
> Adrian,
>
> Diagnostician.INSTANCE.validate is the best way. Using model specific
> ones like EcoreValidator isn't generally a good idea because your actual
> object might be of a derived class from another package...

Many thanks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkmX67gACgkQtwhuhvDfdhjD2QCg1AHrLka5BsZIZAAFu8ri DJcF
hscAoK/WyL5MjUOASyYkLbIu7FkQs9AG
=JN6S
-----END PGP SIGNATURE-----
Previous Topic:Coding Practices: auto-renaming children
Next Topic:Re: xml schema importer
Goto Forum:
  


Current Time: Fri Apr 26 01:08:05 GMT 2024

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

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

Back to the top