Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 140e077f5c910ae68f15390032a8d1f8379066b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Linux)">
	<META NAME="AUTHOR" CONTENT="mf224205">
	<META NAME="CREATED" CONTENT="20101125;14510000">
	<META NAME="CHANGEDBY" CONTENT="Ansgar Radermacher">
	<META NAME="CHANGED" CONTENT="20110218;17171000">
	<META NAME="AppVersion" CONTENT="12.0000">
	<META NAME="Company" CONTENT="CEA">
	<META NAME="DocSecurity" CONTENT="0">
	<META NAME="HyperlinksChanged" CONTENT="false">
	<META NAME="LinksUpToDate" CONTENT="false">
	<META NAME="ScaleCrop" CONTENT="false">
	<META NAME="ShareDoc" CONTENT="false">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 2.5cm }
		P { margin-bottom: 0.21cm; direction: ltr; color: #000000; widows: 2; orphans: 2 }
		H1 { margin-top: 0.85cm; margin-bottom: 0cm; direction: ltr; color: #365f91; widows: 2; orphans: 2 }
		H1.western { font-family: "Cambria", serif; font-size: 14pt }
		H1.cjk { font-family: "Arial"; font-size: 14pt }
		H1.ctl { font-family: ; font-size: 14pt }
		H2 { margin-top: 0.35cm; margin-bottom: 0cm; direction: ltr; color: #4f81bd; widows: 2; orphans: 2 }
		H2.western { font-family: "Cambria", serif; font-size: 13pt }
		H2.cjk { font-family: "Arial"; font-size: 13pt }
		H2.ctl { font-family: ; font-size: 13pt }
		H3 { margin-top: 0.35cm; margin-bottom: 0cm; direction: ltr; color: #4f81bd; widows: 2; orphans: 2 }
		H3.western { font-family: "Cambria", serif; font-size: 11pt }
		H3.cjk { font-family: "Arial"; font-size: 11pt }
		H3.ctl { font-family: ; font-size: 11pt }
		A:link { color: #0000ff; so-language: zxx }
	-->
	</STYLE>
</HEAD>
<BODY LANG="fr-FR" TEXT="#000000" LINK="#0000ff" DIR="LTR">
<H1 LANG="en-US" CLASS="western" ALIGN=CENTER><A NAME="_Toc278473442"></A><A NAME="_Toc278473184"></A><A NAME="_Toc278382563"></A>
Tutorial</h1>
<h1> Converter: Diagram Conversion</h1>
<h1>From Papyrus 1 to Papyrus MDT</h1>
<p>
<h2>Specificities</h2>

<table>

<tr>
	<td><h3>Plugin name</h3></td>
	<td><h3>org.eclipse.papyrus.conversion.di2todi</h3></td>
</tr>
<tr>
	<td><h3> Papyrus version</h3></td>
	<td><h3>To be used with Papyrus MDT</h3></td>
</tr>
<tr>
	<td><h3>Status</h3> </td>
	<td><h3>In progress</h3> (class, composite structure, profile and state diagrams are supported)</td>
</tr>
<tr>
	<td><h3>Institution</h3> </td>
	<td><h3>CEA LIST</h3></td>
</tr>
<tr>
	<td><h3>Authors</h3></td>
	<td><h3>Manel Fredj (initial development), Ansgar Radermacher (clean-up/extensions)</h3></td>
</tr>
<tr>
<td><h3>Required (Papyrus) plugins</h3></td>
	<td><ul><li><p>org.eclipse.papyrus.conversion.di2</ul></td>
</tr>
<tr>
	<td><h3>Other Dependencies</h3></td>
	<td><ul>
	<li>org.eclipse.m2m.qvt.oml =&gt; Install QVT
	<li>org.eclipse.ui
	<li>org.eclipse.core.runtime
	<li>org.eclipse.core.resources
	<li>org.eclipse.uml2.uml
	<li>org.eclipse.gmf.runtime.notation
	<li>org.eclipse.m2m.qvt.oml.emf.util
	</ul></td>
</tr>

<tr>
<td><h3>Extensions</h3></td>
	<td><ul>
	<li>org.eclipse.m2m.qvt.oml.javaBlackboxUnits
	<li>org.eclipse.ui.popupMenus
	</ul></td>
</tr>
</table>

<p>

<h1 id="gettingStarted">User Guide</h1>

This plugin enables to convert diagrams created using papyrus 1.X version
into diagram editable by Papyrus MDT. This Tutorial is twofold:

<ul>
<li>First, it includes a user guide in order to convert your diagrams (created
	with Papyrus 1.X) into diagrams editable by Papyrus MDT

<li>Second, it includes a developer guide in order to help developers to extend the
	conversion to other diagram not already supported.
</ul>

<p>

<h2>How to use the converter?</h2>

<ul>
<li>Add the org.eclipse.papyrus.conversion.di2 + di2todi plugins to your
	eclipse configuration. These plugins are provided in the Papyrus SVN
	repository under extraplugins/conversion.

<li>Launch eclipse, including Papyrus MDT. Import your old-version model
	created with Papyrus 1.x, let’s call it “Example”. To this aim
	you need to import two files: “Example.di2” and “Example.uml”,
	as shown in Figure 2.

</ul>

<center>
	<img src="figs/conversion-example-project.png"><br>
	Import Papyrus 1.x Model
</center>

<ul>
<li>Convert your model. To this aim:
	Right click on “Example.di2”&gt; in the menu, select “Convert
	Diagram”&gt;then, “Di2 to Di Action”, as shown in Figure 3.
</ul>

<center>
	<img src="figs/conversion-example-di2action.png"><br>
	Convert Your Model
</center>

<ul>
<li>After processing, a new model is created, compatible with Papyrus MDT.
	Indeed, the conversion creates from the di2 file (i.e., Example.di2)
	two new files, namely, “Example.notation” and “Example.di”.
	The uml file (i.e., Example.uml) is used to make reference to the
	uml graphical elements. At the end of the conversion a message
	dialog is opened to inform you of the success or the failure of your
	conversion.
</ul>

<center>
	<img src="figs/conversion-example-result.png"><br>
	Conversion result
</center>

<ul>
<li>Open the generated di file (i.e., Example.di) to show and edit your
	model.
</ul>

<h2>Internal Process of the conversion</h2>
  
This process is performed transparently to user, however, this brief description aims
to provide global overview of the internal process

<h3>1st Step</h3>
As mentioned in the step2, the diagram
converter requires the di2 namespace to be uniquely defined. To this
aim as a first step of the internal process, the converter changed
the namespace in the di2 file from “<a href="http://www.papyrusuml.org">http://www.papyrusuml.org</a>” to
“<a href="http://www.papyrusuml.org/di2">http://www.papyrusuml.org/di2</a>”.


This step is meant to be transparent to the user, as the converter
restores the di2 namespace to “<a href="http://www.papyrusuml.org">http://www.papyrusuml.org</a>”
at the end of the conversion, in order to make your diagram editable
by Papyrus 1.x.  However,
if the conversion fails before restoring the original name space, the
old-version model may be no more editable by Papyrus 1.x. Hence, the
user may need to restore it manually by editing the di2 file using a
text editor, and removing the “/di2” from the namespace
<a href="http://www.papyrusuml.org/di2">http://www.papyrusuml.org/di2</a>.

<h3>2nd Step</h3>

As a second step, the converter transforms elements described in the di2
file into elements in the notation and di files according to their
respective metamodels. 

The di file contains references to the different diagrams in your model.
The notation file contains a specific description of the elements
that are represented graphically in each diagram: size, coordinates,
nested elements, and so on.
To perform this step, the converter performed a set of QVT
(Query/View/Transform) Operation mappings.

<h3>3rd Step</h3>

Finally, the converter stores the result of the transformation in to two files,
namely, notation and di file, and restores the di2 namespace to
“<a href="http://www.papyrusuml.org">http://www.papyrusuml.org</a>”.

<h2 id="samples">Supported Conversions</h2>

Herein, we present two sample conversions and outline the elements supported by the converter. We start
first with the class diagram and then, we detail the transformations in the composite diagram.

<h3>Class Diagram</h3>

Tests have been done with class diagrams containing
<ul>
<li>Simple classes
<li>Class with operations and attributes 
<li>Comments 
<li>Relationships between classes
	<ul>
	<li>Dependency
	<li>Association
	<li>Link with a comment
	<li>Realization 
	<li>Generalization
	</ul>
</ul>

The screenshots have been taken with an older version that did not copy color attributes. These are now handled.

<center>
	<img src="figs/example1-class-diagram-p1.12.png"><br>
	Class diagram in Papyrus 1.12 (original)
	<p>
	<img src="figs/example1-class-diagram-mdt.png"><br>
	Class diagram in Papyrus MDT (conversion result)
</center>

<h3>Composite Diagram</h3>

Tests have been done with composite diagrams containing

<ul>
	<li>Composite classes
	<li>Properties within composite classes
	<li>Nested classes
	<li>Ports
	<li>Connection between ports: connector
</ul>  
  
<center>
	<img src="figs/example-composite-diag-p1.12.png"><br>
	Composite diagram in Papyrus 1.12 (original)
	<p>
	<img src="figs/example-composite-diag-mdt.png"><br>
	Composite diagram in Papyrus MDT (conversion result)
</center>
  
<h1 id="devGuide">Developer guide</h1>
  
To convert models from Papyrus 1.x to Papyrus MDT, this plugin uses Q/V/T operational mappings.
The plugin contains additional Java code, it is divided into three parts:
<ul>
	<li>Model Transformation libraries implemented in QVTO
	<li>Black Boxes implemented in Java and used by the model transformations
	<li>Java code that is used to call the model transformations and extend the eclipse
		context menu with the conversion action, i.e., "Convert Diagram".
</ul>

The main part of the plugin is the model transformation, which includes
<ul>
<li>General libraries:
	<ul>
	<li>ElementType.qvto: names of diagrams in Papyrus 1.12 and MDT. 
	<li>GeneralMappingsandHelpers.qvto: collection of utilities
	<li>NotationQueries.qvto
		includes all the queries that are made to the di2 model in order to
		be used in the notation model.
	<li>Diagram.qvto: convert the supported diagrams, make use of diagram specific
		libraries below.
	<li>DiTansformation.qvto
		enable to create the elements of the di model from the di2 model.
	</ul>

<li>Diagram specific libraries, prefixed with name of diagram, i.e. &lt;Class&gt;, &lt;Composite&gt;, &lt;State&gt;,
	&lt;Profile&gt; and &lt;ClassAndProfile&gt; (the letter is a particular case for edges in class and profile
	diagrams which have identical IDs in these two diagram types)
	<ul>
	<li>DiagEdge.qvto
		that converts all sorts of edges (realization, dependency,
		generalization, and so on).
	<li>DiagNodes.qvto that converts the node elements of a diagram
	</ul>
<li>The main transformation
	<ul>
		<li>Transfo.qvto, which triggers the model transformation.
	</ul>  
</ul>  

Back to the top