Author Topic: VB Scripting  (Read 1357 times)

consalvol

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
VB Scripting
« on: September 15, 2023, 03:45:55 am »
Hi I am new to EA and scripting in general.  I am trying to take a UML Class diagram and export its contents to an OWL/RDF format.  EA does not have native functionality to convert Class diagram to OWL format.  I am trying to write a VB Script to do this and am finding the documentation very confusing.  Ive viewed a general 30 minute tutorial by Geert Bellekens which gave me a starting point.  I've create a script in the Diagram Group (not sure this is the correct place) seemed to be the most logical place and based off of Geert's tutorial i was able to identify the classes(elements) selected for a current diagram -- element class documentation specifies that you use the attribute class to retrieve the attributes for the specified class/element but does not show an example on how to call this class.  Sorry if im messing up the terminology used within sparx --- we are using sparx as a modeling tool because we do not have the funds to purchase a license for a tool such as Erwi, so terminology is strictly around traditional ERD nomenclature -- our class model is truly an ERD represented in UML - but now we have a need - URGENT - to extract the diagram and there are many - we created packages to represent different subject areas (account, client, product, loan, etc) within each package/subject area there can be 1 or more diagrams.  There is no link/dependency between packages.  We need to extract the diagram contents (class, attributes, associations between classes and cardinality into an OWL/RDF format so another system can ingest it.

I know i have to utilize the EA API and Repository but really not sure how to read the variables i need to help produce the desired output.

we are under a tight deadline and there is nobody on our team that has used sparx before or has strong VB scripting knowledge truly a logical data modeling team.   Any advise on how to proceed would be greatly appreciated.

Thanks,
Louie

qwerty

  • EA Guru
  • *****
  • Posts: 13570
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: VB Scripting
« Reply #1 on: September 15, 2023, 05:18:08 am »
You might have a look into my scripting book. Likely an easier read than Sparx' online help.

q.

consalvol

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: VB Scripting
« Reply #2 on: September 15, 2023, 05:51:40 am »
Thanks ill take a look -- table of contents shows chapters detailing the object model and the EAobjects (EAdiagram, EAconnecter etc) i see a chapter on creating new objects but will i get a sense on how to traverse a diagram - read all objects within that diagram (classes, attributes associated, tagvalues and the relationships between the classes).  the sparx documentation is very hard to follow - and one class needs to call another class - you call the attribute class from the element class but never shows how to do this and i think the value returned is an array, would need to parse the array.   not expecting the book to show me how to code but i am expecting a good understanding on how to call the objects i need and what to expect as a return value.

Thanks,
Louie

qwerty

  • EA Guru
  • *****
  • Posts: 13570
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: VB Scripting
« Reply #3 on: September 15, 2023, 06:23:54 am »
You should find all the basics. If you get stuck somewhere you can ask here if it's a common question or mail me if it's something specific you did not understand. I'd recommend to take a day just getting familiar with the API. Once you are familiar with that (it's actually not too difficult once you got these basics) you might as well be interested in my Inside book. It became sort of a vade mecum for many EA coders.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VB Scripting
« Reply #4 on: September 15, 2023, 02:26:06 pm »
You might want to look at examples.

There are a few example in your local scripts, and a lot more in my github repo: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library

Geert

consalvol

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: VB Scripting
« Reply #5 on: September 21, 2023, 12:56:58 am »
Thanks Geert,

Yes i found 2 scripts on the local scripts folder that i used to cut and past into my own script.  I was able to iterate through all diagrams in a model and identify concepts/attributes/relationships.  I guess now at this point i need to learn how to capture these attributes into defined variables and write them out to an Owl format file.