It doesn't make sense. Can't you just use self.Transition everywhere you
use that query? Wouldn't that be easier?

Also, I don't know what the transformation is supposed to do, so I can't
comment on the whether your general approach would work. I do have some
doubts regarding the 'transitions' property. You seem to assign it with
source objects, and then use it locally in the same mapping where you
assign it. Can't you just eliminate that property entirely?

Finally "mapping MMSCXMLWeb::Generic::toSCXMLStates()". I think you can
get rid of the init, the explicit assignment to result, and the explicit
creation of the target element.

Depending other whether how you modeled it in the metamodel, it can be a
Sequence (ordered, non-unique), OrderedSet (ordered, unique), etc.

You can use this: 'target := Sequence{self.Source_State.ID};'

> How can I convert types in qvto?

I don't think that would work. You can't cast a string to list in Java
either... However, converting types is done using the OCL operator
'oclAsType(<typename>)'.

Dennis

Pablo Nieto wrote:
> Hello thaks a lot for the help.
>
> I´ve corrected all my code and now it´s right.
>
> Now I have a new question:
> I have this sentence: target=self.Source_State.ID;
>
> The problem is that target Type is java.util.List and
> self.Source_State.ID is a String;
>
> How can I create Lists in qvto? or How can I convert types in qvto?
>
> thanks againk, Pablo.

> I can´t execute the qvto file.
> It´s because the asignation has difrent types:
> Java.util.list and String

Java.utils.list does not seem like a type that QVTo would generally use.
I would have expected one of the OCL types like Sequence, OrderedSet,
Set, or Bag. How did you end up with java.util.List? Did you not define
the language using an Ecore?

What does QVTo indicate as the type of 'target'?

Note that if it is a QVTo List type, it is mutable type. In that case
you can take a look at section 8.3.8 of the QVT standard. In particular
8.3.8.1 explains the add operation, which would be something like:

target.add(self.Source_State.ID);

If none of this works, maybe you can post the entire transformation, so
that we have more information, and more context?

I've never explicitly declared something as java.util.List in my
metamodel, so I guess I don't really know either. Maybe if you posted
the metamodel and QVTo transformation, that would give more information?

Dennis

Pablo Nieto wrote:
> Hello:
>
> This is the error
> The type 'oclstdlib::String' does not conform to the base type
> 'oclstdlib::T' of the multi-valued property 'target'
> I use the java.util.List because the Model I´m using is a standard and I
> can´t change it.
>
> If I use target.add(self.Source_State.ID) this error occurs:
> Cannot find operation (add(String)) neither for the type (Sequence(T))
> nor for its element type (T)
>
> thanks again

Your error looks to be the normal result of using the wrong collection type.

You should never need to use java.util.List explicitly in a meta-model;
indeed I'm baffled as to where you might even try to use it.

Youe meta-model and transformation are almost certainly
type-incompatible and this exactly what the error message is telling you.

We cannot diagnose further without seeing both.

Regards

Ed Willink

On 02/09/2010 07:15, Dennis Hendriks wrote:
> Hello Pablo,
>
> I've never explicitly declared something as java.util.List in my
> metamodel, so I guess I don't really know either. Maybe if you posted
> the metamodel and QVTo transformation, that would give more information?
>
> Dennis
>
> Pablo Nieto wrote:
>> Hello:
>>
>> This is the error
>> The type 'oclstdlib::String' does not conform to the base type
>> 'oclstdlib::T' of the multi-valued property 'target'
>> I use the java.util.List because the Model I´m using is a standard and
>> I can´t change it.
>>
>> If I use target.add(self.Source_State.ID) this error occurs:
>> Cannot find operation (add(String)) neither for the type (Sequence(T))
>> nor for its element type (T)
>>
>> thanks again