Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-Relations » Primitive Domains in Top Relations
Primitive Domains in Top Relations [message #1081503] Wed, 07 August 2013 05:54 Go to next message
Goood Guy is currently offline Goood Guy
Messages: 126
Registered: September 2011
Senior Member
Hi,

I wonder what should happen if a top relation has a primitive domain. As far as I understand, if the relation is not called in a when clause, the primitive domain cannot be bound.

For example I have the following relation:

transformation source2target(source:simplesource, target:simpletarget){
	
	top relation AtoA {

		varSourceB:simplesource::B;
		varTargetB:simpletarget::B;
		varStr:String;
		enforce domain source aLeft: simplesource::A{
			b=varSourceB, 
			str=varStr
		};
		

		
		enforce domain target aRight: simpletarget::A{
			b=varTargetB
			

		};
		
		when{
		
			BtoB(varSourceB,varTargetB, varStr);
		}

	}
	
	top relation BtoB{
	
		varStr:String;
		enforce domain source bLeft: simplesource::B{
		};
		

		
		enforce domain target bRight: simpletarget::B{

			str=varStr
		};
		
		primitive domain pd:String;
		
		when{
			varStr = pd;
		}
	}
}
Re: Primitive Domains in Top Relations [message #1081587 is a reply to message #1081503] Wed, 07 August 2013 08:24 Go to previous messageGo to next message
Goood Guy is currently offline Goood Guy
Messages: 126
Registered: September 2011
Senior Member
I think I found an alternative solution that does not require primitive domains:

	top relation AtoA {

		varStr:String;
		enforce domain source aLeft: simplesource::A{
			b=z:simplesource::B{},
			str = varStr
		};
		
		enforce domain target aRight: simpletarget::A{
			b=z2:simpletarget::B{
				str = varStr
			}
			
		};
		
		when{
			varStr = aLeft.str or varStr = aRight.b.str;
			BtoB(z, z2);
		}
		

	}

Re: Primitive Domains in Top Relations [message #1081824 is a reply to message #1081503] Wed, 07 August 2013 14:44 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4026
Registered: July 2009
Senior Member
HI

QVTr is multi-directional.

One or more domains are input, one is output, others may be used/ignored
as appropriate.

Regards

Ed Willink


On 07/08/2013 10:54, Goood Guy wrote:
> Hi,
>
> I wonder what should happen if a top relation has a primitive domain.
> As far as I understand, if the relation is not called in a when
> clause, the primitive domain cannot be bound.
>
> For example I have the following relation:
>
>
> transformation source2target(source:simplesource, target:simpletarget){
>
> top relation AtoA {
>
> varSourceB:simplesource::B;
> varTargetB:simpletarget::B;
> varStr:String;
> enforce domain source aLeft: simplesource::A{
> b=varSourceB, str=varStr
> };
>
>
>
> enforce domain target aRight: simpletarget::A{
> b=varTargetB
>
>
> };
>
> when{
>
> BtoB(varSourceB,varTargetB, varStr);
> }
>
> }
>
> top relation BtoB{
>
> varStr:String;
> enforce domain source bLeft: simplesource::B{
> };
>
>
>
> enforce domain target bRight: simpletarget::B{
>
> str=varStr
> };
>
> primitive domain pd:String;
>
> when{
> varStr = pd;
> }
> }
> }
>
Previous Topic:Current status of QVTd?
Next Topic:PropertyTemplates with OCL
Goto Forum:
  


Current Time: Fri Aug 22 08:01:21 EDT 2014

Powered by FUDForum. Page generated in 0.01674 seconds