Book a Demo

Author Topic: Import model from any human editable format(csv,xml)  (Read 4225 times)

Yulia.Strakhova

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Import model from any human editable format(csv,xml)
« on: October 26, 2020, 07:02:05 pm »
Hello,

I have task to generate class diagram in EA for existing java code. The best plan is to generate some file and import diagram from it. Model is described in OpenApi, so I can transform it into any format. Only problem i have is to find out file format  for import. 


Then I tried to find out how I can import model into EA.  I create new project and sample diagram from template “Basic Class Diagram with Attributes”. Then I tried to export and import “Basic Class Diagram with Attributes” using different approach.  My goal find out file format from example and make sure I can import my model then. 

Experiment was: export model, then import, make sure they are identical(format not important, at least base properties, objects , it's types, attributes, associations)

Export/Import CSV.
Set field “Types” empty, then Export to CSV
expected result: file contains all objects, classes, attributes and associations.
actual result: file contains Class objects only



Export/Import using XSD
Export to XSD, then Import same file to different project.
expected result: same diagram
actual result: new diagram is different.  It contain <<XSDDocumetType>> objects, not classes as original one. 


EA 15.2


Do you have an Idea what I make wrong here?

Best regards
Yulia

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Import model from any human editable format(csv,xml)
« Reply #1 on: October 26, 2020, 07:29:46 pm »
Yulia,

If you want to import classes from java code, you probably are best off to reverse engineer from the java code.

If you can't do that I would suggest to use a custom import script.
In case you only want to import classes and attributes, you can use the excel import/export tool I made: https://bellekens.com/ea-excel-import-export/

Another option would be to create a xmi file from your code and import from there, but that will be a lot more complicated then importing it directly in EA using the API.

A single import is reasonably easy. Updating an existing model will be more challenging.

Geert

Yulia.Strakhova

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Import model from any human editable format(csv,xml)
« Reply #2 on: October 26, 2020, 07:50:12 pm »
Geert, 

thank for reply.

Reverse engineer is first option i have tried. It import Java classes, but i need Class objects.   
And it will be ok just single import.

In general i'm really surprised that there are no easy way to export/import. I hoped that i just have chosen wrong option somewhere.   Now my hope is fading away.





Yulia.Strakhova

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Import model from any human editable format(csv,xml)
« Reply #3 on: October 26, 2020, 08:41:26 pm »
I tied script

"Script out of range" error  on string
excelConn.writeValues "Export_Import", 1, 1, data
Look like data is empty for some reason

Microsoft Office Standard 2016

« Last Edit: October 26, 2020, 09:02:09 pm by Yulia.Strakhova »