Generate class model from uml class diagram

597 views
Skip to first unread message

Jimmy Aumard

unread,
May 15, 2014, 7:21:34 AM5/15/14
to joi...@googlegroups.com
Hi,

I'm working on a little model generator for the UML class diagram. Class will be generate for Java, Android, PHP, Objective C.
Anyone is interesting by this ? I can share my code when it's done if someone want to use it (or integrate it on joinJS why not ^^).

This is how i plan to do it : 

  • Create a class who take a joint.dia.Graph 
  • get json code from graph object
  • create source code for each langage for each UML object
There some things I don't know how : 

  • Get link from a UML class to know if it's an extend or implementation. 
  • if anyone have tips to find best way to generate source for a given langage (for now i will create source code buy building string from json object)

Any help will be appreciate.

PS : i just test your rappid demo http://jointjs.com/rappid and it's great but for UML link between class, abstract and implemantation can't be simple link. it would be great to have joint.shapes.uml.Implementation or joint.shapes.uml.Generalization...

Sorry for my English, I'm French.

Regards
Jim 

David Durman

unread,
May 15, 2014, 7:40:24 AM5/15/14
to joi...@googlegroups.com
Hi Jimmy,

That sounds like an interesting project. I'd be happy to see that. Actually, the joint.shapes.uml plugin contains the links you're asking for: joint.shapes.uml.Generalization, joint.shapes.uml.Implementation, joint.shapes.uml.Aggregation, joint.shapes.uml.Composition and joint.shapes.uml.Association are all links. For example:

var myGeneralizationLink = new joint.shapes.uml.Generalization({
    source: { myClassA.id },
    target: { myClassB.id }
})
graph.addCell(myGeneralizationLink)

All those links have the 'type' property that tells you what type of link it is.

Note that the Rappid demo application is just a demo, it is not meant to be a final product or so, nor it is specific to UML, it is just showing how our commercial Rappid plugin can be put together to create various diagramming applications.

We're working on documenting all the shape plugins now to make it clear what shapes they contain and how they can be used. For the time being, please look at the source code to these plugins, they should be quite readable and should tell you what shapes there are.

---

David Durman
client IO


--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jimmy Aumard

unread,
May 15, 2014, 9:24:19 AM5/15/14
to joi...@googlegroups.com
Hi David,

Thanks for pointing me on the right direction :) this classes seems good to me but i didn't see cardinalities for them. 
Did you implement cardinalities on this classes ? Cause it will cause changement on code generation (simple object or array).

If not can you put me on right direction do add cardinalities ? 

Thanks a lot !

David Durman

unread,
May 15, 2014, 10:10:54 AM5/15/14
to joi...@googlegroups.com
Cardinalities can be displayed via link labels. Every link in JointJS can have an arbitrary number of labels each having a different position and properties. For example, a one-to-many cardinality can be expressed as:

var myGeneralizationLink = new joint.shapes.uml.Generalization({
    source: { myClassA.id },
    target: { myClassB.id },
    labels: [
        { position: .1, attrs: { text: { text: '1' } } },
        { position: .9, attrs: { text: { text: '1..*' } } }
    ]
})

For more info on labels, please see the API reference: http://jointjs.com/api#joint.dia.Link:label





---

David Durman
client IO


Jimmy Aumard

unread,
May 15, 2014, 10:17:01 AM5/15/14
to joi...@googlegroups.com
Thanks a lot ! I just see this by searching mother class under source code ! 
It's perfect with this. 

Jimmy Aumard

unread,
May 15, 2014, 6:28:49 PM5/15/14
to joi...@googlegroups.com
Just one question about UML on jointJS. The diamond position of composition and aggregation isn't wrong ?  Diamond have to be show on source not on target. 
Base on your demo http://jointjs.com/demos/umlcd white diamond of adress have to be draw to person class. same for bloodgroup.

I'm right ? 

If yes I know i can switch source and target on my code but it's not correct. I look on UML website (like http://www.cs.sjsu.edu/~drobot/cs146/UMLDiagrams.htm) and i think i'm right. 

Sorry if I'm saying some mistake. My UML knowledge is limited.   

Jimmy Aumard

unread,
May 16, 2014, 3:23:08 PM5/16/14
to joi...@googlegroups.com
Hi Dave,

Did you have an email address who can contact you ? I have almost finish java generation from UML model. I want to send you source for testing before continu with other langages.

Regards
Jim

David Durman

unread,
May 16, 2014, 3:29:29 PM5/16/14
to joi...@googlegroups.com
Awesome! Send it to david...@gmail.com, will test.

Sent from my iPhone

Jimmy Aumard

unread,
May 23, 2014, 4:15:12 PM5/23/14
to joi...@googlegroups.com
For anyone who want to test this UML diagram generator, it can be test online at : http://jaumard.com/uml/index.html

Let me know bugs / improved.

Regards
Jim

David Durman

unread,
May 26, 2014, 12:50:26 PM5/26/14
to joi...@googlegroups.com
Looks great! Would be nice to generate JavaScript as well ;-)

---

David Durman
client IO


--

Jimmy Aumard

unread,
May 26, 2014, 1:21:41 PM5/26/14
to joi...@googlegroups.com
Hi,

I have make some modifications :
  • Save diagram on html5 storage (now we can refresh and diagram is restored)
  • Compatibility with chrome, FF, safari (can't test IE i'm on mac)
Can you send me some javascript classes ? Cause normally JS doesn't have classes... I don't know how make javascript classes (good way do to it ^^)

Thanks.
Regards
Jim

26 mai 2014 18:50
Looks great! Would be nice to generate JavaScript as well ;-)

---

David Durman
client IO



--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
23 mai 2014 22:15
For anyone who want to test this UML diagram generator, it can be test online at : http://jaumard.com/uml/index.html

Let me know bugs / improved.

Regards
Jim
--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
15 mai 2014 13:21
Regards
Jim 

Jimmy Aumard

unread,
Jun 8, 2014, 5:51:32 AM6/8/14
to joi...@googlegroups.com
I just put an update to add the new Apple langage : Swift. I guess my UML editor is the first one who generate swift class model ^^


On Thursday, May 15, 2014 1:21:34 PM UTC+2, Jimmy Aumard wrote:

David Durman

unread,
Jun 11, 2014, 3:47:43 AM6/11/14
to joi...@googlegroups.com
Good stuff! Just tweeted about it.

---

David Durman
client IO


--

Denis Costa

unread,
Aug 18, 2015, 9:54:12 AM8/18/15
to JointJS, jimmy....@gmail.com


On Friday, May 23, 2014 at 5:15:12 PM UTC-3, Jimmy Aumard wrote:
For anyone who want to test this UML diagram generator, it can be test online at : http://jaumard.com/uml/index.html

I'm sorry for replying something so old, but I have a few questions.

I'm not sure, but it seems you didn't use Rappid on this app, is this right?
Does this app has a license? If yes, which license?
 

sirine mili

unread,
Feb 24, 2019, 12:45:20 PM2/24/19
to JointJS
Hi, I am working on a similar project but with entities not classes, and I don't know if jointjs can generate entities instead of classes , because if I just eliminate the methods from the class structure it doesn't work for me.
Any help?
Thanks
Reply all
Reply to author
Forward
0 new messages