Home » Archived » M2M (model-to-model transformation) » [QVTo] Bug in type checking in QVTo 2.1.0??
[QVTo] Bug in type checking in QVTo 2.1.0?? [message #636313] |
Sat, 30 October 2010 18:19 |
Toñi Reina Messages: 209 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I'm developing a QVTo transformation to generate models conforming
to the JSP metamodel specified in the MODISCO project
( http://wiki.eclipse.org/MoDisco/Components/JSP/Documentation /0.9#JSP_Metamodel).
As it can be seen in the link I have attached before, the JSP metamodel
has been defined extending the XML Modisco metamodel.
In the transformation, I need to populate some classes. Thus, in
order to specify a JSP line such as <%@ page contentType="text/html" %>
I have to create a JSPDirective object with an Attribute children. I
have tried the two following queries:
query createContentTypeAttribute() : xml::Attribute {
return object Attribute {
name:='contentType';
value:='text/html';
};
}
query createContentTypeDirective(): jsp::JSPDirective{
return object jsp::JSPDirective{
name:='page';
parent:= null;
children+=createContentTypeAttribute().oclAsType(xml::Node);
};
}
However, I obtain the following error message The type xml::Node does
not conform to the base type xml::Node of the multi-valued property
children. I don't see what the problem is, because children is an
OrderedSet whose elements are xml:Node, and xml::Attribute extends xml:Node.
I have tried different implementations, as create an OrderedSet, add it
the attribute and then assign the orderedset to children, but at the
end, the same error message is obtained.
Can anyone tell me if this is a bug in the QVTo implementation or, on
the contrary, is a problem due to something I missed in the implementation?
Best regards,
Toñi
|
|
| |
Re: [QVTo] Bug in type checking in QVTo 2.1.0?? [message #637546 is a reply to message #636313] |
Sat, 06 November 2010 13:58 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi Toni
Stupid messages such X is not X can arise when inconsistent URIs
are used allowing two different Xs to be present and indeed incompatible.
Regards
Ed Willink
On 30/10/2010 19:19, Toñi Reina Quintero wrote:
>
> Hi all,
>
> I'm developing a QVTo transformation to generate models conforming to
> the JSP metamodel specified in the MODISCO project
> ( http://wiki.eclipse.org/MoDisco/Components/JSP/Documentation /0.9#JSP_Metamodel).
> As it can be seen in the link I have attached before, the JSP metamodel
> has been defined extending the XML Modisco metamodel.
>
> In the transformation, I need to populate some classes. Thus, in order
> to specify a JSP line such as <%@ page contentType="text/html" %>
> I have to create a JSPDirective object with an Attribute children. I
> have tried the two following queries:
>
>
> query createContentTypeAttribute() : xml::Attribute {
> return object Attribute {
> name:='contentType';
> value:='text/html';
> };
> }
>
> query createContentTypeDirective(): jsp::JSPDirective{
>
> return object jsp::JSPDirective{
> name:='page';
> parent:= null;
> children+=createContentTypeAttribute().oclAsType(xml::Node);
>
> };
> }
>
> However, I obtain the following error message The type xml::Node does
> not conform to the base type xml::Node of the multi-valued property
> children. I don't see what the problem is, because children is an
> OrderedSet whose elements are xml:Node, and xml::Attribute extends
> xml:Node.
>
> I have tried different implementations, as create an OrderedSet, add it
> the attribute and then assign the orderedset to children, but at the
> end, the same error message is obtained.
>
> Can anyone tell me if this is a bug in the QVTo implementation or, on
> the contrary, is a problem due to something I missed in the implementation?
>
> Best regards,
> Toñi
|
|
|
Re: [QVTo] Bug in type checking in QVTo 2.1.0?? [message #637560 is a reply to message #637546] |
Sat, 06 November 2010 17:32 |
Toñi Reina Messages: 209 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
thanks for your answer. Yesterday I found out what the problem was and it is related to your suggestion.
The problem was that I had installed the xml and jsp modisco plugins. As a consequence, I had avalaible the xml and jsp metamodels as plugins. Furthermore, I had configured the QVT Settings adding the references to the .ecore files in the Metamodel Mappings. So, effectively, I had had two URIs that were refering to the same metamodel (the one in the plugin and the one in the .ecore file).
What I don´t know is why QVT is lost with the URIs because they were exactly the same, and they corresponded to the same version of the metamodel.
Although, of course, it is a stupid error, it is difficult to find the reason of the error, because the error message is confusing.
Maybe the tool could be improved by giving a warning when adding a new metamodel mapping which is already loaded in the metamodel register.
There is something done related to this kind of problem. Thus, for example, when you try to add a new metamodel mapping whose .ecore file is already in the list of mappings, you obtain an error saying "Source http://.... URI already mapped ". That is, the tool checks the mappings the user has added before, but I think there is no checking of the URIs that are loaded in the metamodel register. I would suggest add also this kind of checking to help detect this kind of errors.
Regards,
Toñi
|
|
|
Goto Forum:
Current Time: Sat Apr 27 00:19:14 GMT 2024
Powered by FUDForum. Page generated in 0.04809 seconds
|