Author Topic: Building cross relations using data miner  (Read 449 times)

peto

  • Guest
Building cross relations using data miner
« on: May 20, 2020, 04:10:54 pm »
Newbee question so please bare with me  ::)

I'm trying to use Data Miner with a java script to load a stack of ArchiMate Nodes and related system software. I would like to have the load function to pre-load the existing System Software that are registered within the EA model. The model is very much structured around the TOGAF idea of a Continuum so having a single package structure holding all the System Software.
I have no idea as to how to make sure that System Software that are registred within the model do not get created again and that I can build a relation between the Node and the Software during the Data Miner load process.

Any hints, pointers etc. are appreciated.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10527
  • Karma: +358/-31
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Building cross relations using data miner
« Reply #1 on: May 20, 2020, 05:19:22 pm »
Context: I don't know about the Data Miner feature, but I do a lot of scripting.

If you want to check if something already exists I suggest you an SQL Search.

You can use GetElementSet (string IDList, long Options) with options parameter :2
In that case you can pass an SQL Query to the parameter IDList (Yes, I know  :o)

Then use a query such as

Code: [Select]
select o.Object_ID from t_object o
where o.name = 'someName'
and o.stereotype = 'ArchiMate_ApplicationComponent'

This returns an EA.Collection with the selected elements.
If the count is 0 then you're OK to create a new one.
If the count is 1 then you can update the existing element
if the count is > 1 you already had a problem before the import  ;D

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1815
  • Karma: +122/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Building cross relations using data miner
« Reply #2 on: May 20, 2020, 06:23:14 pm »
Hi Peto,


And welcome to the forum. :)

Like Geert, I have no hands-on experience with the Data Miner API -- it's pretty new -- but I do a lot of EA extensions, and one of the common tasks there is to modelify data from an external source.

The key issue when maintaining such a model is to know what constitutes an identity. In EA, each package, element, connector, diagram, attribute, operation etc are identified by their GUID. Names can chage, but if the GUID doesn't change it's the same element.

The question is: what is the identity concept in your data source?

Once you're clear on that, if it's something like a GUID or a numeric identity, the best thing to do is to store that as a tagged value in each corresponding element in your model. If there is no separate identity concept you'll have to use names, in which case you need to make sure that there are no duplicates of (stereotype+name) in your target model before (re-) importing: that constitutes a broken model.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

peto

  • Guest
Re: Building cross relations using data miner
« Reply #3 on: May 20, 2020, 06:29:52 pm »
Thanks Uffe,

the identity is slightly vauge as data so far have been maintained in Excel  :-X. But for System Software registration have been pretty strict. So for now I have to rely on the bare name, once data is looped back it would be painted with ID's that points back to EA. So it's primary for this initial load and the x-ref to the systems using the software.

peto

  • Guest
Re: Building cross relations using data miner
« Reply #4 on: May 20, 2020, 06:33:06 pm »
Thanks Geert,

would it be that I can build a set with the different existing elements  and ID's using a SQL construct combined with javascript to reduce the number of SQL requests I have to make to the model db during load?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10527
  • Karma: +358/-31
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Building cross relations using data miner
« Reply #5 on: May 20, 2020, 07:15:08 pm »
Thanks Geert,

would it be that I can build a set with the different existing elements  and ID's using a SQL construct combined with javascript to reduce the number of SQL requests I have to make to the model db during load?
I'm sorry, I don't understand what you mean  :-[

Geert

peto

  • Guest
Re: Building cross relations using data miner
« Reply #6 on: May 25, 2020, 07:36:39 pm »
Thanks Geert,

would it be that I can build a set with the different existing elements  and ID's using a SQL construct combined with javascript to reduce the number of SQL requests I have to make to the model db during load?
I'm sorry, I don't understand what you mean  :-[

Geert

Sorry Geert,

my point was, instead of making 100 SQL queries into the model I would like to run one query that would compile a complete set with unique entries of element and related ID's. The set would then be used for lookups in the javascript and the ID would be used to create the relation between item being loaded using the Data Miner and existing items within the model.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10527
  • Karma: +358/-31
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Building cross relations using data miner
« Reply #7 on: May 25, 2020, 09:25:31 pm »
Ah, OK, now I get it.

Sure that's a bit how you prefer to work.

Both approaches
- get everything and then loop over it in memory
- process each bit seperately, then move to the next bit.

Have their pro's and cons.

Geert