Forum OpenACS Development: OpenACS Data Model

Collapse
Posted by David Kuczek on
I wanted to better understand the OpenACS data model, so I was browsing through documentation and the sql create files. Here is a first version of the OpenACS data model (5.1 + categories)... Please comment if anything is mistaken or if you would like to add any important elements to it.

https://openacs.org/storage/view/openacs%5C/Data_Model_OpenACS.htm

Collapse
2: Re: OpenACS Data Model (response to 1)
Posted by Malte Sussdorff on
This is interesting. Especially it shows how few unique primary keys we have (that do not reference to something else). It would be nice to have the references displayed as arrows, but it would break the view ...
Collapse
3: Re: OpenACS Data Model (response to 1)
Posted by Nima Mazloumi on
David, thank you very much.

There is actually a programm for postgres that does that automatically. It creates an ER diagram from the database schema:

http://www.rbt.ca/autodoc/

Autodoc can export to html, docbook, dia and vizgraph (supports ps, gif, jpeg, vrml, png.......).

You can see a complete database of my OpenACS/dotLRN 2.0.3 installation here:

HTML: http://dotlrn.uni-mannheim.de/doc/schema/unima1.html
JPEG: http://dotlrn.uni-mannheim.de/doc/schema/unima1.jpg
PNG: http://dotlrn.uni-mannheim.de/doc/schema/unima1.png
GNU-DIA: http://dotlrn.uni-mannheim.de/doc/schema/unima1.dia
GRAPHIZ:http://dotlrn.uni-mannheim.de/doc/schema/unima1.dot
XML:http://dotlrn.uni-mannheim.de/doc/schema/unima1.xml
VRML:http://dotlrn.uni-mannheim.de/doc/schema/vrml/unima1.vrml

We could extend somehow the documentation package to autocreate the database model for all installed packages.

I have no idea if there is anything similar for Oracle. But I bet there is.

Greetings,
Nima

Collapse
4: Re: OpenACS Data Model (response to 1)
Posted by Malte Sussdorff on
Hi Nima, this sounds awesome, could you publish the documentation to a publicly accessible page, I'm curious
Collapse
5: Re: OpenACS Data Model (response to 4)
Posted by Joel Aufrecht on
I played with autodoc last week but couldn't get it to process OpenACS databases without an error - glad to see it was something specific to my system.  Nima, can you build one of those for a plain Core install and put the png in acs-core-docs/www/images so I can link to it (go ahead and put in a high-res version and I'll make thumbnails etc) in the docs?
Collapse
6: Re: OpenACS Data Model (response to 1)
Posted by Nima Mazloumi on

Joel/Malte here the part for the documentation if you like to add that:

How to create a documentation for the OpenACS Data Model

  • Download PostgreSQL Autodoc
    wget http://www.rbt.ca/autodoc/binaries/postgresql_autodoc-1.22.tar.gz
    
  • Unpack autodoc
    gzip -d postgresql_autodoc-1.22.tar.gz 
    tar xsf postgresql_autodoc-1.22.tar 
    
  • Install missing perl modules with cpan. Configure tells you what modules are missing. Installing a module is very easy as you can see from the following two examples. Run configure first to see if and what module is missing.
    ./configure
    perl -MCPAN -e 'install DBD::Pg'
    perl -MCPAN -e 'install HTML::Template'
    
  • Install autodoc ./configure make make install
  • Open postgresql_autodoc in emacs to configure your database setting. You have to either set some postgres environment variables or do the following changes. I use service0 database, user service0, no database password and localhost as host.

    Changes from line 65 ff

    # Setup the default connection variables based on the environment
    # my $dbuser = $ENV{'PGUSER'};
    # $dbuser ||= $ENV{'USER'};
    my $dbuser = 'service0';
    
    # my $database = $ENV{'PGDATABASE'};
    # $database ||= $dbuser;
    my $database = 'service0';
    
    # my $dbhost = $ENV{'PGHOST'};
    # $dbhost ||= "";
    my $dbhost = 'localhost';
    

    Changes from line 191 ff

    # Database Connection
    my $dsn = "dbi:Pg:dbname=$database";
    # $dsn .= ";host=$dbhost" if ( "$dbhost" ne "" );
    # $dsn .= ";port=$dbport" if ( "$dbport" ne "" );
    # my $dbh = DBI->connect( $dsn, $dbuser, $dbpass );
    my $dbh = DBI->connect( $dsn, $dbuser);
    
  • Export the data model
    ./postgresql_autodoc
    This results in the following files:
    service0.xml		for docbook
    service0.html		for browser
    service0.dot		for vizgraph --> Exports to png, jpg, gif, ps, vrml,.....
    service0.dia		for dia
    unima1.zigzag.dia	for dia
    
Collapse
7: Re: OpenACS Data Model (response to 1)
Posted by Nima Mazloumi on
Joel, I can create a png for OpenACS. Just let me know for which version. I am not very good on cvs so either I can create one for the latest tarball or please send me the cvs commands I need to get wanted version of OpenACS you want the graphic for.
Collapse
8: Re: OpenACS Data Model (response to 1)
Posted by David Kuczek on
Hey Nima,

well... too bad for me 😉

It would be great to have a newly generated model of oacs 5.1.0 at a publicly accessible location (I have to log into your university system to see the models that you posted)...

Cheers