Author Topic: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?  (Read 11961 times)

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Hi all

I generally use Sparx to capture high-level information and UML class models as part of an enterprise architectural view, and hand off to solution designers/data modellers who use a different tool for datatable/object design and development.

I'm looking now to do all of this this within Sparx (eta: focusing in the first instance upon JSON), keeping a direct line between the logical design and the implementation objects, but i'm not sure if V12 Desktop supports the creation of a schema/object - the schema generator tool appears to be either a later addition or part of a more fully featured licence.

I assume upgrading to V15 professional would give me the appropriate functionality?  I would also appreciate any guidance on whether a project created in V12 would load/be fully usable with V15 before i pay for upgrade (v12 is a bit date,d so should perhaps upgrade anyway).

Apologies if answered elsewhere, I've found quite a few dated threads on this but none quite answered the question.

All advice gratefully received.
« Last Edit: October 04, 2019, 06:37:26 pm by mattie »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #1 on: October 04, 2019, 06:40:50 pm »
I don't much much has change with regards to JSON between v12 and v15.
The schema composer has seen some improvements, and some might be usable to generate JSON schema's but I wouldn't expect major changes.

That being said, it is definitely worth upgrading to v15.
The process is actually pretty painless. Just Install, Next, Next, Next, Finish and you are done.

If you are looking for a clean way to model JSON schema's you might want to look into the add-in I created for that purpose: https://bellekens.com/ea-json/
You can use that in combination with the EA Message Composer add-in to select the message from your common model.

Geert

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #2 on: October 04, 2019, 06:56:59 pm »
Many thanks Geert, much appreciated.

I've had a look at the add-in you've kindly pointed me to, am i correct in saying that I'd need to model out the JSON entities as a separate diagram/model prior to exporting?  Or does the add-in allow me to create JSON straight from UML class?  Having to model separately would not be the end of the world, as at least the logical design and implementation design would be in the same tool, making version control etc easier.

(Apologies if there is an obvious response to my question, I'm afraid I've not used the schema generation aspects before and I certainly can't see how to do this through my version of EA!  I think an upgrade may well be worth investing in)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #3 on: October 04, 2019, 07:00:00 pm »
Yes, you would need a separate model, very similar to the way XSD modelling works.

There is a very basic transformation function in the add-in, but that won't cover things like associations or inheritance; it only adds the appropriate stereotypes.

Geert

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #4 on: October 04, 2019, 07:57:27 pm »
Great, many thanks - I'll give your add-in a try, much appreciated!

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #5 on: October 05, 2019, 12:15:09 am »
Hi Geert - I've created a simple JSON model and, when trying to export the JSON schema, I get the following error:
an error has occurred while attempting to communicate with an Addin:
EA JSON (EAJSON:EAJSONAddin)
"EA_Menuclick Invalid URI: The format of the URI could not be determined"
Please contact the add-in provider for assistance.

would this indicate I've installed the Addin incorrectly or utilised the addin incorrectly?  I created a schema and associated a single element to it (using a simple UML-type assocation), with two attributes added to the element.  I right-clicked on the schema entity and used extension - Ea JSON - Generate JSON schema which kicked up the error.

I appreciate your guide states to use the 'specialisation' menu but I cannot locate this on my version of Sparx (still on 12)

All advice gratefully received

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #6 on: October 05, 2019, 01:23:34 am »
"Specialize" in v15 is "Extensions" in v12

Check the tagged value for you «JSONSchema» element and make sure they are filled with valid values.

If you send me an email ([email protected]) I can send you a working example model.

Geert

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #7 on: October 05, 2019, 01:43:19 am »
Many thanks again Geert - email sent

mattie

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #8 on: October 07, 2019, 09:01:37 pm »
Hi Geert

The add-in seems to be working fine, it was an error on my part with the pathname.

Thanks again for sharing the add-in and for your help in identifying the problem

Regards

Matt

DanielTe

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #9 on: October 25, 2019, 06:39:15 pm »
Hi,
need help. I installed EA JSON from Bellekens and I need to generate JSON files from model. But Im able to generate additional information to the attribute like format, minLength, maxLength, pattern. Everything else was not generated and I need to generate long types and some others (e.g. "existingJavaType": "java.lang.Long" or "existingJavaType": "java.time.OffsetDateTime" or "customDateTimePattern" : "yyyy-MM-dd'T'HH:mm:ssXXX"). How can I set something what allow me to generate what I need? May be list of usable tags will be also helpful.

Thanks a lot

daniel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #10 on: October 25, 2019, 07:13:01 pm »
Daniel,

If you send me an email I'll send you an example model that contains some custom datatypes.

I still have to make a proper example model and publish it to the website.

Geert

DanielTe

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Creating JSON Objects from UML Class diagrams - EA version 12 Desktop?
« Reply #11 on: October 25, 2019, 08:55:46 pm »
Thank you very much, email sent.