Simple ER Diagram Example
In order to run this you would need to have Graphviz's Neato installed on the web server... though once that's done, this is the sum total of the code you need to use the TestDatasource and produce a full ER diagram like that shown below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>P-dd: A simple example outputting the default DOT generated diagram using the TestDatasource</title>
</head>
<body>
<?php
require_once( 'include_package.php' );
include_package( 'Datasources' );
include_package( 'DatabaseModel' );
include_package( 'Renderers', true );
$oFactory = new DatabaseFactory( new TestDatasource() );
$oDatabase = $oFactory->ConstructDatabase();
$oImageGenerator = new DotImageGenerator( DotDatabaseRenderer::Render( new DotRendererConfiguration(), $oDatabase ) );
$oImageGenerator->GenerateImageFile( 'Gif', 'ExampleImage.gif' );
echo( HtmlTag::Image( 'ExampleImage.gif', 'Dot generated diagram (using NEATO)') );
?>
</body>
</html>
Technorati Tags: software, development, database, diagram, dot, dotty, neato, er, open+source, Oracle, Postgres, MySql, Robert+Baillie, documentation
Labels: examples
2 Comments:
At 6:31 PM, Unknown said…
Hi,
A tool called LatticeFramework Studio can generate the ER diagram from Oracle, MySQL and SQL Server using GraphViz. It will generate the GraphViz dot file connected to your database, adn then generate the ER diagram using GraphViz dot.exe. LatticeFramework Studio also has a dot file editor to make it easier to edit the generated dot file.
Here is sample ER diagram generated from Oracle HR schema:
http://www.latticesoft.com/downloads/HR.pdf
Here is the screencast how to use it:
http://www.latticesoft.com/product/video/GenerateERDiagram.htm
At 7:13 AM, Unknown said…
Thanks! I have also found some great ER Diagram Examples using Lucidchart and their site is very helpful and easy to use! Give it a try!
Post a Comment
<< Home