Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » access to String ATL
icon5.gif  access to String ATL [message #1746992] Tue, 08 November 2016 12:01 Go to next message
salha salha is currently offline salha salhaFriend
Messages: 97
Registered: February 2016
Member
when i generate getRule1() :
lazy rule Rule2Rule{
      from f:GrammAcme!Rule
	  
      to t:MMAcme!Rule(	
      	
      	
      	 ruletext<-thisModule.getRule1()

)}

  helper  def: getRule1(f:GrammAcme!Rule):String=
  	 if not f.designRuleExpression.qt.formalParam.oclIsUndefined() then 
		   if not f.designRuleExpression.qt.designRuleExpression.qb.oclIsUndefined() then
		  if not  f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.oclIsUndefined() then
		 if not  f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression
         .additiveExpression.multiplicativeExpression.unaryExpression.primitiveExpression.id.oclIsUndefined() then
  	
  	  f.nameRule +' '+ '='+' ' + f.typeRule +' '+ f.designRuleExpression.qt.typeExp + ' '+ f.designRuleExpression.qt.nameComponent
		 + ' '+':'+' ' +f.designRuleExpression.qt.formalParam.type  
		+ ' '+'in'+ ' '+  f.designRuleExpression.qt.setExpression.nameSetReference
		 +'.' + f.designRuleExpression.qt.setExpression.set.toString().regexReplaceAll('Sequence',' ').replaceAll('{',' ').replaceAll('}',' ').replaceAll('\'',' ').trim()
		 +' '+'|' +' '+'('+
		 f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression
         .additiveExpression.multiplicativeExpression.unaryExpression.primitiveExpression.id.idName+'.'+f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression
         .additiveExpression.multiplicativeExpression.unaryExpression.primitiveExpression.id.iddNames.toString().regexReplaceAll('Sequence',' ').replaceAll('{',' ').replaceAll('}',' ').replaceAll('\'',' ').trim()
		+')'+' '+'=='
			  	else  OclUndefined endif 
				else  OclUndefined endif 
			
		else  OclUndefined endif 
						  						  else  OclUndefined endif 
												  ;

here i don't have a problem and i have this result :

Quote:

<rules ruletext="rule10 = invariant forall ps : PortTWSService in self.PORTS | (ps.Prec) =="/>




when i generate getRule3() i don't have a problem

lazy rule Rule2Rule{
      from f:GrammAcme!Rule
	  
      to t:MMAcme!Rule(	
      	
      	
      	 ruletext<-thisModule.getRule3()

)}

 helper def: getRule3(f:GrammAcme!Rule):String=
  if not f.oclIsUndefined() then
   	if not f.designRuleExpression.qt.designRuleExpression.oclIsUndefined() then
 	
 	if not f.designRuleExpression.qt.designRuleExpression.qb.oclIsUndefined() then
 	if not f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.oclIsUndefined() then
 
		 if not f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpressions->first().
         oclIsUndefined() then
		
		
		
		f.designRuleExpression.qt.designRuleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpression.additiveExpression
         .multiplicativeExpression.unaryExpression.primitiveExpression.ruleExpression.qb.orExpression.impliesExpression.iffExpression.equalityExpression.relationalExpressions->first().
          additiveExpression.multiplicativeExpression.unaryExpression.primitiveExpression.id.idName
	  						
	else  OclUndefined endif 
				else  OclUndefined endif 
					else  OclUndefined endif 
				
		else  OclUndefined endif 
						  						  else  OclUndefined endif ;								  ;


i have this result :

Quote:

<rules ruletext="activer"/>

but when i concat getRule3() + getRule1() like this :

 lazy rule Rule2Rule{
      from f:GrammAcme!Rule
	  
      to t:MMAcme!Rule(	
      	
      	
      	 ruletext<-thisModule.getRule1()+thisModule.getRule3()
)}


i have this problem :
Quote:

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: OclUndefined.+(org.eclipse.m2m.atl.engine.emfvm.lib.OclUndefined)
at Rule2Rule#296(Acme2Acme.atl[116:2-116:47])
local variables: self=Acme2Acme : ASMModule, f=IN!<unnamed>, t=OUT!<unnamed>
at Family2Family#113(Acme2Acme.atl[28:32-28:55])
local variables: self=Acme2Acme : ASMModule, f=IN!<unnamed>, q=IN!<unnamed>, j=OUT!WSM, e=IN!<unnamed>
at __applyFamily2AcmeFile#24(Acme2Acme.atl[12:17-12:46])
local variables: self=Acme2Acme : ASMModule, link=TransientLink {rule = Family2AcmeFile, sourceElements = {q = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@9a6d8c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1a36881 (name: FamilyBody) (instanceClassName: null) (abstract: false, interface: false)), f = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@11642c7 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@8201b4 (name: Family) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {j = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@d60adf (eClass: org.eclipse.emf.ecore.impl.EClassImpl@14f5028 (name: AcmeFile) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}, f=IN!<unnamed>, q=IN!<unnamed>, j=OUT!WSM
at __exec__#8(Acme2Acme.atl)
local variables: self=Acme2Acme : ASMModule, e=TransientLink {rule = Family2AcmeFile, sourceElements = {q = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@9a6d8c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1a36881 (name: FamilyBody) (instanceClassName: null) (abstract: false, interface: false)), f = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@11642c7 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@8201b4 (name: Family) (instanceClassName: null) (abstract: false, interface: false))}, targetElements = {j = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@d60adf (eClass: org.eclipse.emf.ecore.impl.EClassImpl@14f5028 (name: AcmeFile) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}
at main#27(Acme2Acme.atl)
local variables: self=Acme2Acme : ASMModule


i don'tt unrestand wahat is the problem ??????

[Updated on: Thu, 10 November 2016 01:08]

Report message to a moderator

Re: problem string concat operation OclUndefined ? [message #1746997 is a reply to message #1746992] Tue, 08 November 2016 12:45 Go to previous messageGo to next message
salha salha is currently offline salha salhaFriend
Messages: 97
Registered: February 2016
Member
please any help ??
Re: problem string concat operation OclUndefined ? [message #1747041 is a reply to message #1746997] Tue, 08 November 2016 19:03 Go to previous messageGo to next message
salha salha is currently offline salha salhaFriend
Messages: 97
Registered: February 2016
Member
any one can help me!!!!
Re: problem string concat operation OclUndefined ? [message #1747144 is a reply to message #1747041] Thu, 10 November 2016 08:21 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 351
Registered: September 2012
Location: Belgium
Senior Member

ATL dynamically looks up the '+' method, based on its arguments (unlike Java, which looks up methods statically). If your first String argument is OclUndefined at runtime, ATL tries to find '+' on OclUndefined, which does not exist.

The easiest solution is to return empty strings instead of OclUndefined in thisModule.getRule1() and thisModule.getRule3(). Alternatively, you have to perform oclIsUndefined() checks on both values before calling '+'.


Cheers,
Dennis
Re: problem string concat operation OclUndefined ? [message #1747152 is a reply to message #1747144] Thu, 10 November 2016 09:37 Go to previous messageGo to next message
salha salha is currently offline salha salhaFriend
Messages: 97
Registered: February 2016
Member
hi , i do that but thisModule.getRule3()+thisModule.getRule1() is

Quote:
<rules ruletext="rule10 = invariant forall ps : PortTWSService in self.PORTS | (ps.Prec) =="/>


thisModule.getRule1() is Quote:
empty !!!! the result is ''

[Updated on: Thu, 10 November 2016 11:03]

Report message to a moderator

Re: problem string concat operation OclUndefined ? [message #1747155 is a reply to message #1747152] Thu, 10 November 2016 10:14 Go to previous messageGo to next message
salha salha is currently offline salha salhaFriend
Messages: 97
Registered: February 2016
Member
please help me I am blocked
Re: problem string concat operation OclUndefined ? [message #1748285 is a reply to message #1747155] Mon, 21 November 2016 19:54 Go to previous message
louis andia. is currently offline louis andia.Friend
Messages: 46
Registered: November 2016
Member
You can't call a third function to merge them?
"ruletext<-thisModule.getRule1and3()" or maybe "ruletext<-thisModule.getRule1and3(thisModule.getRule1(), thisModule.getRule3())"
Previous Topic:ResolveTemp and Multiple Helpers in HOT
Next Topic:OclExpression decomposition in ATL HOT
Goto Forum:
  


Current Time: Sun Nov 19 01:33:10 GMT 2017

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

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