Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Implied linking in Refining mode(Linking model element by their generated target elements)
Implied linking in Refining mode [message #986193] Mon, 19 November 2012 12:00 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

I have a refining transformation that adds elements based on a DTD model to a base UML model. I would like to use the declarative base pattern shown below, that has been taken from the standard manual. My code is in the second snippet.

rule Case2_R1 {
	from
		i : MM_A!ClassA
	to
		o_1 : MM_B!Class1 (
			linkToClass2 <- i.linkToClassB
		)
}
rule Case2_R2 {
 	from
		i : MM_A!ClassB
	to
		o_1 : MM_B!Class2 (
			...
		),
		...
}

The code below is only allowed to run if 'inter-model relations are enabled'. If that is enabled, it fails with a typecast:
org.eclipse.wst.dtd.core.internal.emf.impl.DTDFileImpl cannot be cast to net.jgsuess.uml14.foundation.core.Namespace

The intention of the code is that a UML class generated from a DTD element should link to the UML package that corresponds to the DTD elements' DTD file.

I assume I am doing something wrong in setting up the matching.

-- @atlcompiler atl2010
-- @nsURI UML=http://jgsuess.net/uml14
-- @nsURI DTD=DTD.xmi


module transform;
create OUT: UML refining IN: UML, dtd: DTD;

rule File2Package {
	from
		s: DTD!DTDFile
	to
		t: DTD!DTDFile,
		p: UML!Package (
			name <- 'dtdfile'
		)
}

rule Element2Class {
	from
		s: DTD!DTDElement
	to
		t: DTD!DTDElement,
		c: UML!Class (
			namespace <- s.DTDFile,
			name <- s.name
		)
}

[Updated on: Mon, 19 November 2012 12:04]

Report message to a moderator

Re: Implied linking in Refining mode [message #986194 is a reply to message #986193] Mon, 19 November 2012 12:17 Go to previous message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Disregard my message above. For those looking, underneath is the solution:



  • Inter-model relations have to be on
  • You have to use thisModule.resolveTemp to obtain the secondary element


The thisModule.resolveTemp is necessary, because in this case the interesting elements are created as side-effects.

-- @atlcompiler atl2010
-- @nsURI UML=http://jgsuess.net/uml14
-- @nsURI DTD=DTD.xmi


module transform;
create OUT: UML refining IN: UML, dtd: DTD;

rule File2Package {
	from
		s: DTD!DTDFile
	to
		t: DTD!DTDFile,
		p: UML!Package (
			name <- 'dtdfile'
		)
}

rule Element2Class {
	from
		s: DTD!DTDElement
	to
		t: DTD!DTDElement,
		c: UML!Class (
			namespace <- thisModule.resolveTemp(s.DTDFile, 'p'),
			name <- s.name
		)
}
Previous Topic:How to mix in model elements in refining mode
Next Topic:ATL transformation programming in java code
Goto Forum:
  


Current Time: Thu Apr 25 01:26:50 GMT 2024

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

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

Back to the top