Cross-referencing UML profiles in ATL [message #1727854] |
Mon, 28 March 2016 15:13 |
Kevin Mansfield Messages: 3 Registered: March 2016 |
Junior Member |
|
|
Hello,
I have an issue with ATL translation in Eclipse when the UML model contains cross-references to a custom UML profile. I exported a UML2 model via MagicDraw export feature, and it puts the following headers in the exported model:
<?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:Company_Library="http:///schemas/Company_Library/_mci5gB9YEeWGPsqlZErtvg/0"
...
...
Furthermore inside the UML model, I am referencing the port of a "connector" from the following piece:
...
...
<ownedConnector xmi:id="_17_0_2_2_f5f036c_1422441878678_115434_20754" name="" visibility="public">
<end xmi:id="_17_0_2_2_f5f036c_1422441878678_431675_20755" partWithPort="_17_0_2_2_f5f036c_1422441279950_334585_18801">
<role xmi:type="uml:Port" href="Company_Library.profile.uml#_17_0_2_1_68d022b_1370974096642_633421_14584"/>
</end>
<end xmi:id="_17_0_2_2_f5f036c_1422441878693_441124_20756">
<role xmi:type="uml:Port" href="Company_Library.profile.uml#_17_0_2_2_f5f036c_1422205317634_642500_19398"/>
</end>
</ownedConnector>
...
...
Inside my ATL script, I reference the port via the "role" attribute:
connector.end.at(dest_index).role.__xmiID__
However while running the ATL translation script within Eclipse, it is unable to reference (shows as <unknown>!<unnamed>) the role defined by:
href="Company_Library.profile.uml#_17_0_2_1_68d022b_1370974096642_633421_14584"
which is a port defined inside Company_Library.profile.uml.
Questions:
1. How do I modify my Ant script to allow the cross-reference to succeed? I already enabled <option name="allowInterModelReferences" value="true"/>. Do I need to explicitly load the Company_Library profile as a UML model, something like:
<atl.loadModel name="Company_Library.profile.uml" metamodel="UML2" path="<path_to_Company_Library.profile.uml">?
2. Do I need to place Company_Library.profile.uml inside a "schemas" folder since the UML2 model header specifies "Company_Library" namespace to be within the "schemas" folder?
[UPDATE] I tried both of the above options but they didn't work.
The source mode, the ATL script and the UML profile all reside in the same folder (project folder). I am able to load the UML model as a resource in the Ecore editor, and it automatically loads the profile correctly. The reference problem occurs while running the ATL script on the UML model from within Eclipse.
[UPDATE 2] I tried using the EMFTVM instead of ATL, and that seems to resolve the cross-references correctly. However I want to use ATL because of limitations of EMFTVM. So it appears there is a bug in the ATL.
Any suggestions will be greatly appreciated.
[Updated on: Wed, 30 March 2016 17:58] Report message to a moderator
|
|
|
|
|
Re: Cross-referencing UML profiles in ATL [message #1728523 is a reply to message #1728491] |
Tue, 05 April 2016 07:27 |
|
Indeed. EMFTVM relies on the EMF file extension registry to select the injector/extractor (or "resource implementation" in EMF vocab). For example, when you specify an ATL output model with the ".atl" file extension in the URI, EMF will select the AtlResourceImpl. If the URI ends with ".xmi", it will use the XMIResourceImpl instead.
That said, if you want to use ATL's XML metamodel and injector/extractor for working with schema-less XML, you're out of luck. EMFTVM requires you to go the EMF way, and create an Eclipse plugin of that XML metamodel, complete with custom resource implementation class. You might want to take a look at http://www.emftext.org/index.php/EMFText_Concrete_Syntax_Zoo_XML for this case.
Cheers,
Dennis
|
|
|
Powered by
FUDForum. Page generated in 0.03641 seconds