ERD in Gaphor?

1 view
Skip to first unread message

killsalad

unread,
Feb 27, 2008, 3:49:08 PM2/27/08
to gaphor-dev
Hi!
I was going to write some graphical database design tool in python,
but now i just think about add ERD to gahpor. And i have a question:
where in code is defined how 'class' diagram looks like and behaves,
or maybe some of you, have custom diagram that could serve me as
example?

regards

wro...@pld-linux.org

unread,
Mar 1, 2008, 9:52:41 AM3/1/08
to gaphor-dev
well. my first question is: which ERD? ;)) if i reckon well, if you
buy a database
related book, then you will find different ERD notations introduced by
their
authors.

imho, if you really want to use ERD, then just install dia as it
serves as visio-like
application implementing different graphical notations.

and gaphor is about UML not different notations, which is a lot more
than just
graphical notation of a diagram. for example whole metamodel described
in UML
specification, which does not exist for ERD.

as i understand you want ERD for database tables and associations
between them.
that actually can be realized with UML. imho, it is matter of
appropriate profile,
defined stereotypes and notation guideliness (i.e. naming of
associations). also
icons for stereotypes and artifacts could be prepared to make nicer
visualization
of database related UML diagram items.

then, there are several benefits from that:
- we omit effort of ERD maintainance and introduction of another
notation
(imho, there should be one to rule them all, that is UML)
- any code generation gaphor's plugin can generate classes from UML
diagrams,
also those, which are created with some database profile in mind
(see previous
paragraph)
- for SQL schema generation... just create plugin for gaphor which
operates on UML
metamodel

UML can be used for database related diagrams. i do not think we need
to introduce ERD
here. with gaphor
- you can define database UML profile, i.e. stereotypes for every UML
element
(classes, associations, whatever), i.e. "relation" stereotype for a
classes, which are
mapped to SQL table
- associations can have name and direction
- there are artifacts and nodes if you need more deployment-like stuff
- you can create SQL schema generation plugin very easily as there is
nice plugin infrastructure

for sure gaphor is missing few bits
- user defined icons for artifacts and stereotypes (i.e. class items
with stereotype "relation"
could be decorated with some appropriate icon - such behaviour is
even defined
in UML specification)
- loading/saving of profiles; now, you have to define UML profile in
every gaphor file
you have, that has to be improved <- that's the big thing, which i
miss in gapor now :)))
- some nice wiki page about database notation guideliness

i hope that you do not feel discouraged. and if you feel that you can
switch yourself
from ERD to UML and want to contribute missing bits into gaphor
project... then you
are more than welcome. :))

if you need bit more explanation about above, then do not hesistate to
ask questions,
please.

best regards,

wrobell <wro...@pld-linux.org>

killsalad

unread,
Mar 1, 2008, 6:59:41 PM3/1/08
to gaphor-dev
I've been using Dia so far, but tool that that's generates SQL from
diagrams doesn't support few things ( for example AUTO INCREMENT -
mysql , serial - PGSQL ). I also wanted to write a visual tool for
SqlAlchemy and so far gaphor is the best candidate for operation but
it lacks of documentation and code examples - and so i'm here
negotiating some :)

In question of ERD - for me it doen't matter, UML is ok. Just need to
know how generate some YAML form class object ;)
best regards
> wrobell <wrob...@pld-linux.org>

wrobell

unread,
Mar 1, 2008, 8:15:29 PM3/1/08
to gapho...@googlegroups.com
On Sat, Mar 01, 2008 at 03:59:41PM -0800, killsalad wrote:
>
> I've been using Dia so far, but tool that that's generates SQL from
> diagrams doesn't support few things ( for example AUTO INCREMENT -
> mysql , serial - PGSQL ). I also wanted to write a visual tool for
> SqlAlchemy and so far gaphor is the best candidate for operation but
> it lacks of documentation and code examples - and so i'm here
> negotiating some :)
>
> In question of ERD - for me it doen't matter, UML is ok. Just need to
> know how generate some YAML form class object ;)

take a look at check_classes function (line 30 to be exact) in

http://gaphor.devjavu.com/browser/gaphor/trunk/gaphor/plugins/checkmetamodel/checkmodel.py

this is how you query your diagram for Class UML metamodel instances.

UML.Class is described in UML specification, section 7.3.7, page 49.
take a look also at page 32, diagram 7.12.

http://www.omg.org/spec/UML/2.1.2/Superstructure/PDF/

for example
- Class.onwedAttribute is a list of class attributes
- Class.ownedOperation is a list of class methods

regards,

wrobell <wro...@pld-linux.org>

arjan

unread,
Mar 3, 2008, 4:44:25 AM3/3/08
to gaphor-dev
I've added a ticket (http://gaphor.devjavu.com/ticket/105) for the
user defined icons thing.

A ticket for reuse of profiles already exists: http://gaphor.devjavu.com/ticket/49.

Are there any particular questions you have about code examples? We
have a page dedicated to writing a plugin (http://gaphor.devjavu.com/
wiki/Tech/ServiceOriented).

The Tech secion (http://gaphor.devjavu.com/wiki/Tech) contains some
more docs.

:) Just ask and we'll write.

Regards,

Arjan

wrobell

unread,
Mar 18, 2008, 4:29:39 PM3/18/08
to gapho...@googlegroups.com
On Sat, Mar 01, 2008 at 03:59:41PM -0800, killsalad wrote:
>
> I've been using Dia so far, but tool that that's generates SQL from
> diagrams doesn't support few things ( for example AUTO INCREMENT -
> mysql , serial - PGSQL ). I also wanted to write a visual tool for
> SqlAlchemy and so far gaphor is the best candidate for operation but
> it lacks of documentation and code examples - and so i'm here
> negotiating some :)

so... here we go :)

http://gaphor.devjavu.com/browser/gaphor/trunk/examples/list_classes.py

above example simply lists classes from uml model created with gaphor.

you can use such example as a starting point for tool/script/whatever
exporting UML models into i.e. database scripts.

please note, that you need svn trunk version of gaphor to run above script
as few related bugs were killed recently to make it possible to run.

[...]

regards,

wrobell <wro...@pld-linux.org>

Reply all
Reply to author
Forward
0 new messages