Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Toñi  Reina is currently offline Toñi ReinaFriend
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 #636777 is a reply to message #636313] Tue, 02 November 2010 18:10 Go to previous messageGo to next message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi all again,

I still haven't found a solution to the problem I've posted previously.

Searching at the forums, I have found the thread entitled QVTO] when a type does not conform to itself? (
http://www.eclipse.org/forums/index.php?t=msg&th=24605&a mp;start=0&S=e83e504db22fb119023641f2d090606b), which seems to describe a problem similar to mine.

The different causes of the problem I'm thinking in are:

1) The problem is due to having a metamodel that have been defined as an extension to other metamodel. So my elements are not well qualified.

2) The problem is because Node is an abstract class, so the children relation can cause problems due to some polimorfism implementation.

3) There is a bug in QVT or in OCL.

Can anyone tell me how to debug the piece of code I've posted in order to check why the compiler is producing this error??

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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
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 Go to previous message
Toñi  Reina is currently offline Toñi ReinaFriend
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
Previous Topic:resolveTemp's parameters are reversed after extraction to .atl
Next Topic:[QVTo] Help with baseType null when validating assignments
Goto Forum:
  


Current Time: Thu Apr 25 07:14:01 GMT 2024

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

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

Back to the top