Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Re: Mapping in/output programmatically
Re: Mapping in/output programmatically [message #1043951] Thu, 18 April 2013 05:57
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
Apologies... I replied Alan rather than the newsgroup.

Cheers,
Adolfo.

On 17/04/2013 09:36, Adolfo Sánchez-Barbudo Herrera wrote:
> Hi Manuel, Alan
>
> To complement Alan's response (thank you very much for that), just a
> reference to the OMG QVT specification [1] which in its section 8.2.1.5
> states:
>
> "A model parameter is a parameter to an operational transformation.
> Hence, the ordered set of model parameters forms the
> signature of the transformation. Each model parameter refers implicitly
> to a model participating in the query or
> transformation."
>
> [1] http://www.omg.org/spec/QVT/
>
> Cheers,
> Adolfo.
>
> On 16/04/2013 17:11, Alan McMorran wrote:
>> Manuel,
>>
>>
>> The order corresponds to the order in the QVTO file itself. One way
>> around this if you don't know the order of your parameters is to load
>> the QVTO file itself (the code itself can be loaded as a model) and
>> locate the OperationalTransform object instance. On this
>> OperationalTransform you can then do something like:
>>
>>
>> OperationalTransform transform = <find it in the QVTO resource>
>>
>> // something like Resource qvtoRes = new
>> ResourceSetImpl().getResource(qvtoURI, true) should return a QVTOResource
>>
>> EList<ModelParameter> params = transform.getModelParameter();
>>
>> Map<String, Integer> paramIndex = new HashMap<String, Integer>();
>>
>> for (int i=0; i<params.size(); i++){
>>
>> ModelParameter p = params.get(i);
>>
>> String name = p.getName();
>>
>> paramIndex.put(name, i);
>>
>> // Of course you can also find out the types to see if it's in, inout,
>> out etc.
>>
>> ParameterKind type;
>>
>> if(p.getKind()==DirectionKind.IN) type = ParameterKind.IN;
>>
>> else if(p.getKind()==DirectionKind.INOUT) type = ParameterKind.INOUT;
>>
>> else type = ParameterKind.OUT;
>>
>> }
>>
>> Alan
>>
>>
>> On 2013-04-16 13:08:06 +0000, Manuel Hegner said:
>>
>>
>> Hello,
>>
>>
>> I try to execute an QVT operation programmatically. I follow the example
>> given http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava.
>>
>> While the eexample works perfectly for operations with one in/output it
>> does not for operations with more. What I don't understand is why the
>> TransformationExecutor only gets a list and gives a list back. I try to
>> integrate QVT into a framework that gives me an unsorted list of input
>> models with names corresponding to the ones in the qvto file. It also
>> gives me a list of output files and the names from the corresponding
>> output models in the qvto file.
>>
>>
>> As the TransformationExecutor only takes a list and not a Map, I see no
>> possibility to know in which order the list given to the
>> TransformationExecutor should be and in which files I have to save the
>> outputs.
>>
>>
>> Could some one give me an example code of how to do that, please?
>>
>>
>> Thanks
>>
>> Manuel
>>
>>
Previous Topic:Mapping in/output programmatically
Next Topic:second mapping steals first one
Goto Forum:
  


Current Time: Sun Apr 20 09:35:09 EDT 2014

Powered by FUDForum. Page generated in 0.03310 seconds