TOPIC: ERdiagram v1.0
#592
ERdiagram v1.0 3 Years, 7 Months ago
Hi, I have written an E-R classic diagram generator for your Suneido tables. It uses the great GraphViz opensource package (www.graphviz.org) that you have to install before use my ERdiagram function.
The tables from which you want to generate a diagram have to be in a special table named 'application_tables'. More details in the source code.

Here some axamples.

Let's suppose we have two tables created as:

create employee (employee_id, name, fname, city_id, age, salary) key(employee_id) index(city_id) in city

create city (city_id, city_name) key(city_id)


Then, after you have inserted these new tables in application_tables, "ERdiagram()" will generate:



As another example, "ERdiagram(attributes: true, relationshipDetails: true)" will generate:



There are many other options to try... Instructions are in the source code.

P.S.: the code is very ugly. I had not much time to optimize it. I hope you enjoy it!
File Attachment:
File Name: ERdiagram.txt
File Size: 14100


Post edited by: Mauro, at: 2007/01/25 18:53
 
 
Mauro
 
#593
Re:ERdiagram v1.0 3 Years, 7 Months ago
The results look good! Thanks!
 
 
andrew
 
#598
ERdiagram v1.1 3 Years, 6 Months ago
Hi, I have updated ERdiagram code. Now you don't have to define rules and tables anymore. It's very simple: import the function in your library and then call it.
To do the trick, the code creates a view with all the tables except system tables, book tables and lib tables. I don't know if I have missed some system table created after certain events occur.

I have added a new param to choice between two GraphViz heuristics to resolve overlapping drawing problems (but you can also allow overlapping of entities and attributes).

NOTE: ERdiagram shows key attributes with a bold ellipse. But there is a flaw: for now ERdiagram doesn't manage multiple field keys. Simply it handles them as they was normal attributes.

File Attachment:
File Name: ERdiagram_1_1.txt
File Size: 7838
 
 
Mauro
 
#600
Re:ERdiagram v1.1 3 Years, 6 Months ago
Nice idea with the view - I did not think of that.

Instead of the regular expressions for books and libraries you could use LibraryTables and BookTables and build the view definition dynamically. e.g. something like:

Code:

for table in LibraryTables()
     view $= "tablename isnt " $ Display(table) $ " andn"

 
 
andrew
 
#601
Re:ERdiagram v1.1 3 Years, 6 Months ago
A very good suggestion Andrew, thanks! ;)

I tried ERdiagram on Axion accounting app and it gives me some errors because there are some fields in your app that have a '?' as final char in their name.
I think GraphViz parser doesn't allow '?' in identifiers (inside the '.dot' schema file).
Maybe I should check for '?' chars and substitute them with another char.
 
 
Mauro