Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Working with external parameters and command line transformation
[ATL] Working with external parameters and command line transformation [message #493259] Sat, 24 October 2009 01:09 Go to next message
Marijn Blom is currently offline Marijn BlomFriend
Messages: 3
Registered: October 2009
Junior Member
I have 2 problems:
I'm trying to work towards a command line initiated transformation that can handle parameters, something like
transformSCIM2CIFT <input model> <output model> <parameters>

If anyone has an idea as to how to get that started (i've looked into AtlLauncher AM3 Ant Tasks and the howtos) then i'd love some ideas. From what i've read the AtlLauncher comes closest to what i want, but even with the comments in the file my java experience is still to little to get it running.


The current problem i'm facing is more coding related:
I created a new metamodel PARM.ecore that has an EClass Parameters, which can contain instances of the EClass StringParam, which has 2 attributes: Name (EString) and Value(EString)

This because i figured it would not be that hard to write a java program that can put the command line parameters in a model like that.

Now what i want to do is transform only selected Automates, filtered by name.

i tried to make a helper which selects the right Automates, but i can't get it done.

these are the two possibilities i tried:

helper context SCIM!Automaton def: Selection() : Boolean =
	if PARM!Parameters.StringParams->select(i | i.getAttrVal('Name') = 'Automs')->first().getAttrVal('Value') <> ''
		then self.name.startsWith(PARM!Parameters.StringParams->select(i | i.getAttrVal('Name') = 'Automs')->first().getAttrVal('Value'))
		else true
	endif;


but that gives:
Feature StringParams does not exist on EClass at Selection(SCIM2CIFT.atl[9:5-9:33])
local variables: self=IN!aaaddd:SCIM!Automaton which i think means that PARM!Parameters.StringParams can't get out of the context of SCIM!Automaton.


the other thing i tried was:
helper context PARM!Parameters def: StringParamValueCheck(name: String) : String =
	PARM!Parameters.StringParams->select(i | i.getAttrVal('Name') = name)->first().getAttrVal('Value');

helper context SCIM!Automaton def: Selection() : Boolean =
	if StringParamValueCheck('Automs') <> ''
		then self.name.startsWith(StingParamValueCheck('Automs'))
		else true
	endif;

But this needs something in front of the StringParamValueCheck (self. or something), but whatever I try (PARM!Parameters. doesn't work) I can't get it to work.

Help is greatly appreciated.

[Updated on: Sat, 24 October 2009 01:29]

Report message to a moderator

Re: [ATL] Working with external parameters and command line transformation [message #493496 is a reply to message #493259] Mon, 26 October 2009 14:20 Go to previous message
Marcel  is currently offline Marcel Friend
Messages: 54
Registered: July 2009
Member
The error is generated because you try to access a field of PARM!Parameters.
PARM!Parameters is a metamodel type (EClass) and EClass does not have the StringParams reference.
You are interested in instances from this type, so you should use allInstances() for this.

You could try the following for the helper:
helper context SCIM!Automaton def: Selection() : Boolean =
  PARM!Parameters.allInstances()
  	->first()
  	.StringParams
	->select(i | i.Name = 'Automs' and i.Value <> '' and self.name.startsWith(i.Value))
	->notEmpty();

This works as follows:

  • Get all instances from Parameters classes.
  • allInstances() returns a set, of which we know the size is one, so select the first one
  • We only need to consider the StringParams
  • Select the ones with name 'Automs' and non-empty value and from which the value are the first characters of the name of the automaton (self)
  • If this set is not empty return true



[Updated on: Mon, 26 October 2009 14:29]

Report message to a moderator

Previous Topic:[QVTO] Adding variables to QVTO environment
Next Topic:Transforming a transformation script
Goto Forum:
  


Current Time: Fri Apr 19 19:25:47 GMT 2024

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

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

Back to the top