Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » how to match "packageImport" element in class diagram
how to match "packageImport" element in class diagram [message #987539] Tue, 27 November 2012 05:06 Go to next message
Beatus Ding is currently offline Beatus DingFriend
Messages: 18
Registered: November 2012
Junior Member
I'm trying to transform uml diagram to self-defined "unify" file with ATL.A simple class diagram like this
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:profile="http:///schemas/profile/_v1QCwDSdEeK5yc5OykOa7Q/6" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http:///schemas/profile/_v1QCwDSdEeK5yc5OykOa7Q/6 model.profile.uml#_v1Qp0DSdEeK5yc5OykOa7Q">
  <uml:Model xmi:id="_xY8XkDdlEeKttLPFIKJkEA" name="model">
    <packageImport xmi:id="_A78LYDdmEeKttLPFIKJkEA">
      <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
    </packageImport>
  </uml:Model>
</xmi:XMI>

and the corresponding transformed "unify" file like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<unify:Model xmlns:unify="http://xxx/unify" unify:name="model" unify:id="_xY8XkDdlEeKttLPFIKJkEA">
  <unify:entity unify:id="_A78LYDdmEeKttLPFIKJkEA">
    <unify:subentity unify:type="uml:Model" unify:href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
  </unify:entity>
</unify:Model>

But now I don't know how to match the "packageImport" in the ATL rule,the same problem exists in "ownedAttribute" and "lowerValue" element(not list above).Who can give some suggestion,any help will be appreciated.
Re: how to match "packageImport" element in class diagram [message #987581 is a reply to message #987539] Tue, 27 November 2012 09:09 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You have to look at the UML metamodel.
The packageImport eReference is of type PackageImport.
So you can specify a rule on UML!PackageImport in order to transform it to what you want.
Re: how to match "packageImport" element in class diagram [message #987785 is a reply to message #987581] Wed, 28 November 2012 07:42 Go to previous messageGo to next message
Beatus Ding is currently offline Beatus DingFriend
Messages: 18
Registered: November 2012
Junior Member
I have the metamodel,but I donot know how to match the element in atl,can you give me a simple example,or can you recommend some references,thanks a lot~
Re: how to match "packageImport" element in class diagram [message #1229900 is a reply to message #987785] Fri, 10 January 2014 13:47 Go to previous messageGo to next message
Chris BaileyFriend
Messages: 11
Registered: January 2014
Junior Member
Had the same problem here,

Almost resolved it via the following,

where:

UMLPRIM : UML is the input for the UML Primitives library which you can download from here.

create OUT: UML from IN: saafABAC, PRO : UML, UMLPRIM : UML;

rule createModel {
	from
		s: saafABAC!AbacModel
	to
		t: UML!Model(
			name <- 'rbacDSMLmodel',
			packageImport <- thisModule.getUMLPrimitivePackage(s)
		)
}

unique lazy rule getUMLPrimitivePackage{
	from
		s: saafABAC!AbacModel
	to
		t: UML!PackageImport(
			importedPackage <- UML!Package.allInstances()->select(e|e.name = 'PrimitiveTypes')->first()
		)
}


This results in:

  <uml:Model xmi:id="_Wx2IEHn0EeO6P9DYsG50AA" name="rbacDSMLmodel">
    <packageImport xmi:id="_Wx2IEXn0EeO6P9DYsG50AA">
      <importedPackage xmi:type="uml:Model" href="../models/UMLPrimitiveTypes.library.uml#_0"/>
    </packageImport>
   </uml:Model>


As for PATHMAP i'm not sure how to set this yet... if anyone knows I'd be grateful Cool I need to create a relative pathmap like: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0
Re: how to match "packageImport" element in class diagram [message #1250815 is a reply to message #1229900] Wed, 19 February 2014 16:29 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
For the package import you should have a rule like this...

rule CopyPackageImport {
from
s : UML!PackageImport(s.oclIsTypeOf(UML!PackageImport))
to
t : UML!PackageImport
(
--eAnnotations <- s.eAnnotations,
ownedComment <- s.ownedComment,
importedPackage <- s.importedPackage,
importingNamespace <- s.importingNamespace,
visibility <- s.visibility
)
}

then of course the element having the package import should have the following in its rule definition:

packageImport <- s.packageImport

Regards,
Ronan
Previous Topic:[ATL] serialise xmi to specific format
Next Topic:UML meta-model access
Goto Forum:
  


Current Time: Fri Sep 20 21:30:28 GMT 2024

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

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

Back to the top