How to create a new EDNA data model with EA

From EdnaWiki
Jump to: navigation, search

EDNA Plugin Generation Tutorial

Note: This section is written for use with Enterprise Architect (EA). The EDNA developers plan to switch to developing the data model in Eclipse in the future, time permitting.

Creating an EDNA Plugin for a specific function UnitCellSpaceGroup of a program called MYPROGRAM

Here we develop an EDNA Execution (Exec) plugin for the function "UnitCellSpaceGroup" in the program "MYPROGRAM". A file of type MTZ is specified as input. Spacegroup and Cell dimension details are output from the program. A UML model is first created to describe the data model for the plugin(s). This is then exported as an XSD Schema which is then used by the Plugin Generator to create the python code for the Plugin.

Creating a new project in Enterprise Architect

  • Open up EA
  • Select New EAP
  • Give it the name of the plugin XSDataMYPROGRAMUnitCellSpaceGroup Model
  • Import the edna kernel common data model from the EDNA distribution: Edna/kernel/datamodel/XSDataCommon
  • Create a new View
  • Enter the Name of the Plugin: XSDataMYPROGRAMUnitCellSpaceGroup Class
  • Choose class view
  • Right click on this class and choose add diagram
  • Now we can start modelling!

UML Modelling

Creating the class

  • Click on class
  • Use mouse to click on diagram and editor for class will appear
  • Give it name “XSDataCell”
  • Hit Enter
  • Select object and click with right mouse, select “Advanced” and select “Set Parent”
  • Add New Relation: XSData (Comes from MXv1 Data model)
  • Now sub-classed from XSData

Adding attributes

  • Click with Right button and choose “Attributes”
    • Name: length_a
    • Type:XsDataLength
    • Scope: Public
  • Hit SAVE!!!!!!!!!
  • Create same for length_b and length_c and each of the angles (angle_alpha....). Remember to change Type to XSDataAngle
  • SAVE each time!!!!!!
  • Close and can now see contents in class diagram

Next Step: Do the same for XSDataSpaceGroup Class

    • Name: XSDataString
    • symmetryOperator: XSDataString[1...*]
    • Should be symmetry operator

Next Step: Define input and output data classes

  • Create a new class XSDataInputMYPROGRAMUnitCellSpaceGroup and XSDataResultMTZDUMPU......
  • Set the parents for each of these “XSDataInput” and “XSDataResult” respectively
  • For Input add attribute:
    • InputMTZFile
    • Type: XSDataFile
    • Scope: Public
  • Output:
    • Spacegroup: XSDataSpaceGroup
    • unitCell: XSDataCell
  • C’est Fini

Tying the data models together

  • Go back to Project Browser window:
  • Tie the data models together
  • Select our class, Select View, Tagged values – Take class view, click on “New Tag” and type:
    • Tag: schemaLocation
    • Value: XSDataCommon.xsd
  • Again for targetNameSpace:
  • Note: These are the same as for XSDataCommon Class
  • Now we’re done!!!!

How to generate the XSD schema file