
__TOC__
= Import Export of ReqIF elements into Papyrus =
<span id="_joeEYLH0EeSvo7o7Iu6GQQ">This model explains the functionality in Papyrus Req in order to import or export ReqIF files into Papyrus (OMG Document Number: formal/2013-10-01 Standard document URL: http://www.omg.org/spec/ReqIF/1.1)
</span>
==<span id="_jofSgbH0EeSvo7o7Iu6GQQ">Table of Contents</span>==
:[[#_johHsbH0EeSvo7o7Iu6GQQ|Requirements]]
:[[#_jo_o0bH0EeSvo7o7Iu6GQQ|Use Cases]]
::[[#_jrxQAbH0EeSvo7o7Iu6GQQ|ReqIfModule]]
::[[#_jryeIbH0EeSvo7o7Iu6GQQ|Import ReqIF file]]
::[[#_jwTxwbH0EeSvo7o7Iu6GQQ|How to]]
::[[#_jwrlMLH0EeSvo7o7Iu6GQQ|Import DataType Enumeration]]
::[[#_jwtaYbH0EeSvo7o7Iu6GQQ|Import SpecObjectTypes]]
::[[#_jwv2obH0EeSvo7o7Iu6GQQ|Import SpecObjects]]
::[[#_jwyS4bH0EeSvo7o7Iu6GQQ|Export UML Model to ReqIF File]]
::[[#_jzmWUbH0EeSvo7o7Iu6GQQ|How to]]
::[[#_jz1m4bH0EeSvo7o7Iu6GQQ|export DataType]]
::[[#_jz4DIbH0EeSvo7o7Iu6GQQ|Export Stereotypes]]
::[[#_jz6fYbH0EeSvo7o7Iu6GQQ|Export Stereotyped Elements]]
::[[#_jz87obH0EeSvo7o7Iu6GQQ|Re-Import]]
::[[#_jz-w0bH0EeSvo7o7Iu6GQQ|Re-Export]]
::[[#_j0BNEbH0EeSvo7o7Iu6GQQ|Adavanced ReqIFile Import]]
::[[#_j0CbMbH0EeSvo7o7Iu6GQQ|Import SpecRelation]]
::[[#_j0DpULH0EeSvo7o7Iu6GQQ|ImportspecRelationType]]
:[[#_j0EQYbH0EeSvo7o7Iu6GQQ|Design]]
::[[#_j2jjsbH0EeSvo7o7Iu6GQQ|com.cea.darwin.reqif]]
::[[#_j2l_8bH0EeSvo7o7Iu6GQQ|assistant]]
::[[#_j2nOELH0EeSvo7o7Iu6GQQ|ReqIFNewFilePage]]
::[[#_j2ocMbH0EeSvo7o7Iu6GQQ|ReqIFSelectionPage]]
::[[#_j2pqUbH0EeSvo7o7Iu6GQQ|CreateOrSelectProfileDialog]]
::[[#_j2q4cbH0EeSvo7o7Iu6GQQ|integration]]
::[[#_j2sGkbH0EeSvo7o7Iu6GQQ|assistant]]
::[[#_j2tUsbH0EeSvo7o7Iu6GQQ|AbstractWizardForPapyrus]]
::[[#_j2t7wbH0EeSvo7o7Iu6GQQ|ChooseReqIFTypeDialog]]
::[[#_j2vJ4bH0EeSvo7o7Iu6GQQ|ReqIFImportWizard]]
::[[#_j2wYAbH0EeSvo7o7Iu6GQQ|ReqIFExportWizard]]
::[[#_j2xmIbH0EeSvo7o7Iu6GQQ|transformation]]
::[[#_j2y0QbH0EeSvo7o7Iu6GQQ|ReqIFImporterServiceEdit]]
::[[#_j20CYbH0EeSvo7o7Iu6GQQ|command]]
::[[#_j21QgbH0EeSvo7o7Iu6GQQ|DefineProfileCommand]]
::[[#_j22eobH0EeSvo7o7Iu6GQQ|transformation]]
::[[#_j23swbH0EeSvo7o7Iu6GQQ|ReqIFImporter]]
::[[#_j2464LH0EeSvo7o7Iu6GQQ|ReqIFBaseTransformation]]
::[[#_j25h8bH0EeSvo7o7Iu6GQQ|ReqIFExporter]]
:[[#_j26wEbH0EeSvo7o7Iu6GQQ|Tests]]
::[[#_j27-MbH0EeSvo7o7Iu6GQQ|TestImport]]
::[[#_j2-acbH0EeSvo7o7Iu6GQQ|TestExport]]
:[[#_j2_okLH0EeSvo7o7Iu6GQQ|Requirements Coverage]]
==<span id="_johHsbH0EeSvo7o7Iu6GQQ">Requirements</span>==
<span id="_jokyELH0EeSvo7o7Iu6GQQ">- ReqIfImport (id=ReqIF_001): 
 Darwin shall allow importation of Reqif elements to SysML Model</span>
<span id="_jon1YLH0EeSvo7o7Iu6GQQ">- Import SpecObjects (id=ReqIF_001_001): 
 The user shall be able to import spec object</span>
<span id="_joq4sLH0EeSvo7o7Iu6GQQ">- Two  Kind of Users (id=ReqIF_001_002): 
 The simple User can only import SpecObject by choosing domain. The AdvancedUser can import Types and DataTypes. </span>
<span id="_jotU8LH0EeSvo7o7Iu6GQQ">- Import DataType Enumeration (id=ReqIF_001_003): 
 The advanced user shall be able to import DataType and enumeration</span>
<span id="_jovxMLH0EeSvo7o7Iu6GQQ">- Import SpecObjectTypes (id=ReqIF_001_004): 
 The advanced user shall be able to import specObjectType</span>
<span id="_joxmYLH0EeSvo7o7Iu6GQQ">- Import SpecRelationType (id=ReqIF_001_005): 
 The advanced user  shall be able to import SpecRelationType</span>
<span id="_jozbkLH0EeSvo7o7Iu6GQQ">- Import SpecRelation (id=ReqIF_001_006): 
 Papyrus Req shall import SpecRelation</span>
<span id="_jo130LH0EeSvo7o7Iu6GQQ">- ReqIFExport (id=ReqIF_002): 
 Darwin shall enable export of SysML requirement to ReqIF Model</span>
<span id="_jo3tALH0EeSvo7o7Iu6GQQ">- ControlMode (id=ReqIF_003): 
 The managment with ReqIf must support Control Mode</span>
<span id="_jo6JQLH0EeSvo7o7Iu6GQQ">- WihtoutUI (id=ReqIF_004): 
 The export can be done programmatically, without GUI, in order to test it, or to be enable to pilot it programmatically</span>
<span id="_jo8lgLH0EeSvo7o7Iu6GQQ">- Re-Export (id=ReqIF_005): 
 Papyrus shall re-export requirements in existing reqIF file</span>
<span id="_jo-asLH0EeSvo7o7Iu6GQQ">- Re-Import (id=ReqIF_006): 
 Papyrus shall re-Import requirement from a ReqIF file</span>
==<span id="_jo_o0bH0EeSvo7o7Iu6GQQ">Use Cases</span>==
[[Image:./imgDOC/UseCases_Diagram.png|UseCases Diagram]]<br>
===<span id="_jrxQAbH0EeSvo7o7Iu6GQQ">ReqIfModule</span>===
====<span id="_jryeIbH0EeSvo7o7Iu6GQQ">Import ReqIF file</span>====
<span id="_jrzsQbH0EeSvo7o7Iu6GQQ">In order to import ReqFile into UMLModel, first analysis will be done:
- All existing SpecObjectTypes will be listed. From the list, the user chooses interesting Types. (In fact types may be purely information as title, chapter...)
- All stereotypes from applied profiles will be also listed.
Because each SpecType becomes a stereotype based on Requirement, if the two lists are equals no stereotypes will be created. </span>
[[Image:./imgDOC/Import_Activity.png|Import Activity]]<br>
<span id="_jwTKsLH0EeSvo7o7Iu6GQQ">If stereotypes need to be created, a dialog is opened  in order to ask to the user if a profile must be created.
After importing types, elements of ReqIF file are imported  
</span>
<span id="_jwVm8LH0EeSvo7o7Iu6GQQ">Before import requirement fro ReqIF file, the kinf of User has to be verified.

There are two kind of users:

	- Simple User: he can only import instance of requirements inside the Papyrus tool.

	- Advancerd User: he can importe new types of requirements and instance of requirement inside  the Papyrus tool 

To verify it, go to window--> preferences--> Papyrus--> ReqIF Import</span>
[[Image:./imgDOC/Userkind.png|Two kinds of user]]<br>
<span id="_jwXcIbH0EeSvo7o7Iu6GQQ">First the User must have a SysML model. Select the package where ReqIF elements will be imported.
</span>
[[Image:./imgDOC/import_1.png|Import SysMLModel]]<br>
<span id="_jwZ4YbH0EeSvo7o7Iu6GQQ">Select the menu Import  of Eclipse.</span>
[[Image:./imgDOC/import_2.png|Select import Menu of Eclipse]]<br>
<span id="_jwcUobH0EeSvo7o7Iu6GQQ">Select the menu Import ReqIF from Papyrus Categories</span>
[[Image:./imgDOC/import_3.png|Import ReqIF]]<br>
<span id="_jwew4bH0EeSvo7o7Iu6GQQ">Select the ReqIF file to import</span>
[[Image:./imgDOC/import_4.png|ReqIF file Selection]]<br>
<span id="_jwhNILH0EeSvo7o7Iu6GQQ">Select  Requirement types of ReqIF file that you want to import</span>
[[Image:./imgDOC/import_5.png|SpecObject Type selection]]<br>
<span id="_jwjCUbH0EeSvo7o7Iu6GQQ">When the current user is an "Advanced User", he can import Requirement types and all requirements from ReqIF , if needed he can select or create the profile that will contain imported types</span>
[[Image:./imgDOC/import_6.png|Create or select Profile]]<br>
<span id="_jwlekbH0EeSvo7o7Iu6GQQ">When the current user is a "Simple User", he can only import instances of requirements by choosen predefined types contained in the profile.
If the profile does not contain all needed types, the import is not done and a message is displayed on the screen. </span>
[[Image:./imgDOC/Choose_Predefined_Profile.png|Choose predefined type contained in profile]]<br>
[[Image:./imgDOC/CannotImport.png|The import cannot be done if the profile is not complete.]]<br>
<span id="_jwpI8bH0EeSvo7o7Iu6GQQ">The model has now imported requirements with relations. Note that a comment explains the origin of the import.</span>
[[Image:./imgDOC/import7.png|Resulted model]]<br>
====<span id="_jwrlMLH0EeSvo7o7Iu6GQQ">Import DataType Enumeration</span>====
<span id="_jwszULH0EeSvo7o7Iu6GQQ">Each Datatype Definition  Enumeration in a ReqFIle is transformed to UML Eneumeration in a profile.
</span>
====<span id="_jwtaYbH0EeSvo7o7Iu6GQQ">Import SpecObjectTypes</span>====
<span id="_jwuogbH0EeSvo7o7Iu6GQQ">Each SpecObjectType choosen in the ReqIFile is transformed to stereotype that inherits of SysML Requirement in a profile.
Each SpecRelationType of the ReqIF file is transformed in to Stereotype based on dependency Metaclass.
Each attribute  is transformed to equivalent attribute in Stereotype. Only XTML attributes are transformed into String typed attributes in profile.
</span>
====<span id="_jwv2obH0EeSvo7o7Iu6GQQ">Import SpecObjects</span>====
<span id="_jwxEwbH0EeSvo7o7Iu6GQQ">Each SpecObjectNode is transformed to class with a corresponded applied stereotype. During the creation, SpecHierarchy ared used in order to structure the SysML files.
Each Specification becomes a package.
Each SpecRelation becomes a stereotyped dependency. if the souce or target of this object are not created, the spec relation will be not imported.
</span>
====<span id="_jwyS4bH0EeSvo7o7Iu6GQQ">Export UML Model to ReqIF File</span>====
<span id="_jwzhAbH0EeSvo7o7Iu6GQQ">The goal is to export all requirements and links into ReqIF.
To do that, the tool lists all applied stereotypes that inherits of SysML::Requirement and that inherits of dependencies.
From this list, the tool constructs, in ReqIF File, correponding specObjects Tyoes and SpecRelationsTypes
Then from all stereotyped elements, it constructs the corresponding hierarchy. 

</span>
[[Image:./imgDOC/Export_Activity.png|Export Activity]]<br>
<span id="_jznkcbH0EeSvo7o7Iu6GQQ">Select the SysML that you want to export
</span>
[[Image:./imgDOC/export1.png|SysML Model]]<br>
<span id="_jzqnwbH0EeSvo7o7Iu6GQQ">Select the export Menu from Eclipse menu.</span>
[[Image:./imgDOC/export2.png|Export Menu]]<br>
<span id="_jztrELH0EeSvo7o7Iu6GQQ">Select the menu export ReqIF form the papyrus Category</span>
[[Image:./imgDOC/export3.png|Import ReqIF file]]<br>
<span id="_jzwHUbH0EeSvo7o7Iu6GQQ">Choose the name of the reqif file.</span>
[[Image:./imgDOC/export5.png|Choose ReqIF File name]]<br>
<span id="_jzzKobH0EeSvo7o7Iu6GQQ">At the end, a reqFile is generated. The header has an information that explain that the result comes from UML file.
</span>
[[Image:./imgDOC/Export4.png|Result in the ReqIf file]]<br>
====<span id="_jz1m4bH0EeSvo7o7Iu6GQQ">export DataType</span>====
<span id="_jz21AbH0EeSvo7o7Iu6GQQ">In a reqFile, all basic types must be created; that is why data type definition string, integer, Real, boolean and XHTML are created.
Moreover, all Enumerations in applied profiles become DataTypeDefinitionEnumerations in the ReqIF file.
</span>
====<span id="_jz4DIbH0EeSvo7o7Iu6GQQ">Export Stereotypes</span>====
<span id="_jz5RQbH0EeSvo7o7Iu6GQQ">From all stereotypes, all SpecObject Types and all SpecRelationTypes will be created. If an attribute of a stereotype is typed by a primitiveType named XHTML, the attribute of the SpecObjecType will be XHTML. </span>
====<span id="_jz6fYbH0EeSvo7o7Iu6GQQ">Export Stereotyped Elements</span>====
<span id="_jz7tgbH0EeSvo7o7Iu6GQQ">From all packages that contains Requirements, a specification will be created. Then a hierarchy will be created by taking in account the structure of requirements. Finally SpecObject and SpecRelation are created.
</span>
====<span id="_jz87obH0EeSvo7o7Iu6GQQ">Re-Import</span>====
<span id="_jz-JwLH0EeSvo7o7Iu6GQQ">When a ReqIfile has been already imported, Papyrus shall update contents during Re-import
</span>
====<span id="_jz-w0bH0EeSvo7o7Iu6GQQ">Re-Export</span>====
<span id="_jz_-8bH0EeSvo7o7Iu6GQQ">When a UML model has been already exported, PapyrusReq must only update the content of the file.
</span>
====<span id="_j0BNEbH0EeSvo7o7Iu6GQQ">Adavanced ReqIFile Import</span>====
====<span id="_j0CbMbH0EeSvo7o7Iu6GQQ">Import SpecRelation</span>====
====<span id="_j0DpULH0EeSvo7o7Iu6GQQ">ImportspecRelationType</span>====
==<span id="_j0EQYbH0EeSvo7o7Iu6GQQ">Design</span>==
[[Image:./imgDOC/Architecture_of_ReqIF_Import-Export.png|Architecture of ReqIF Import-Export]]<br>
<span id="_j2iVkbH0EeSvo7o7Iu6GQQ">The architecture is quite simple. There are wizard for import and export,  two classes to realize the job and differents assistants or dialogs.
Nevertheless, two layers can be distinguished in the code:
	- one layer independent of the papyrus
	- one layer called integration dependent of papyrus.
Efforts have been made to be more independant of papyurs in order to facilitate the maintenance of the algorithm for import export.
The layer integration contains specializations to create elements by using service edit or use some facilities as advanced dialog.

</span>
===<span id="_j2jjsbH0EeSvo7o7Iu6GQQ">com.cea.darwin.reqif</span>===
<span id="_j2kx0bH0EeSvo7o7Iu6GQQ">independant of Papyrus</span>
====<span id="_j2l_8bH0EeSvo7o7Iu6GQQ">assistant</span>====
====<span id="_j2q4cbH0EeSvo7o7Iu6GQQ">integration</span>====
====<span id="_j22eobH0EeSvo7o7Iu6GQQ">transformation</span>====
==<span id="_j26wEbH0EeSvo7o7Iu6GQQ">Tests</span>==
===<span id="_j27-MbH0EeSvo7o7Iu6GQQ">TestImport</span>===
<span id="_j29MUbH0EeSvo7o7Iu6GQQ">The goal is to test the import of a reIF file
</span>
===<span id="_j2-acbH0EeSvo7o7Iu6GQQ">TestExport</span>===
==<span id="_j2_okLH0EeSvo7o7Iu6GQQ">Requirements Coverage</span>==
{| border="1" cellpadding="20" cellspacing="0"
!ID
!Satisfy by
!Verify by
|-
|[[#_jokyELH0EeSvo7o7Iu6GQQ|ReqIF_001]]

|Import ReqIF file, 

Import DataType Enumeration, 

Import SpecObjects, 

Import SpecObjectTypes

|

|-
|[[#_jon1YLH0EeSvo7o7Iu6GQQ|ReqIF_001_001]]

|
|

|-
|[[#_joq4sLH0EeSvo7o7Iu6GQQ|ReqIF_001_002]]

|
|

|-
|[[#_jotU8LH0EeSvo7o7Iu6GQQ|ReqIF_001_003]]

|
|

|-
|[[#_jovxMLH0EeSvo7o7Iu6GQQ|ReqIF_001_004]]

|
|

|-
|[[#_joxmYLH0EeSvo7o7Iu6GQQ|ReqIF_001_005]]

|
|

|-
|[[#_jozbkLH0EeSvo7o7Iu6GQQ|ReqIF_001_006]]

|
|

|-
|[[#_jo130LH0EeSvo7o7Iu6GQQ|ReqIF_002]]

|export DataType, 

Export UML Model to ReqIF File, 

Export Stereotypes, 

Export Stereotyped Elements

|

|-
|[[#_jo3tALH0EeSvo7o7Iu6GQQ|ReqIF_003]]

|
|

|-
|[[#_jo6JQLH0EeSvo7o7Iu6GQQ|ReqIF_004]]

|
|

|-
|[[#_jo8lgLH0EeSvo7o7Iu6GQQ|ReqIF_005]]

|Re-Export

|

|-
|[[#_jo-asLH0EeSvo7o7Iu6GQQ|ReqIF_006]]

|Re-Import

|

|}
<span id="_j3APorH0EeSvo7o7Iu6GQQ">Unsatisfied requirements (8 out of 12) : </span>[[#_jon1YLH0EeSvo7o7Iu6GQQ|ReqIF_001_001, ]][[#_joq4sLH0EeSvo7o7Iu6GQQ|ReqIF_001_002, ]][[#_jotU8LH0EeSvo7o7Iu6GQQ|ReqIF_001_003, ]][[#_jovxMLH0EeSvo7o7Iu6GQQ|ReqIF_001_004, ]][[#_joxmYLH0EeSvo7o7Iu6GQQ|ReqIF_001_005, ]][[#_jozbkLH0EeSvo7o7Iu6GQQ|ReqIF_001_006, ]][[#_jo3tALH0EeSvo7o7Iu6GQQ|ReqIF_003, ]][[#_jo6JQLH0EeSvo7o7Iu6GQQ|ReqIF_004]]
<span id="_j3CE0bH0EeSvo7o7Iu6GQQ">Unverified requirements (12 out of 12) : </span>[[#_jokyELH0EeSvo7o7Iu6GQQ|ReqIF_001, ]][[#_jon1YLH0EeSvo7o7Iu6GQQ|ReqIF_001_001, ]][[#_joq4sLH0EeSvo7o7Iu6GQQ|ReqIF_001_002, ]][[#_jotU8LH0EeSvo7o7Iu6GQQ|ReqIF_001_003, ]][[#_jovxMLH0EeSvo7o7Iu6GQQ|ReqIF_001_004, ]][[#_joxmYLH0EeSvo7o7Iu6GQQ|ReqIF_001_005, ]][[#_jozbkLH0EeSvo7o7Iu6GQQ|ReqIF_001_006, ]][[#_jo130LH0EeSvo7o7Iu6GQQ|ReqIF_002, ]][[#_jo3tALH0EeSvo7o7Iu6GQQ|ReqIF_003, ]][[#_jo6JQLH0EeSvo7o7Iu6GQQ|ReqIF_004, ]][[#_jo8lgLH0EeSvo7o7Iu6GQQ|ReqIF_005, ]][[#_jo-asLH0EeSvo7o7Iu6GQQ|ReqIF_006]]