Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Problem to reference to an existing model(I canĀ“t create a validate model referencing to an other model)
Problem to reference to an existing model [message #1802190] Sun, 03 February 2019 14:31 Go to next message
Sebastian Friedl is currently offline Sebastian FriedlFriend
Messages: 2
Registered: February 2019
Junior Member
Hello,

I have some models (of Meta-Model A) which partly refer to each other (for example: An element is in model A1, but its children are in model A2). I would like to transfer this into Meta-Model B using ATL. In my opinion, the result should look like this:
<ObjectType Name="myObjectType" id="1002">
    <reference IsForward="false" hasSource="//@ObjectType.0" hasTarget="../basemodel/BaseModel.modelb#//@ObjectTypes/@ObjectType.0"/>
    </reference>
	...
</ObjectType>


For this purpose I have defined the following rules:

create OUT: ModelB from IN: ModelA, BaseModel: ModelB;

rule ObjectTypeRule {
	from
		input: ModelA!ObjectType
	to
		output: ModelB!ObjectType (
			Id <- input.Id,
			...
			reference <:= input.References.reference -> collect(e | thisModule.
					ReferenceRule(e, input))
		)
}

lazy rule ReferenceRule {
	from
		ref: ModelA!Reference, parent: ModelB!ObjectType
	to
		output: ModelB!Reference (
			IsForward <- ref.IsForward,
			hasSource <- parent,
			hasTraget <- ModelB!ObjectType.allInstances()-> select(
				e | 
				if e.Id.oclIsUndefined() then 
					false
				else
					e.ID.endsWith(ref.Value) 
				endif
				).first()
		)
}


But the result of the rule is now, however, as follows:

<ObjectType Name="myObjectType" id="1002">
    <reference IsForward="false" hasSource="//@ObjectType.0">
      <hasTarget href="../basemodel/Basemodel.modelb#//@ObjectTypes/@ObjectType.0"/>
    </reference>
	...
</ObjectType>


Can anyone see what is causing this problem and how I can solve it?

Thank you very much
S.Friedl
Re: Problem to reference to an existing model [message #1802485 is a reply to message #1802190] Sun, 10 February 2019 16:28 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

ATL does not control how model are formatted: this is purely determined by EMF itself. Perhaps you can ask in the EMF forum, and include the metamodel (.ecore file) definition as well?

Cheers,
Dennis
Previous Topic:Create multiple from one
Next Topic:Move an element
Goto Forum:
  


Current Time: Sat Nov 11 08:20:02 GMT 2023

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

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

Back to the top