Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Albert De La Fuente on April 25, 2012, 02:04:31 pm

Title: Importing relations between objects
Post by: Albert De La Fuente on April 25, 2012, 02:04:31 pm
Hi,

I have a huge requirements list in excel that I'm able to import (csv) fine on EA. For each requirement, I want to create an use case, so I transform the file by changint the object type and I'm able to import (csv) it fine too.

Now what I would like is to import a single (1x1) relation between each use case and each requirement. UC01 <-> REQ01, UC02 <-> REQ02, and so on.

I have not found any "Realisation" object type or similar on the csv file so that it can be imported automatically. Is there any way to do this?

So what I thought is... Export (csv) both the use cases and the requirements with full UUID's to separated files, and them relate the UUID's of each in a new file that later will be processed by a python script to generate a xmi file so it can be re-imported to EA.

This approach is not very easy, so I'm looking for something more simple, if possible via csv.

Any ideas?

Thanks a lot!
Title: Re: Importing relations between objects
Post by: Geert Bellekens on April 25, 2012, 09:32:53 pm
See Simple VBA Excel EA importer (http://community.sparxsystems.com/resources/scripts/simple-vba-excel-ea-importer)
Should be easy enough to include a feature to import relationships.

Geert
Title: Re: Importing relations between objects
Post by: Albert De La Fuente on April 25, 2012, 10:27:32 pm
Thanks for your answer Geert,

I downloaded the xls file and open up the macro definitions, but I'm not able to execute it, I get the following error on EA.repository: “Can't find Project or Library”. I'm using EA & excel through wine emulation on linux

Is there something similar in Java? (i.e. Java cvs classes importer). At this point what I would like to know is how to import a relation between two or more objects, could you please highlight me where is that on your code? (line number)

Thanks again!
Title: Re: Importing relations between objects
Post by: Geert Bellekens on April 25, 2012, 10:34:21 pm
I don't know of any existing java code that does the same, but I don't see why it shouldn't be possible.
The reason you're getting the error is probably because it can't find the Interop.EA.dll

The excel only imports classes and attributes, but adding a function to handle relation should be quite easy.

Geert
Title: Re: Importing relations between objects
Post by: Albert De La Fuente on April 25, 2012, 10:44:54 pm
Thanks Geert,

I will research more about the dll to make it work.

Do you know what would be the routine to invoke to import a "Realisation" (or other) relationship?

Thanks again!
Title: Re: Importing relations between objects
Post by: Geert Bellekens on April 25, 2012, 10:50:13 pm
Should be similar to:
Code: [Select]
EA.Connector newConnector = Element.Connectors.AddNew("""Realization");
newConnector.SupplierID = myTargetID;
newConnector.Update();

Geert






Title: Re: Importing relations between objects
Post by: Albert De La Fuente on April 25, 2012, 11:00:07 pm
Thanks a lot Geert,

I will try that!