Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » model doesn
model doesn [message #2821] Wed, 27 December 2006 05:16 Go to next message
Kelly  arcés is currently offline Kelly arcésFriend
Messages: 22
Registered: July 2009
Junior Member
Hello!

I have this transformation:

module mundo2arq;
create OUT : arquitectura from IN : feature;

when i configure launch, i add an in model called "discotienda.xmi", but
discotienda.xmi doesn
Re: model doesn´t conform to metamodel [message #2976 is a reply to message #2821] Thu, 28 December 2006 09:07 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

ATL simply delegates reading of EMF models to EMF.

Contrarily to MDR, EMF does not offer easy validation of a model against
a metamodel. You should ask the EMF people about how validation works.

Please let us know when you have a solution to your problem.
This may become a Howto entry :-).


Regards,

Frédéric Jouault

Kelly Garcés wrote:
> Hello!
>
> I have this transformation:
>
> module mundo2arq;
> create OUT : arquitectura from IN : feature;
>
> when i configure launch, i add an in model called "discotienda.xmi", but
> discotienda.xmi doesn´t conform "feature". However discotienda file has
> correct metamodel uri:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <mmmundo:EjercicioCupi2 xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:mmmundo="platform:/resource/Discotienda/mundo/mmmundo.ecore "
> nivel="8">
>
> 1- ATL validates relationship "conforms to" between discotienda.xmi and
> feature metamodel before running transformation?
>
> I reviewed "loadASMEMFModel" method in ASMEMFModel class (source ATL), but i
> didn´t find any validation
>
> 2- how could i validate relationship "conforms to" between model and
> metamodel?
>
> I reviewed EMF validation, but this validation checks each type of object in
> model... :(
> Is there some like this model.validate(metamodel)?
>
>
> Sincerely thanks for your help,
>
> Kelly.
>
>
Re: model doesn´t conform to metamodel [message #3010 is a reply to message #2976] Thu, 28 December 2006 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Frédéric,

You can use Diagnostician.INSTANCE.validate(eObject) to validate any
EObject against the constraints specified by its meta model; this will
invoke any constraints defined by the model itself, as well as the basic
constraints imposed by Ecore itself (such as conforming to the
multiplicity of the feature). Since eObject.eClass() gives the meta
model of the eObject, EMF's validation is always doing a "conforms to"
test between a model and its meta model without having to specify the
meta model separately. Perhaps I misunderstand the original question or
perhaps just the response to it?

Note that we just completed the work for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=75933 so we can now
validate an Ecore model itself as being well formed. This will be in
the next build (not the M4 build).


Frédéric Jouault wrote:
> Hello,
>
> ATL simply delegates reading of EMF models to EMF.
>
> Contrarily to MDR, EMF does not offer easy validation of a model against
> a metamodel. You should ask the EMF people about how validation works.
>
> Please let us know when you have a solution to your problem.
> This may become a Howto entry :-).
>
>
> Regards,
>
> Frédéric Jouault
>
> Kelly Garcés wrote:
>> Hello!
>>
>> I have this transformation:
>>
>> module mundo2arq;
>> create OUT : arquitectura from IN : feature;
>>
>> when i configure launch, i add an in model called "discotienda.xmi",
>> but discotienda.xmi doesn´t conform "feature". However discotienda
>> file has correct metamodel uri:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <mmmundo:EjercicioCupi2 xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:mmmundo="platform:/resource/Discotienda/mundo/mmmundo.ecore "
>> nivel="8">
>>
>> 1- ATL validates relationship "conforms to" between discotienda.xmi
>> and feature metamodel before running transformation?
>>
>> I reviewed "loadASMEMFModel" method in ASMEMFModel class (source
>> ATL), but i didn´t find any validation
>>
>> 2- how could i validate relationship "conforms to" between model and
>> metamodel?
>>
>> I reviewed EMF validation, but this validation checks each type of
>> object in model... :(
>> Is there some like this model.validate(metamodel)?
>>
>>
>> Sincerely thanks for your help,
>>
>> Kelly.
>>
Re: model doesn´t conform to metamodel [message #4100 is a reply to message #3010] Thu, 28 December 2006 23:02 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello Ed,

Thank you for this information, I am sure it will prove useful.

However, I am not sure it can be used in the scenario at hand, which is
the one used in ATL:
- we load and register a metamodel called MMa in EMF,
- we load a model called Ma in EMF,
- we would like to make sure that Ma conforms to MMa.

My understanding of EMF is that:
1- if Ma actually conforms to an already loaded and registered metamodel
called MMb, then there will be no loading error, because all
metaelements used in Ma are already known to EMF,
2- we can probably check that the metaelements of all elements of Ma are
in MMa,
3- but we cannot simply ask EMF to tell us whether Ma conforms to MMa or
not.

Please correct me if I am wrong (i.e., if it is indeed possible to ask
EMF if Ma conforms to MMa without implementing ourselves a conformance
checker as described in point 2 above).
Having such a conformance checking at model load time should make it
possible to have more specific error messages.


Regards,

Frédéric Jouault

Ed Merks wrote:
> Frédéric,
>
> You can use Diagnostician.INSTANCE.validate(eObject) to validate any
> EObject against the constraints specified by its meta model; this will
> invoke any constraints defined by the model itself, as well as the basic
> constraints imposed by Ecore itself (such as conforming to the
> multiplicity of the feature). Since eObject.eClass() gives the meta
> model of the eObject, EMF's validation is always doing a "conforms to"
> test between a model and its meta model without having to specify the
> meta model separately. Perhaps I misunderstand the original question or
> perhaps just the response to it?
>
> Note that we just completed the work for
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=75933 so we can now
> validate an Ecore model itself as being well formed. This will be in
> the next build (not the M4 build).
>
>
> Frédéric Jouault wrote:
>> Hello,
>>
>> ATL simply delegates reading of EMF models to EMF.
>>
>> Contrarily to MDR, EMF does not offer easy validation of a model against
>> a metamodel. You should ask the EMF people about how validation works.
>>
>> Please let us know when you have a solution to your problem.
>> This may become a Howto entry :-).
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>> Kelly Garcés wrote:
>>> Hello!
>>>
>>> I have this transformation:
>>>
>>> module mundo2arq;
>>> create OUT : arquitectura from IN : feature;
>>>
>>> when i configure launch, i add an in model called "discotienda.xmi",
>>> but discotienda.xmi doesn´t conform "feature". However discotienda
>>> file has correct metamodel uri:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <mmmundo:EjercicioCupi2 xmi:version="2.0"
>>> xmlns:xmi="http://www.omg.org/XMI"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:mmmundo="platform:/resource/Discotienda/mundo/mmmundo.ecore "
>>> nivel="8">
>>>
>>> 1- ATL validates relationship "conforms to" between discotienda.xmi
>>> and feature metamodel before running transformation?
>>>
>>> I reviewed "loadASMEMFModel" method in ASMEMFModel class (source
>>> ATL), but i didn´t find any validation
>>>
>>> 2- how could i validate relationship "conforms to" between model and
>>> metamodel?
>>>
>>> I reviewed EMF validation, but this validation checks each type of
>>> object in model... :(
>>> Is there some like this model.validate(metamodel)?
>>>
>>>
>>> Sincerely thanks for your help,
>>>
>>> Kelly.
>>>
Re: model doesn´t conform to metamodel [message #4154 is a reply to message #4100] Thu, 28 December 2006 23:43 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Frédéric,

Comments below.

Frédéric Jouault wrote:
> Hello Ed,
>
> Thank you for this information, I am sure it will prove useful.
>
> However, I am not sure it can be used in the scenario at hand, which is
> the one used in ATL:
> - we load and register a metamodel called MMa in EMF,
So to be concrete, suppose it's Library.ecore.
> - we load a model called Ma in EMF,
This would be My.library.
> - we would like to make sure that Ma conforms to MMa.
We can only load a model fully if its serialization matches registered
packages, classes, and features. We can record the stuff we don't
recognize effectively as uninterpreted DOM using
OPTION_RECORD_UNKNOWN_FEATURES, i.e., as instances of the
XMLTypePackage's AnyType separate from the "conforming/recognized" parts
of the model.
>
> My understanding of EMF is that:
> 1- if Ma actually conforms to an already loaded and registered metamodel
> called MMb, then there will be no loading error, because all
> metaelements used in Ma are already known to EMF,
Yep. ;-)
> 2- we can probably check that the metaelements of all elements of Ma are
> in MMa,
I suppose so. You can visit every object and check its EClass to
determine all Ecore models involved...
> 3- but we cannot simply ask EMF to tell us whether Ma conforms to MMa or
> not.
Doesn't this just mean EClassifier.isInstance returning true along with
all the validation constraints being in good shape?
>
> Please correct me if I am wrong (i.e., if it is indeed possible to ask
> EMF if Ma conforms to MMa without implementing ourselves a conformance
> checker as described in point 2 above).
I have a feeling there is nothing additional to add, but I may be
missing some subtle point. Given any EObject you know it's meta model
and hence you know for a fact up front, without further checking, that
it's at least type safe and consistent with respect to that model.
> Having such a conformance checking at model load time should make it
> possible to have more specific error messages.
The error message from the parser should be very specific about a
particular namespace and name not being recognized as a feature of a
particular type of object, a namespace not being mapped to any
registered package, or a type name not being found in a package. EMF
model instances are generally fail fast, so you physically cannot add
the wrong type of thing to a list nor set the wrong type of thing to a
feature, so I think by the time the parse returns an instance that's of
some expected type, and the parser hasn't reported any errors, things
should be in very good shape and there's really not much left to check
except for validation constraints that the Diagnostician will provide...
>
>
> Regards,
>
> Frédéric Jouault
>
> Ed Merks wrote:
>> Frédéric,
>>
>> You can use Diagnostician.INSTANCE.validate(eObject) to validate any
>> EObject against the constraints specified by its meta model; this
>> will invoke any constraints defined by the model itself, as well as
>> the basic constraints imposed by Ecore itself (such as conforming to
>> the multiplicity of the feature). Since eObject.eClass() gives the
>> meta model of the eObject, EMF's validation is always doing a
>> "conforms to" test between a model and its meta model without having
>> to specify the meta model separately. Perhaps I misunderstand the
>> original question or perhaps just the response to it?
>>
>> Note that we just completed the work for
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=75933 so we can now
>> validate an Ecore model itself as being well formed. This will be in
>> the next build (not the M4 build).
>>
>>
>> Frédéric Jouault wrote:
>>> Hello,
>>>
>>> ATL simply delegates reading of EMF models to EMF.
>>>
>>> Contrarily to MDR, EMF does not offer easy validation of a model
>>> against
>>> a metamodel. You should ask the EMF people about how validation works.
>>>
>>> Please let us know when you have a solution to your problem.
>>> This may become a Howto entry :-).
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>>
>>> Kelly Garcés wrote:
>>>> Hello!
>>>>
>>>> I have this transformation:
>>>>
>>>> module mundo2arq;
>>>> create OUT : arquitectura from IN : feature;
>>>>
>>>> when i configure launch, i add an in model called
>>>> "discotienda.xmi", but discotienda.xmi doesn´t conform "feature".
>>>> However discotienda file has correct metamodel uri:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <mmmundo:EjercicioCupi2 xmi:version="2.0"
>>>> xmlns:xmi="http://www.omg.org/XMI"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:mmmundo="platform:/resource/Discotienda/mundo/mmmundo.ecore "
>>>> nivel="8">
>>>>
>>>> 1- ATL validates relationship "conforms to" between discotienda.xmi
>>>> and feature metamodel before running transformation?
>>>>
>>>> I reviewed "loadASMEMFModel" method in ASMEMFModel class (source
>>>> ATL), but i didn´t find any validation
>>>>
>>>> 2- how could i validate relationship "conforms to" between model
>>>> and metamodel?
>>>>
>>>> I reviewed EMF validation, but this validation checks each type of
>>>> object in model... :(
>>>> Is there some like this model.validate(metamodel)?
>>>>
>>>>
>>>> Sincerely thanks for your help,
>>>>
>>>> Kelly.
>>>>
Previous Topic:[ATL] Error when launching ATL programmatically
Next Topic:[ATL] problem at launching ATL
Goto Forum:
  


Current Time: Thu Apr 25 21:37:14 GMT 2024

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

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

Back to the top