From: <ki...@us...> - 2003-03-12 06:53:20
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv14076 Modified Files: linkdb-tutorial.tex Log Message: updated with Tutorial: Prepare Driver Scripts section Index: linkdb-tutorial.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/linkDB-tutorial/linkdb-tutorial.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** linkdb-tutorial.tex 8 Mar 2003 01:52:28 -0000 1.2 --- linkdb-tutorial.tex 12 Mar 2003 06:53:17 -0000 1.3 *************** *** 31,35 **** \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.2\\\today} \maketitle \thispagestyle{empty} --- 31,35 ---- \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.3\\\today} \maketitle \thispagestyle{empty} *************** *** 95,98 **** --- 95,102 ---- \end{itemize} + \subsection{\cb Optional Example Files} + All the files created in this tutorial can be found in the linkDB + example provided with pymerase. + \section{\cb Getting Help} \subsection{\cb Pymerase Web Site} *************** *** 101,105 **** need, if it's available, will be in the Docs section of the web site. ! \subsection{\cb Pymerase-devel Mailing List} Pymerase developers and users are using pymerase-devel at lists.sourceforge.net as a means of communication. If you need --- 105,109 ---- need, if it's available, will be in the Docs section of the web site. ! \subsection{\cb Pymerase-devel Mailing List}\label{pymdevel} Pymerase developers and users are using pymerase-devel at lists.sourceforge.net as a means of communication. If you need *************** *** 163,176 **** \caption{\cb LinkDB Schema in ArgoUML} \end{figure} ! Make sure you change the namespace property to 'LinkAPI' by clicking ! on the 'Group' class and then on the name space textbox. Then should ! be able to change the name. This is information that CreateDBAPI will ! use as the package name of your generated DBAPI. Note that if you change the names of the classes or attributes in this tutorial, you will have to do so throughout the whole tutorial. ! Create a director in you will work on this tutorial and save your ! ArgoUML file as linkDB.zargo. \end{document} --- 167,310 ---- \caption{\cb LinkDB Schema in ArgoUML} \end{figure} ! Make sure you change the namespace property to ! \textcolor{blue}{'LinkAPI'} by clicking on the 'Group' class and then ! on the name space textbox. Then should be able to change the ! name. This is information that \textcolor{blue}{CreateDBAPI} will use ! as the package name of your generated DBAPI. Note that if you change the names of the classes or attributes in this tutorial, you will have to do so throughout the whole tutorial. ! Create a directory in which you will work on this tutorial and save your ! ArgoUML file as \textcolor{blue}{linkDB.zargo}. ! ! \section{\cb Tutorial: Prepare Driver Scripts} ! ! \subsection{\cb Extract XMI File}\label{xmi} ! Pymerase cannot read the .zargo files created by ArgoUML, but it can ! read the .xmi files stored within the .zargo files. To extract the ! files, run the command below. ! ! \textcolor{blue}{unzip linkDB.zargo linkDB\_.xmi} ! ! If that command fails, try this command: ! ! \textcolor{blue}{unzip linkDB.zargo} ! ! You should find a .xmi file in your directory. This is the file which ! you are going to point pymerase to in a variable called 'schema' in ! the driver program in section \ref{template}. ! ! This is the reason why the input module for UML is called ! \textcolor{blue}{parseXMI} and not parseUML. ! ! ! \subsection{\cb Driver Program Template}\label{template} ! If you look at the documentation ''Pymerase Docs - Running Pymerase'', ! you will notice that there are three ways of running ! pymerase. Unfortunately, Pymerase, in it's current state only has one ! method of running pymerase using Jython. If for some reason you do ! not want to use jython or you want to use one of the other method for ! running pymerase, you use the table.dtd XML\footnote{If no ! documentation exist on the table.dtd XML format, please e-mail the ! mailing list mentioned in section \ref{pymdevel}.} ! (parseGenexSchemaXML input module) format to define your schema. ! ! Below you will find the Driver Program Template from ''Pymerase Docs - ! Running Pymerase'' ! ! %\pagebreak ! % BEGIN SNIP FROM 'PYMERASE DOCS - RUNNING PYMERASE' ! ------------Driver Program Template-----------\\ ! \color{red} ! \#!/usr/bin/env python ! ! \color{black} ! import sys\\ ! import os ! ! import pymerase ! ! \begin{tabbing} ! \color{red} ! \#In\=\color{red}put module to use (parseGenexSchemaXML.py would be\\ ! \color{red} ! \# \> \color{red} pymerase.input.parseGenexSchemaXML)\\ ! \color{black} ! import pymerase.input.\em nameOfInputModule \\ ! \\ ! \color{red} ! \#Output module to use (CreateDBAPI.py would\\ ! \color{red}\# \> \color{red} be pymerase.output.CreateDBAPI)\\ ! \color{black} ! import pymerase.output.\em nameOfOutputModule \\ ! \\ ! if \_\_name\_\_ == '\_\_main\_\_':\\ ! \> \color{red} \#Path to schema\\ ! \color{black} ! \>schema = os.path.abspath('../path2schema/schema') \\ ! \\ ! \> \color{red} \#Output Path\\ ! \color{black} ! \>outputPath = os.path.abspath('./outputPath')\\ ! \\ ! ! \> \color{red} \#Run pymerase\\ ! \color{black} ! \>pymerase.run(\=schema,\\ ! \> \>pymerase.input.\em nameOfInputModule,\\ ! \> \>outputPath,\\ ! \> \>pymerase.output.\em nameOfOutputModule) ! \end{tabbing} ! --------End Driver Program Template--------- ! % END SNIP FROM 'PYMERASE DOCS - RUNNING PYMERASE' ! ! For this tutorial, all driver programs will be using ! '.../path2schema/linkdb.xmi' for the schema variable and ! 'pymerase.input.parseXMI' for the input module. ! ! ! \subsection{\cb Create SQL for Database}\label{sql} ! The \textcolor{blue}{CreateSQL} output module is used to generate the ! SQL statements you need to create your database in PostgreSQL. ! ! Create a file in your tutorial directory called 'createsql.py' and ! paste in the template from section \ref{template}. Make sure you've ! changed the schema path to the .xmi file we extracted in section ! \ref{xmi} and that you replace 'nameOfInputModule' to 'parseXMI'. ! ! In addition to the changes above you have to make for all Driver ! Programs we will create, you need to change 'nameOfOutputModule' to ! 'CreateSQL' and the './outputPath' to './linkDB.sql'. ! ! Once you generate your linkDB.sql file later in the tutorial, it ! should look like the following: ! ! \begin{verbatim} ! CREATE SEQUENCE "group_pk_seq" start 1 increment 1 ! maxvalue 2147483647 minvalue 1 cache 1; ! ! CREATE TABLE "group" ( ! "group_pk" integer DEFAULT nextval('"group_pk_seq"'::text) ! PRIMARY KEY, ! "name" varchar(128) ! ) ; ! ! CREATE SEQUENCE "name_link_pair_pk_seq" start 1 increment 1 ! maxvalue 2147483647 minvalue 1 cache 1; ! ! CREATE TABLE "name_link_pair" ( ! "name_link_pair_pk" integer DEFAULT ! nextval('"name_link_pair_pk_seq"'::text) PRIMARY KEY, ! "name" varchar(128), ! "url" varchar(128), ! "group_fk" integer ! ) ; ! \end{verbatim} ! ! \subsection{\cb Create Database API} ! The \textcolor{blue}{CreateDBAPI} output module is used to generate a ! Python Database API to the database you will generate from the SQL in ! section \ref{sql}. \end{document} |