From: <ki...@us...> - 2003-04-16 22:24:50
|
Update of /cvsroot/pymerase/htdocs/docs/argouml In directory sc8-pr-cvs1:/tmp/cvs-serv27462 Added Files: argouml.html Log Message: html version of Pymerase Docs - ArgoUML for Pymerase v0.1.4 --- NEW FILE: argouml.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <meta name="GENERATOR" content="TtH 2.92"> <title>Pymerase Docs - ArgoUML for Pymerase</title> <h1 align="center"><font color="#0000FF">Pymerase Docs - ArgoUML for Pymerase</font> </h1> <h3 align="center">Brandon King <br /> Copyright © California Institute of Technology </h3> <h3 align="center">Version 0.1.4<br />Apr 16, 2003 </h3> <p> <h1>Contents </h1><a href="#tth_sEc1" >1 <font color="#0000FF">Introduction</font></a><br /> <a href="#tth_sEc1.1" >1.1 <font color="#0000FF">Note: What this document is missing</font></a><br /> <a href="#tth_sEc1.2" >1.2 <font color="#0000FF">Purpose</font></a><br /> <a href="#tth_sEc1.3" >1.3 <font color="#0000FF">ArgoUML, XMI and Pymerase</font></a><br /> <a href="#tth_sEc1.4" >1.4 <font color="#0000FF">Naming Conventions</font></a><br /> <a href="#tth_sEc2" >2 <font color="#0000FF">Tutorial: Dvd Example</font></a><br /> <a href="#tth_sEc2.1" >2.1 <font color="#0000FF">Introduction</font></a><br /> <a href="#tth_sEc2.2" >2.2 <font color="#0000FF">Step 1 - Getting familiar with ArgoUML</font></a><br /> <a href="#tth_sEc2.3" >2.3 <font color="#0000FF">Step 2 - Create new class</font></a><br /> <a href="#tth_sEc2.4" >2.4 <font color="#0000FF">Step 3 - Change name of namespace</font></a><br /> <a href="#tth_sEc2.5" >2.5 <font color="#0000FF">Step 4 - Change class name</font></a><br /> <a href="#tth_sEc2.6" >2.6 <font color="#0000FF">Step 5 - Create attributes for Dvd class</font></a><br /> <a href="#tth_sEc2.7" >2.7 <font color="#0000FF">Step 6 - Add Studio class and attributes</font></a><br /> <a href="#tth_sEc2.8" >2.8 <font color="#0000FF">Step 7 - Create Association</font></a><br /> <a href="#tth_sEc2.9" >2.9 <font color="#0000FF">Step 8 - Studio Association End</font></a><br /> <a href="#tth_sEc2.10" >2.10 <font color="#0000FF">Step 9 - Dvd Association End</font></a><br /> <a href="#tth_sEc2.11" >2.11 <font color="#0000FF">Step 10 - Save ArgoUML File</font></a><br /> <a href="#tth_sEc3" >3 <font color="#0000FF">Using Pymerase</font></a><br /> <a href="#tth_sEc3.1" >3.1 <font color="#0000FF">What next?</font></a><br /> <p> <h2><a name="tth_sEc1"> 1</a> <font color="#0000FF">Introduction</font></h2> <p> <h3><a name="tth_sEc1.1"> 1.1</a> <font color="#0000FF">Note: What this document is missing</font></h3> This document is a work in progress. We decided to release this document in it's current state because it does contain useful information about how to use ArgoUML with Pymerase. It curretly reads as a tutorial and is lacking some details on what not to do. We hope to add more details in the near future, until then I hope you find this document useful. <p> <h3><a name="tth_sEc1.2"> 1.2</a> <font color="#0000FF">Purpose</font></h3> The purpose of this documentation is to provide the users of Pymerase with enough information so that they can use UML for the design of their schema. This will be accomplished by providing both a description of the information required and a tutorial. <p> <h3><a name="tth_sEc1.3"> 1.3</a> <font color="#0000FF">ArgoUML, XMI and Pymerase</font></h3> Universal Modeling Language (UML) allows you to draw an Object Model which can then be used in the form of XML Metadata Interchange (XMI) by Pymerase to produce many different types of output using it's pluggable input/output module design. The ParseXMI input module of Pymerase reads in the Object Model and populates the Pymerase API with information that output modules require. Here is a list of just some of the output modules that currently exist and a brief discription. <p> <table> <tr><td><b>Output Modules </td><td><b>Description</td></tr> <tr><td>CreateSQL </td><td>SQL Statements for creating database</td></tr> <tr><td>CreateDBAPI </td><td>Python Database API for a given database</td></tr> <tr><td>CreatePyTkWidgets </td><td>Python Tkinter GUI Widgets</td></tr> <tr><td>CreatePyTkDbWidgets </td><td>Python Tk Database GUI Widgets </td></tr></b></b></table> <p> For the tutorial part of this document, we explain how to use ArgoUML to create an Object Model that has the information that Pymerase needs for it's output modules. The example will be a very simple Dvd Collection Database. The second example will demonstrate how to use the inheritance features of Pymerase. <p> Note that Pymerase, in it's current state, does not take advantage of all the features provided by UML. At the same time, UML does not provide all the information you may want to provide to Pymerase. Later, I will go over the features of ArgoUML which are currently used in Pymerase. If you find that UML does not provide all the information, you can use the CreateTableXML output module to create XML files that describes your model. These files can then be read by the parseGenexSchemaXML input module. This will provide you with a way of adding more information to your model. <p> <h3><a name="tth_sEc1.4"> 1.4</a> <font color="#0000FF">Naming Conventions</font></h3> When it comes to programming, naming conventions vary from programmer to programmer and from situation to situation. In the Java world, it's common to haveThisConvention while databases most commonly have_this_convention. This led to the development of Name Manglers in Pymerase. This allows different naming conventions to be converted to others. Here's a list of a least some of the NameManglers available. <p> <table> <tr><td><b>Name Mangler </td><td><b>Description</td></tr> <tr><td>nullMangler </td><td>Does not convert users naming convention</td></tr> <tr><td>CapsWord </td><td>CapitalizesFirstLetterOfEachWord, NoSpaces</td></tr> <tr><td>underscore_word </td><td>all_lower_case, underscore_for_seperation</td></tr> <tr><td>English Word </td><td>Capitalizes first word and uses spaces for seperation</td></tr> <tr><td></td><td></td></tr> <tr><td><b>Avoid </td><td></td></tr> <tr><td>alllowercasenospaces </td><td>This is just a horrible naming convention in general, but it also prevents</td></tr> <tr><td></td><td>the name manglers from converting to other name mangling schemes. </td></tr></b></b></b></table> <p> In some cases you may find you need to generate code to use with code or a database that uses allowercasenospaces convention. If this is the case, it is possible to get Pymerase to do what you want. It's just a little harder. You can accomplish this by using the nullMangler or creating your own mangler. <p> <h2><a name="tth_sEc2"> 2</a> <font color="#0000FF">Tutorial: Dvd Example</font></h2> <h3><a name="tth_sEc2.1"> 2.1</a> <font color="#0000FF">Introduction</font></h3> Before we jump in to the tutorial, let me describe the model we wish to create. The goal is quickly create a Database, Python DBAPI, and GUI for keeping track of Dvds in a collection. To keep it simple all we will just have two classes in our Dvd Database. The first will be a Dvd class which will contain the title of the movie, the year the movie was released, and a link to a single Studio class. The Studio class will contain the name of the studio which produced the movie. We will allow a Studio have 0 to N Dvds, but will only allow a Dvd to have 0 to 1 Studios. <p> Note that this may not be the best design for a Dvd Collection Database, but it does get across the point of how to use Pymerase and it will function. We would love to have more example databases or expansions on existing ones. If you would like to contribute, please visit http://pymerase.sf.net/ and send a message to the mailing list. <p> <h3><a name="tth_sEc2.2"> 2.2</a> <font color="#0000FF">Step 1 - Getting familiar with ArgoUML</font></h3> The first step is to open ArgoUML and learn the basic features we will be using in this example. Figure 1 labels some of the buttons which we will use during the tutorial. <p> <p> <a name="tth_fIg1"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig1-NewArgoUMLFile.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 1: <font color="#0000FF">Getting Familiar with ArgoUML</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.3"> 2.3</a> <font color="#0000FF">Step 2 - Create new class</font></h3> The second step is creating the first class. Press the button in Figure 2 to create a new class. <p> <p> <a name="tth_fIg2"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig2-NewClass.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 2: <font color="#0000FF">Create new class</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.4"> 2.4</a> <font color="#0000FF">Step 3 - Change name of namespace</font></h3> Click on the 'Namespace' entry box that contains the text 'untitledModel' as shown in Figure 3. Then change the name from 'untitledModel' to the name of the DBAPI directory you want to use. In this case you would change the name to 'DvdAPI'. If you don't do this, you may have trouble using the generated DBAPI in the current version of Pymerase (CVS Checkout). <p> The reason behind this, is that we plan to implement packages into pymerase. Packages will allow you to define a particular section of your object model to make it more manageable. Currently, the implementation of Pymerase supports only one package, but that package needs to be named. <p> <p> <a name="tth_fIg3"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig3-ChangeNamespace.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 3: <font color="#0000FF">Change name of namespace</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.5"> 2.5</a> <font color="#0000FF">Step 4 - Change class name</font></h3> Click on the class you created in step one and give the class the name 'Dvd' as shown in Figure 4. <p> <p> <a name="tth_fIg4"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig4-ChangeClassName.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 4: <font color="#0000FF">Change class name</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.6"> 2.6</a> <font color="#0000FF">Step 5 - Create attributes for Dvd class</font></h3> Click on the Dvd class and then press the 'Add Attribute' button shown in Figure 5. For the first attribute, the name should be 'title', and the type should be 'String'. For the second attribute, the name should be 'yearReleased', and the type should be 'int'. Your Dvd class should look similar to the one shown in the figure below. <p> <p> <a name="tth_fIg5"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig5-AddAttributesToClass.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 5: <font color="#0000FF">Create attributes for Dvd class</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.7"> 2.7</a> <font color="#0000FF">Step 6 - Add Studio class and attributes</font></h3> Create a Studio class with a name attribute of type 'String'. It should look similar to Figure 6. <p> <p> <a name="tth_fIg6"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig6-AddStudioClass.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 6: <font color="#0000FF">Add Studio class and attributes</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.8"> 2.8</a> <font color="#0000FF">Step 7 - Create Association</font></h3> Click on the association button shown in the figure below. Then click and hold down the left mouse button on the Dvd class and drag the mouse over the Studio class. Then release the mouse button over the Studio class. If everything went well, it should look like Figure 7. <p> <p> <a name="tth_fIg7"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig7-CreateAssociation.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 7: <font color="#0000FF">Create Association</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.9"> 2.9</a> <font color="#0000FF">Step 8 - Studio Association End</font></h3> Although we have an association, we are not done yet. It is currently set so that a Dvd object can have 1 to 1 Studios and a Studio can have 1 to 1 Dvds. To change this, click on the association. The properties should look similar to the previous figure. Once you've click on the association, you should see two 'Association Ends'. One called 'Dvd[1..1]' and the other 'Studio[1..1]'. Click on 'Studio[1..1]'. In the name entry box, type 'Studio'. This will become the name of the function you will call from a dvd object to get the studio object ( i.e. dvdObj.getStudio() ). Next change the multiplicity from '1..1' to '0..1'. Once you're done, it should look similar to Figure 8. <p> <p> <a name="tth_fIg8"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig8-StudioAssociationEnd.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 8: <font color="#0000FF">Studio Association End</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.10"> 2.10</a> <font color="#0000FF">Step 9 - Dvd Association End</font></h3> Now we need to add similar information to the other end of the association. To do this, click on the association and then click on 'Dvd[1..1]'. Type 'Dvd' into the name entry box and change the multiplicity from '1..1' to '0..*'. Compare your diagram to Figure 9. <p> <p> <a name="tth_fIg9"> </a> <table border="0"><tr><td></td><td><table border="0"><tr><td><img src="images/Fig9-DvdAssociationEnd.jpg"> </td></tr></table><!--vbox--> </td><td> <center>Figure 9: <font color="#0000FF">Dvd Association End</font></center> </td></table><!--hboxt--> <p> <h3><a name="tth_sEc2.11"> 2.11</a> <font color="#0000FF">Step 10 - Save ArgoUML File</font></h3> Save you ArgoUML file as 'dvd_example.zargo'. <p> <h2><a name="tth_sEc3"> 3</a> <font color="#0000FF">Using Pymerase</font></h2> <h3><a name="tth_sEc3.1"> 3.1</a> <font color="#0000FF">What next?</font></h3> I had originally intended to make this document into a tutorial on how to use Pymerase. Then I came up with a better example and turned it into the tutorial. This document is called 'Pymerase Docs - LinkDB Tutorial'. It picks up where we have left of here. What that document doesn't cover is the details on using ArgoUML with Pymerase, so I recommend continuing on that document. <p> If you wish to experiment on your own, I recomend looking at the examples that are included with Pymerase or using the document 'Pymerase Docs - Running Pymerase' as a reference. You are always welcome to e-mail the pymerase-devel mailing list if you need help. <p> <br /><br /><hr /><small>File translated from T<sub><font size="-1">E</font></sub>X by <a href="http://hutchinson.belmont.ma.us/tth/"> T<sub><font size="-1">T</font></sub>H</a>, version 2.92.<br />On 16 Apr 2003, 15:08.</small> </html> |