Changeset 8084


Ignore:
Timestamp:
02/02/12 10:15:47 (8 years ago)
Author:
mnagni
Message:

Correctly generates DB tables for CEDAEditor

in sqlTables.sql

1) No more "metadata = MetaData?()"
2) no more "metadata.create_all(engine)"

Just a couple of stupid thigs has still to be fixed by hand:
3) Column('refDirection', ARRAY, nullable=True) ----> Column('refDirection', ARRAY(TEXT), nullable=True)
4) Column('role', CI_RoleCode.db_type(), nullable=False) ----> Column('role', CI_RoleCode.db_type())

Location:
mauRepo/xmi2sqlalchemy/trunk/src
Files:
1 added
20 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/UmlToRDBM.java

    r8064 r8084  
    146146                Map<ClassModel, Set<ClassModel>> classUsers = new HashMap<ClassModel, Set<ClassModel>>(); 
    147147                for (ClassModel cm : cms) { 
     148                        if (cm.isUnion()) { 
     149                                continue; 
     150                        } 
    148151                        Iterator<AttributeModel> iterAttr = cm.getAttributeModel().iterator(); 
    149152                        Set<SuperAttribute> sas = new HashSet<SuperAttribute>(); 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/collect/AttributeModel.java

    r8064 r8084  
    100100        } 
    101101         
     102        public boolean isNullable() { 
     103                return this.getLowerBound().equals("0") || this.isVoidable(); 
     104        } 
     105         
    102106        /** 
    103107         * @return the voidable 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/collect/ClassModel.java

    r8040 r8084  
    3838 
    3939import ndg.services.newmoon.velocity.python.support.ExportModel; 
    40 import ndg.services.newmoon.velocity.python.support.ImportCollector; 
    4140import ndg.services.newmoon.velocity.python.support.SimpleKeyValue; 
    4241import ndg.services.newmoon.xmiModel.UMLClass; 
     
    4645 * 
    4746 */ 
    48 public class ClassModel implements ExportModel { 
     47public class ClassModel implements ExportModel, Comparable<ClassModel> { 
    4948        public enum STEREOTYPE { 
    5049                Enumeration, CodeList, Union, DataType, Boolean, None, Metaclass, Type; 
     
    155154        public String toString() { 
    156155                return "ClassModel [associatedClass=" + associatedClass + "]"; 
     156        } 
     157 
     158        /** 
     159         * Compares two {@link ClassModel}s. 
     160         * @param other the <code>ClassModel<code> to compare 
     161         * @return 1 if this ClassModel has already <code>other</code> among 
     162         * its parents otherwise -1  
     163         */ 
     164        @Override 
     165        public int compareTo(ClassModel other) { 
     166                Set<ClassModel> cms = getAllParents(this, null); 
     167                return cms.contains(other) ? -1 : 1; 
    157168        }                        
    158169         
    159          
     170        private Set<ClassModel> getAllParents(ClassModel cm, Set<ClassModel> cms) { 
     171                if (cms == null) { 
     172                        cms = new HashSet<ClassModel>(); 
     173                }                
     174                for (ClassModel parent : cm.getParents()) { 
     175                        cms.add(parent); 
     176                        getAllParents(parent, cms); 
     177                } 
     178                return cms; 
     179        } 
    160180} 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/GenerateTables.java

    r8064 r8084  
    4141import java.util.Set; 
    4242 
     43import ndg.services.newmoon.MaxDepthException; 
     44import ndg.services.newmoon.NewmoonException; 
    4345import ndg.services.newmoon.UMLElementsArchive; 
    4446import ndg.services.newmoon.collect.AttributeModel; 
     
    5355 
    5456import org.apache.commons.collections.CollectionUtils; 
     57import org.apache.commons.collections.SetUtils; 
    5558import org.apache.commons.lang.text.StrBuilder; 
    5659import org.apache.velocity.context.Context; 
     
    6467public class GenerateTables { 
    6568 
     69        private static int MAX_DEPTH = 0; 
     70 
    6671        private enum CONTEXT { 
    6772                tableModel, umlClass, simpleAttributes, imports, mapping, inheritedParents, associationTable, notSortable 
     
    7277        private final StrBuilder sqlTablesStrBuffer = new StrBuilder(1000); 
    7378 
    74         //Collects the necessary classes to import  
     79        // Collects the necessary classes to import 
    7580        private final static String importTemplateFile = "velocity/python/importing.vm"; 
    76         //Collects the information about the relations between the mappers 
    77         private final static String mapperTemplateFile = "velocity/python/mapping.vm";   
    78         //Collects the information about the relations between the not sortable mappers (first step) 
     81        // Collects the information about the relations between the mappers 
     82        private final static String mapperTemplateFile = "velocity/python/mapping.vm"; 
     83        // Collects the information about the relations between the not sortable 
     84        // mappers (first step) 
    7985        private final static String notSortableMapperTemplateFile_1 = "velocity/python/notSortableMapping_1.vm"; 
    80         //Collects the information about the relations between the not sortable mappers (second step) 
    81         private final static String notSortableMapperTemplateFile_2 = "velocity/python/notSortableMapping_2.vm";         
    82         //Collects the information to build a manytomany adapter table 
     86        // Collects the information about the relations between the not sortable 
     87        // mappers (second step) 
     88        private final static String notSortableMapperTemplateFile_2 = "velocity/python/notSortableMapping_2.vm"; 
     89        // Collects the information to build a manytomany adapter table 
    8390        private final static String associationTemplateFile = "velocity/python/association.vm"; 
    84          
     91 
    8592        private final Context vcontext = NmVelocity.getInstance().createContext(); 
    8693        private GenerateModuleHelper helper; 
    87          
     94 
    8895        private final Logger logger = LoggerFactory.getLogger(GenerateTables.class); 
    89          
     96 
    9097        private final File baseDir; 
    91         private final UMLElementsArchive umlArchive;     
    92          
     98        private final UMLElementsArchive umlArchive; 
     99 
    93100        /** 
    94101         * @param baseDir 
     
    97104                super(); 
    98105                this.baseDir = baseDir; 
    99                 this.umlArchive = umlArchive;            
     106                this.umlArchive = umlArchive; 
    100107        } 
    101108 
    102109        public void execute(UMLModel umlModel) throws IOException { 
    103                 //Extracts the ClassModels belonging only to the given UMLModel 
     110                // Extracts the ClassModels belonging only to the given UMLModel 
    104111                CollectClassModel ccm = new CollectClassModel(umlArchive.getClassModel()); 
    105112                CollectionUtils.forAllDo(umlArchive.getUMLClassesByUMLModel(umlModel), ccm); 
    106                  
    107                 //Adds some customer required ClassModel not directly binded to the given UMLModel 
     113 
     114                // Adds some customer required ClassModel not directly binded to the 
     115                // given UMLModel 
    108116                processOrphans(ccm); 
    109                  
    110                 //Generates the TableModels              
     117 
     118                // Generates the TableModels 
    111119                GenerateTablesClosure closure = new GenerateTablesClosure(umlArchive); 
    112120                CollectionUtils.forAllDo(ccm.getResult(), closure); 
    113                 //then writes the result out 
     121                // then writes the result out 
    114122                writeAll(closure); 
    115123        } 
    116          
     124 
    117125        private void processOrphans(CollectClassModel ccm) { 
    118126                Set<String> externalClasses = new HashSet<String>(); 
     
    120128                CollectionUtils.forAllDo(externalClasses, ccm); 
    121129        } 
    122          
    123         private <E> void applyTemplate(Collection<E> models, CONTEXT contextName, StrBuilder sb, String templateName){ 
     130 
     131        private <E> void applyTemplate(Collection<E> models, CONTEXT contextName, StrBuilder sb, String templateName) { 
    124132                Iterator<E> iter = models.iterator(); 
    125133                Object item = null; 
    126134                while (iter.hasNext()) { 
    127135                        item = iter.next(); 
    128                         if (item instanceof TableModel &&   
    129                                         ((TableModel)item).getAssociatedClass().equals("EARootClass")) 
     136                        if (item instanceof TableModel && ((TableModel) item).getAssociatedClass().equals("EARootClass")) 
    130137                                continue; 
    131                          
     138 
    132139                        try { 
    133140                                getVcontext().put(contextName.name(), item); 
     
    138145                } 
    139146        } 
    140          
     147 
    141148        private void writeAll(GenerateTablesClosure closure) throws IOException { 
    142                 PythonImportClosure importClosure = new PythonImportClosure();   
     149                PythonImportClosure importClosure = new PythonImportClosure(); 
    143150                checkReciprocalTables(closure, importClosure); 
    144151 
    145152                List<TableModel> tbs = sortTableModels(closure); 
    146                 //-- THINK BEFORE CHANGE THE ORDER!! --// 
    147                 applyTemplate(tbs, CONTEXT.tableModel, sqlTablesStrBuffer, tableTemplateFile);   
    148                 applyTemplate(closure.getNotSortable(), CONTEXT.tableModel, sqlTablesStrBuffer, tableTemplateFile);              
    149                 applyTemplate(closure.getAssociationTable(), CONTEXT.associationTable, sqlTablesStrBuffer, associationTemplateFile);                             
     153                // -- THINK BEFORE CHANGE THE ORDER!! --// 
     154                applyTemplate(tbs, CONTEXT.tableModel, sqlTablesStrBuffer, tableTemplateFile); 
     155                applyTemplate(closure.getNotSortable(), CONTEXT.tableModel, sqlTablesStrBuffer, tableTemplateFile); 
     156                applyTemplate(closure.getAssociationTable(), CONTEXT.associationTable, sqlTablesStrBuffer, 
     157                                associationTemplateFile); 
    150158                vcontext.put(CONTEXT.imports.name(), importClosure.getImportMap()); 
    151                  
     159 
    152160                applyTemplate(tbs, CONTEXT.tableModel, sqlTablesStrBuffer, mapperTemplateFile); 
    153                  
     161 
    154162                Set<TableModel> nsSimple = new HashSet<TableModel>(); 
    155163                Iterator<TableModel> iter = closure.getNotSortable().iterator(); 
     
    158166                        if (tm.getInherited().size() == 0) { 
    159167                                nsSimple.add(tm); 
    160                                 iter.remove();   
    161                         } 
    162                 } 
    163                  
     168                                iter.remove(); 
     169                        } 
     170                } 
     171 
    164172                applyTemplate(nsSimple, CONTEXT.tableModel, sqlTablesStrBuffer, notSortableMapperTemplateFile_1); 
    165173                applyTemplate(closure.getNotSortable(), CONTEXT.tableModel, sqlTablesStrBuffer, notSortableMapperTemplateFile_1); 
    166174                applyTemplate(nsSimple, CONTEXT.tableModel, sqlTablesStrBuffer, notSortableMapperTemplateFile_2); 
    167175                applyTemplate(closure.getNotSortable(), CONTEXT.tableModel, sqlTablesStrBuffer, notSortableMapperTemplateFile_2); 
    168                 //-------------------------------------// 
    169                  
     176                // -------------------------------------// 
    170177 
    171178                Writer sqlTablesWriter = new FileWriter(new File(getHelper().getBaseDir(), "sqlTables.py"), true); 
    172                 sqlTablesWriter.append("from sqlalchemy import Table, Column, Integer, String, ForeignKey, Sequence, event, MetaData\n"); 
     179                sqlTablesWriter 
     180                                .append("from sqlalchemy import Table, Column, Integer, String, ForeignKey, Sequence, event, MetaData\n"); 
    173181                sqlTablesWriter.append("from sqlalchemy.orm import relationship, backref, mapper, clear_mappers\n"); 
    174182                sqlTablesWriter.append("from sqlalchemy.ext.declarative import declarative_base\n"); 
    175183                sqlTablesWriter.append("from sqlalchemy.dialects.postgresql import ARRAY, TEXT, NUMERIC, BOOLEAN, DATE\n"); 
    176184                sqlTablesWriter.append("from sqlalchemy.types import DateTime\n"); 
    177                 sqlTablesWriter.append("from sqlalchemy.orm.util import class_mapper\n");                
     185                sqlTablesWriter.append("from sqlalchemy.orm.util import class_mapper\n"); 
    178186                sqlTablesWriter.append("from sqlalchemy.schema import ForeignKeyConstraint\n\n"); 
    179187                sqlTablesWriter.append("from ascore.astext import ASText\n\n"); 
     
    182190 
    183191                // import 
    184                 //getVcontext().put(CONTEXT.imports.name(), importCollector.getImportMap()); 
     192                // getVcontext().put(CONTEXT.imports.name(), 
     193                // importCollector.getImportMap()); 
    185194                sqlTablesWriter.append(NmVelocity.getInstance().fillTemplate(getVcontext(), importTemplateFile)); 
    186195                sqlTablesWriter.append("\n\n"); 
    187                 sqlTablesWriter.append("clear_mappers()\n"); 
    188                 sqlTablesWriter.append("metadata = MetaData()\n"); 
    189196                sqlTablesWriter.append("def next_id(connection, seq_name):\n"); 
    190197                sqlTablesWriter.append("    seq = Sequence(seq_name)\n"); 
    191198                sqlTablesWriter.append("    seq.create(bind=connection)\n"); 
    192199                sqlTablesWriter.append("    return connection.execute(seq)\n"); 
    193                 sqlTablesWriter.append("\n\n");          
     200                sqlTablesWriter.append("\n\n"); 
    194201                sqlTablesWriter.append(sqlTablesStrBuffer.toString()); 
    195                 sqlTablesWriter.append("metadata.create_all(engine)\n"); 
    196202                sqlTablesWriter.append("\n\n"); 
    197203                sqlTablesWriter.close(); 
     
    199205 
    200206        private void checkReciprocalTables(GenerateTablesClosure closure, PythonImportClosure importClosure) { 
    201                 //Imports the classes necessaries for the table declaration 
     207                // Imports the classes necessaries for the table declaration 
    202208                CollectionUtils.forAllDo(closure.getTableModels(), importClosure); 
    203                  
    204                 Iterator<TableModel> iterator = closure.getTableModels().iterator();             
     209 
     210                Iterator<TableModel> iterator = closure.getTableModels().iterator(); 
    205211                while (iterator.hasNext()) { 
    206212                        TableModel tb = iterator.next(); 
    207213                        /* 
    208                          * Checks if one attribute or one of attribuite's children  
    209                          * refers back to this TableModel                        
     214                         * Checks if one attribute or one of attribuite's children refers 
     215                         * back to this TableModel 
    210216                         */ 
    211217                        checkTableLoop(tb, closure); 
    212                          
    213                         /*  
    214                          * Checks if one attribute of this TableModel  
    215                          * 1) has the same name as one of TableModel's parents 
    216                          * 2) has one of the TableModel's parent as parent too 
    217                          *              and eventually set up a many-to-many relationship  
     218 
     219                        /* 
     220                         * Checks if one attribute of this TableModel 1) has the same name 
     221                         * as one of TableModel's parents 2) has one of the TableModel's 
     222                         * parent as parent too and eventually set up a many-to-many 
     223                         * relationship 
    218224                         */ 
    219225                        checkTableAttributeOverriding(tb, importClosure); 
     
    221227        } 
    222228 
    223         private void checkTableAttributeOverriding(TableModel tb, PythonImportClosure importClosure){ 
    224                 //Imports the classes necessaries for the table definition 
     229        private void checkTableAttributeOverriding(TableModel tb, PythonImportClosure importClosure) { 
     230                // Imports the classes necessaries for the table definition 
    225231                CollectionUtils.forAllDo(tb.getAttributeModel(), importClosure); 
    226                  
     232 
    227233                Set<TableModel> ovm = new HashSet<TableModel>(); 
    228234                for (AttributeModel am : tb.getAttributeModel()) { 
     
    230236                        for (TableModel inherited : tb.getInherited()) { 
    231237                                for (AttributeModel inhAttribute : inherited.getAttributeModel()) { 
    232                                         if(inhAttribute.getName().equals(am.getName())) { 
     238                                        if (inhAttribute.getName().equals(am.getName())) { 
    233239                                                ovm.add(tb); 
    234240                                                ovm.add(inherited); 
     
    241247                } 
    242248        } 
    243          
     249 
    244250        private void checkTableLoop(TableModel tb, GenerateTablesClosure closure) { 
    245251                Iterator<Relationship> iterator = tb.getRelationship().iterator(); 
     
    247253                        Relationship rl = iterator.next(); 
    248254                        if (rl.isOneToOne()) 
    249                                 return;                  
     255                                continue; 
    250256                        LoopFinder lf = new LoopFinder(rl, closure.getTableModels().size(), closure); 
    251257                        lf.search(); 
    252258                } 
    253                  
    254                 Iterator<TableModel> tm = tb.getInherited().iterator(); 
    255                 while (tm.hasNext()) { 
    256                         solveForeignLoop(tm.next(), tb, closure); 
    257                 } 
     259 
     260//              Iterator<TableModel> tm = tb.getInherited().iterator(); 
     261//              while (tm.hasNext()) { 
     262//                      solveForeignLoop(tm.next(), tb, closure); 
     263//              } 
    258264        } 
    259265 
     
    262268         * form 
    263269         *  
    264 //      * --parent Column('id', primaryKey) 
     270         * // * --parent Column('id', primaryKey) 
    265271         *  
    266272         * --child Column('parent_id', ForeignKey('parent.id'), primaryKey) 
     
    270276         * the structure is similar to 
    271277         *  
    272          * --parent Column('id', primaryKey) 
    273          * --parent Column('child_id', ForeignKey('child.id')) 
     278         * --parent Column('id', primaryKey) --parent Column('child_id', 
     279         * ForeignKey('child.id')) 
    274280         *  
    275281         *  
     
    280286         *  
    281287         * is necessary to modify the relation type to a many-to-many type and for 
    282          * this is necessary 1) to delete the foreignkey from the parent 2) modify the 
    283          * relation on the child 3) create a third (association) table  
     288         * this is necessary 1) to delete the foreignkey from the parent 2) modify 
     289         * the relation on the child 3) create a third (association) table 
    284290         **/ 
    285291        private void solveForeignLoop(TableModel parent, TableModel child, GenerateTablesClosure closure) { 
    286292                Iterator<ForeignKey> fk = parent.getFk().iterator(); 
    287293                while (fk.hasNext()) { 
    288                         ForeignKey tmp_fk = fk.next();   
     294                        ForeignKey tmp_fk = fk.next(); 
    289295                        if (!tmp_fk.getTableModel().equals(child) || tmp_fk.getAssociatedRelationship().isOneToOne()) 
    290296                                continue; 
    291                          
     297 
    292298                        AssociationTable at = new AssociationTable(parent, child); 
    293299                        if (!closure.getAssociationTable().contains(at)) { 
     
    301307 
    302308        } 
    303          
     309 
    304310        private class LoopFinder { 
    305311                private final int maxPathLength; 
    306312                private List<TableModel> oldPath = new ArrayList<TableModel>(); 
     313                private Set<Relationship> oldRelations = new HashSet<Relationship>(); 
    307314                private final Relationship relationship; 
    308315                private final GenerateTablesClosure closure; 
    309                  
    310                 public LoopFinder(Relationship relationship, List<TableModel> oldPath, int maxPathLength, GenerateTablesClosure closure) { 
     316 
     317                public LoopFinder(Relationship relationship, List<TableModel> oldPath, int maxPathLength, 
     318                                GenerateTablesClosure closure, Set<Relationship> oldRelations) { 
    311319                        super(); 
    312320                        this.relationship = relationship; 
    313321                        this.maxPathLength = maxPathLength; 
    314322                        this.oldPath.add(relationship.getFromTable()); 
    315                         this.oldPath.add(relationship.getToTable());                     
     323                        this.oldPath.add(relationship.getToTable()); 
    316324                        this.oldPath.addAll(oldPath); 
     325                        this.oldRelations.addAll(oldRelations); 
    317326                        this.closure = closure; 
    318327                } 
    319328 
    320329                public LoopFinder(Relationship relationship, int maxPathLength, GenerateTablesClosure closure) { 
    321                         this(relationship, new ArrayList<TableModel>(), maxPathLength, closure); 
    322                 } 
    323                  
     330                        this(relationship, new ArrayList<TableModel>(), maxPathLength, closure, new HashSet<Relationship>()); 
     331                } 
     332 
    324333                public void search() { 
    325                         if (maxPathLength == oldPath.size()) 
    326                                 return;  
     334                        if (logger.isDebugEnabled()) { 
     335                                logger.debug("oldRelations = " + oldRelations.size()); 
     336                                logger.debug("relationship = " + relationship); 
     337                        } 
     338 
     339                        // if (oldRelations.contains(relationship)) 
     340                        // return; 
     341                        // if (maxPathLength == oldPath.size()) 
     342                        // return; 
    327343                        if (relationship.getBackrefName() != null) 
    328344                                return; 
    329                         Iterator<Relationship> iterator = relationship.getToTable().getRelationship().iterator(); 
     345                        if (relationship.isOneToOne()) 
     346                                return; 
     347 
     348                        oldRelations.add(relationship); 
     349                         
     350                        Set<Relationship> rels = new HashSet<Relationship>(); 
     351                        rels.addAll(relationship.getToTable().getRelationship()); 
     352                        Iterator<Relationship> iterator = rels.iterator(); 
    330353                        while (iterator.hasNext()) { 
    331354                                Relationship item = iterator.next(); 
    332                                 if (oldPath.contains(item.getToTable())) { 
    333                                         checkReciprocalReference(relationship); 
    334                                 } else { 
    335                                         LoopFinder lf = new LoopFinder(item, oldPath, maxPathLength, closure); 
    336                                         lf.search();     
    337                                 }                                        
    338                         }                                        
    339                 } 
    340                  
     355                                if (!oldRelations.contains(item) && !item.isManyToMany()) { 
     356                                        LoopFinder lf = new LoopFinder(item, oldPath, maxPathLength, closure, oldRelations); 
     357                                        lf.search(); 
     358                                        continue; 
     359                                } 
     360                                 
     361                                if (relationship.isOneToMany()) { 
     362                                        closure.transformToManyToMany(relationship); 
     363                                } 
     364                                         
     365                                if (item.isOneToMany()) { 
     366                                        closure.transformToManyToMany(item); 
     367                                }        
     368                                 
     369                                break; 
     370                        } 
     371                        oldRelations.remove(relationship); 
     372                } 
     373 
    341374                /** 
    342                  * On the first pass the algorithm has created one-to-many relation in the 
    343                  * form 
     375                 * On the first pass the algorithm has created one-to-many relation in 
     376                 * the form 
    344377                 *  
    345378                 * --parent mapper(parent, relationship(ChildType, 'parent_field')) 
     
    347380                 * --child Column('parent_id', ForeignKey('parent.id')) 
    348381                 *  
    349                  * now if 1) the parent has an attribute of the child type 2) the child has 
    350                  * an attribute of the parent type 
     382                 * now if 1) the parent has an attribute of the child type 2) the child 
     383                 * has an attribute of the parent type 
    351384                 *  
    352385                 * the structure is similar to 
     
    357390                 * --child Column('parent_id', ForeignKey('parent.id')) mapper(child, 
    358391                 * relationship(ParentType, 'child_field')) 
    359                  *    
    360                  * if there is a reciprocal one-to-many reference is necessary to modify  
    361                  * the relation type to a many-to-many type and for 
    362                  * this is necessary 1) to delete the foreignkey from both 2) delete the 
    363                  * relation on the child 3) create a third (association) table 4) modify 
    364                  * appropriately the parent relationship 
     392                 *  
     393                 * if there is a reciprocal one-to-many reference is necessary to modify 
     394                 * the relation type to a many-to-many type and for this is necessary 1) 
     395                 * to delete the foreignkey from both 2) delete the relation on the 
     396                 * child 3) create a third (association) table 4) modify appropriately 
     397                 * the parent relationship 
    365398                 **/ 
    366                 private void checkReciprocalReference(Relationship rl) { 
    367                         // if the table has a self-reference is ok 
    368                         if (!rl.getFromTable().equals(rl.getToTable())  
    369                                         && !rl.isManyToMany()) { 
    370                                 if (closure.getAssociationTable().contains(new AssociationTable(rl.getFromTable(), rl.getToTable())) 
    371                                                  || closure.getAssociationTable().contains(new AssociationTable(rl.getToTable(), rl.getFromTable()))) 
    372                                         return; 
    373  
    374                                 // validate the relationship 
    375                                 updateRelationToManyToMany(rl.getToTable(), rl, closure); 
    376                         } 
    377                 } 
    378         } 
    379  
    380         private void updateRelationToManyToMany(TableModel child, Relationship onParent, GenerateTablesClosure closure) { 
    381                 Iterator<Relationship> onChildIterator = child.getRelationship().iterator(); 
    382                 while (onChildIterator.hasNext()) { 
    383                         Relationship onChild = onChildIterator.next(); 
    384                         //Are the tables referring one to another? 
    385                         if (onParent.getToTable().equals(onChild.getFromTable())){ 
    386                                 //Are both the relations one-to-many?  
    387                                 if (onParent.isManyToOne() && onChild.isManyToOne()) { 
    388                                         onParent.setRelationType(RELATION_TYPE.MANY_TO_MANY); 
    389                                         onParent.setBackrefName(onChild.getName()); 
    390                                         //Remove the reciprocal one-to-many foreign keys 
    391                                         removeFKFromTables(onParent, onChild); 
    392                                         onChildIterator.remove(); 
    393                                         closure.getAssociationTable().add(new AssociationTable(onChild));                                        
    394                                 } else { 
    395                                         //is a "simple" loop reference. Has to solve with the "use_alter" SqlAlchemy's ForeignKey option 
    396                                         useAlterInFKFromTableModel(onParent, onChild); 
     399                private boolean checkReciprocalReference(Relationship parent) { 
     400                        // the relation is a self-reference                      
     401                        if (parent.getFromTable().equals(parent.getToTable())) { 
     402                                return false; 
     403                        } 
     404 
     405                        if (closure.getAssociationTable().contains(new AssociationTable(parent.getFromTable(), parent.getToTable())) 
     406                                        || closure.getAssociationTable().contains(new AssociationTable(parent.getToTable(), parent.getFromTable()))) { 
     407                                if (parent.isManyToOne() || parent.isOneToMany()) { 
     408                                        if (logger.isWarnEnabled()) { 
     409                                                logger.warn("Should update to ManyToMany relation: " + parent); 
     410                                                //do something 
     411                                        } 
    397412                                } 
     413                                return false; 
    398414                        }                        
     415                        return true; 
     416                } 
     417                 
     418                /** 
     419                 * The two <code>{@link Relationship}</code> refer directly one table to another. That is 
     420                 * parent.fromTable == child.toTable 
     421                 * child.fromTable == parent.toTable 
     422                 */ 
     423                private void updateRelationToManyToMany(Relationship parentRl, Relationship childRl) { 
     424                        if (parentRl.isManyToMany() && childRl.isManyToMany()) { 
     425                                if (parentRl.getAssociationTable() == null  || childRl.getAssociationTable() == null) { 
     426                                        if (logger.isErrorEnabled()) { 
     427                                                logger.error(String.format("Relations are both ManyToMany but one or both have null AssociationTable. parentRl:%1$s  child:%2$s", parentRl, childRl)); 
     428                                        } 
     429                                } 
     430                                if (logger.isDebugEnabled()) { 
     431                                        logger.debug(String.format("Both ManyToMany relations. parentRl:%1$s  child:%2$s", parentRl, childRl)); 
     432                                } 
     433                        } 
     434                         
     435                        if (parentRl.isOneToMany()) { 
     436                                closure.transformToManyToMany(parentRl); 
     437                        } 
     438                                 
     439                        if (childRl.isOneToMany()) { 
     440                                closure.transformToManyToMany(childRl); 
     441                        } 
     442                         
     443//                      if (parentRl.isOneToMany() && childRl.isOneToMany()) { 
     444//                              transformToManyToMany(parentRl); 
     445//                              transformToManyToMany(childRl); 
     446//                      } else if (parentRl.isManyToMany() && childRl.isOneToMany()) { 
     447//                              // may be the parent has been already processed in another loop 
     448//                              // while the child still has been not 
     449//                              transformToManyToMany(childRl); 
     450//                      } else { 
     451//                              useAlterInFKFromTableModel(parentRl, childRl); 
     452//                      } 
     453                } 
     454                 
     455                private void updateRelationToManyToMany(Relationship parentRl) { 
     456                        if (parentRl.isOneToMany()) { 
     457                                parentRl.setRelationType(RELATION_TYPE.MANY_TO_MANY); 
     458                                parentRl.getToTable().getFk().remove(parentRl.getAssociatedForeignKey()); 
     459                                parentRl.setAssociatedForeignKey(null); 
     460                        } 
    399461                } 
    400462        } 
    401463 
    402464        private void removeFKFromTables(Relationship onParent, Relationship onChild) { 
    403                 removeFKFromTableModel(onParent.getFromTable(), onChild.getName(), onParent.getToTable()); 
    404                 removeFKFromTableModel(onParent.getToTable(), onParent.getName(), onParent.getFromTable()); 
    405         } 
    406          
     465 
     466                onChild.getToTable().getFk().remove(onChild.getAssociatedForeignKey()); 
     467                onParent.getToTable().getFk().remove(onParent.getAssociatedForeignKey()); 
     468                onParent.setAssociatedForeignKey(null); 
     469                onChild.setAssociatedForeignKey(null); 
     470                //removeFKFromTableModel(onParent.getFromTable(), onChild.getName(), onParent.getToTable()); 
     471                //removeFKFromTableModel(onParent.getToTable(), onParent.getName(), onParent.getFromTable()); 
     472        } 
     473 
    407474        private void useAlterInFKFromTableModel(Relationship onParent, Relationship onChild) { 
    408                 useAlterInFKFromTableModel(onParent.getFromTable(), onChild.getName(), onParent.getToTable()); 
    409                 useAlterInFKFromTableModel(onParent.getToTable(), onParent.getName(), onParent.getFromTable()); 
    410         } 
    411          
    412         private void removeFKFromTableModel(TableModel model, String attrName, TableModel fromModel) { 
    413                 Iterator<ForeignKey> fkchilditerator = model.getFk().iterator(); 
    414                 while (fkchilditerator.hasNext()) { 
    415                         ForeignKey cfk = fkchilditerator.next(); 
    416                         if (cfk.getParentAttributeName().equals(attrName) && cfk.getTableModel().equals(fromModel)) { 
    417                                 fkchilditerator.remove(); 
    418                                 return; 
    419                         } 
    420                 } 
    421         } 
     475                if (onParent.getAssociatedForeignKey() == null) { 
     476                        logger.error("Foreign key is missing in Relationship: " + onParent); 
     477                        return; //should throw exception 
     478                } 
     479                 
     480                if (onParent.getAssociatedForeignKey() == null) { 
     481                        logger.error("Foreign key is missing in Relationship: " + onParent); 
     482                        return; //should throw exception 
     483                } 
     484                onParent.getAssociatedForeignKey().setUseAlter(true); 
     485                onChild.getAssociatedForeignKey().setUseAlter(true); 
     486                //useAlterInFKFromTableModel(onParent.getFromTable(), onChild.getName(), onParent.getToTable()); 
     487                //useAlterInFKFromTableModel(onParent.getToTable(), onParent.getName(), onParent.getFromTable()); 
     488        } 
     489 
     490//      private void removeFKFromTableModel(TableModel model, String attrName, TableModel fromModel) { 
     491//              Iterator<ForeignKey> fkchilditerator = model.getFk().iterator(); 
     492//              while (fkchilditerator.hasNext()) { 
     493//                      ForeignKey cfk = fkchilditerator.next(); 
     494//                      if (cfk.getParentAttributeName().equals(attrName) && cfk.getTableModel().equals(fromModel)) { 
     495//                              fkchilditerator.remove(); 
     496//                              return; 
     497//                      } 
     498//              } 
     499//      } 
    422500 
    423501        private void useAlterInFKFromTableModel(TableModel model, String attrName, TableModel fromModel) { 
     
    431509                } 
    432510        } 
    433          
     511 
    434512        private void updateRelationToManyToMany(TableModel child, TableModel onParent) { 
    435513                for (Relationship rl : child.getRelationship()) { 
    436514                        if (!rl.getToTable().equals(onParent)) 
    437                                 continue;        
    438                          
     515                                continue; 
     516 
    439517                        rl.setRelationType(RELATION_TYPE.MANY_TO_MANY); 
    440518                        return; 
    441519                } 
    442         }        
    443          
     520        } 
     521 
    444522        private List<TableModel> sortTableModels(GenerateTablesClosure closure) { 
    445523                List<TableModel> finalTable = new ArrayList<TableModel>(); 
     
    459537                        index = finalTable.size(); 
    460538                        if (logger.isDebugEnabled()) 
    461                                 logger.debug("finalTable.size() : tableModels.size() - " + String.valueOf(finalTable.size()) + ":" + String.valueOf(closure.getNotSortable().size())); 
     539                                logger.debug("finalTable.size() : tableModels.size() - " + String.valueOf(finalTable.size()) + ":" 
     540                                                + String.valueOf(closure.getNotSortable().size())); 
    462541                        updateFinalTable(finalTable, closure); 
    463                          
    464                         //is possible more optimization? 
     542 
     543                        // is possible more optimization? 
    465544                        if (index == finalTable.size()) 
    466545                                break; 
    467                 }                        
     546                } 
    468547                return finalTable; 
    469548        } 
    470          
     549 
    471550        private void updateFinalTable(List<TableModel> finalTable, GenerateTablesClosure closure) { 
    472551                List<TableModel> tm = new ArrayList<TableModel>(closure.getNotSortable()); 
    473552                Collections.shuffle(tm); 
    474553                Iterator<TableModel> iter = tm.iterator(); 
    475                 TableModel tb = null;            
     554                TableModel tb = null; 
    476555                while (iter.hasNext()) { 
    477556                        tb = iter.next(); 
    478557                        if (finalTable.contains(tb)) 
    479558                                continue; 
    480                          
     559 
    481560                        boolean add = true; 
    482                          
     561 
    483562                        Iterator<Relationship> innerIter = tb.getRelationship().iterator(); 
    484563                        Relationship innerRelation = null; 
    485                         while (innerIter.hasNext()) {    
     564                        while (innerIter.hasNext()) { 
    486565                                innerRelation = innerIter.next(); 
    487566                                if (innerRelation.getFromTable().equals(innerRelation.getToTable())) 
    488567                                        continue; 
    489                                 add = finalTable.contains(innerRelation.getToTable()) && add;                                    
    490                         } 
    491                          
     568                                add = finalTable.contains(innerRelation.getToTable()) && add; 
     569                        } 
     570 
    492571                        Iterator<TableModel> inheritedIter = tb.getInherited().iterator(); 
    493                         while (inheritedIter.hasNext()) {        
     572                        while (inheritedIter.hasNext()) { 
    494573                                add = finalTable.contains(inheritedIter.next()) && add; 
    495574                        } 
    496                          
     575 
    497576                        if (add) { 
    498577                                finalTable.add(tb); 
     
    501580                } 
    502581        } 
    503          
     582 
    504583        /** 
    505584         * @return the vcontext 
     
    507586        private Context getVcontext() { 
    508587                return vcontext; 
    509         }        
    510          
     588        } 
     589 
    511590        /** 
    512591         * @return the helper 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/GenerateTablesClosure.java

    r8064 r8084  
    111111        } 
    112112 
     113        public void transformToManyToMany(Relationship rl) { 
     114                rl.setRelationType(RELATION_TYPE.MANY_TO_MANY);          
     115                rl.setAssociationTable(getAssociationTable(rl)); 
     116                getAssociationTable().add(rl.getAssociationTable()); 
     117                rl.getToTable().getFk().remove(rl.getAssociatedForeignKey()); 
     118                rl.setAssociatedForeignKey(null);                        
     119        }        
     120         
    113121        private ClassModel getClassModel(UMLClassDataType umlClass) { 
    114122                return umlArchive.getClassModelByUMLClass(umlClass); 
     
    136144                addInheritanceAsComposition(tm); 
    137145        } 
    138  
    139         private void processSuperAttribute() { 
    140                  
    141         } 
    142146         
    143147        private void parseAttributes(TableModel parent) throws NewmoonException, 
     
    148152                        am = iter.next(); 
    149153                         
    150                         if (am instanceof SuperAttribute) 
     154                        if (am instanceof SuperAttribute){ 
     155                                for (ClassModel cm : ((SuperAttribute)am).getSubTypes()) { 
     156                                        String attrName = String.format("_%1$s_%2$s", am.getName(), cm.getAssociatedClass().getName().toLowerCase()); 
     157                                        processParentChildAttribute(parent, processUMLclass(cm), attrName , am.hasMultiplicity(), am.isNullable()); 
     158                                } 
    151159                                continue; 
     160                        } 
    152161                         
    153162                        ClassModel cm = am.getAssociatedType(); 
    154  
    155163                        if (cm == null || checkIfSkipProcess(cm)) { 
    156164                                parent.getAttributeModel().add(am); 
    157165                                continue; 
    158166                        } 
    159  
    160                         TableModel child = processUMLclass(cm); 
    161                         if (child == null) 
    162                                 continue; 
    163                          
    164                         /* 
    165                          * Voidable should be manage with a "status" more than with a NULL 
    166                          * column 
    167                          */ 
    168                         boolean nullable = am.getLowerBound().equals("0") 
    169                                         || am.isVoidable(); 
    170  
    171                         Relationship rl = new Relationship(parent, child, NmVelocityHelper.checkName(am.getName()), nullable, am.hasMultiplicity()); 
    172  
    173                         if (am.hasMultiplicity() && parent.equals(child)) { 
    174                                 rl.setRelationType(RELATION_TYPE.MANY_TO_MANY); 
    175                                 associationTable.add(new AssociationTable(rl)); 
    176                         } 
    177  
    178                         if (!parent.equals(child)) { 
    179                                 ForeignKey fk = new ForeignKey(parent, am.getName()); 
    180                                 fk.setAssociatedRelationship(rl); 
    181                                 rl.setAssociatedForeignKey(fk); 
    182                                 child.getFk().add(fk); 
    183                                 if (am.hasMultiplicity()) { 
    184                                         rl.setRelationType(RELATION_TYPE.ONE_TO_MANY); 
    185                                 } else { 
    186                                         rl.setRelationType(RELATION_TYPE.ONE_TO_ONE); 
    187                                 } 
    188                                 parent.getRelationship().add(rl); 
    189                                 associateFKandRelationship(fk, rl); 
    190                         } 
    191  
    192                 } 
     167                        processParentChildAttribute(parent, processUMLclass(cm), am.getName(), am.hasMultiplicity(), am.isNullable()); 
     168                } 
     169        } 
     170         
     171        private void processParentChildAttribute(TableModel parent, TableModel child, String attributeName, boolean hasMultiplicity, boolean isNullable) { 
     172                if (child == null) 
     173                        return;          
     174 
     175                Relationship rl = new Relationship(parent, child, NmVelocityHelper.checkName(attributeName), isNullable, hasMultiplicity); 
     176 
     177                if (parent.equals(child)) { 
     178                        if (hasMultiplicity) { 
     179                                transformToManyToMany(rl);       
     180                        } 
     181                } else { 
     182                        ForeignKey fk = new ForeignKey(parent, attributeName); 
     183                        child.getFk().add(fk); 
     184                        if (hasMultiplicity) { 
     185                                rl.setRelationType(RELATION_TYPE.ONE_TO_MANY); 
     186                        } else { 
     187                                rl.setRelationType(RELATION_TYPE.ONE_TO_ONE); 
     188                                rl.setBackrefName(parent.getAssociatedClass().getName().toLowerCase() + "_" + rl.getName()); 
     189                        } 
     190                        parent.getRelationship().add(rl); 
     191                        associateFKandRelationship(fk, rl); 
     192                }                
    193193        } 
    194194         
     
    205205 
    206206                        TableModel parent = processUMLclass(cm); 
    207                         Relationship rl = new Relationship(child, parent, '_' + parent.getAssociatedClass().getName().toLowerCase(), false, false); 
    208                          
    209                         ForeignKey fk = new ForeignKey(child, '_' + parent.getAssociatedClass().getName()); 
    210                         fk.setAssociatedRelationship(rl); 
    211                         rl.setAssociatedForeignKey(fk); 
     207                        String relName = '_' + parent.getAssociatedClass().getName().toLowerCase(); 
     208                        Relationship rl = new Relationship(child, parent, relName, false, false);                        
     209                        ForeignKey fk = new ForeignKey(child, relName); 
    212210                        parent.getFk().add(fk); 
    213211                        rl.setRelationType(RELATION_TYPE.ONE_TO_ONE); 
     212                        rl.setBackrefName(child.getAssociatedClass().getName().toLowerCase() + "_" + relName); 
    214213                        child.getRelationship().add(rl); 
    215214                        associateFKandRelationship(fk, rl); 
     
    249248                } 
    250249        } 
     250         
     251        private AssociationTable getAssociationTable(Relationship rl) { 
     252                AssociationTable ret = new AssociationTable(rl); 
     253                if (getAssociationTable().contains(ret)) { 
     254                        for (AssociationTable at : getAssociationTable()) { 
     255                                if (at.equals(ret)) { 
     256                                        return at; 
     257                                } 
     258                        } 
     259                } 
     260                return ret; 
     261        } 
    251262} 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/NmVelocityHelper.java

    r8060 r8084  
    3232package ndg.services.newmoon.velocity.python; 
    3333 
     34import java.util.ArrayList; 
     35import java.util.Collections; 
    3436import java.util.HashSet; 
     37import java.util.List; 
    3538import java.util.Properties; 
    3639import java.util.Set; 
    3740 
     41import ndg.services.newmoon.NmParserHelper; 
    3842import ndg.services.newmoon.UMLElementsArchive; 
    3943import ndg.services.newmoon.UMLElementsArchive.PropertyMap; 
     44import ndg.services.newmoon.collect.AttributeModel; 
     45import ndg.services.newmoon.collect.ClassModel; 
     46import ndg.services.newmoon.xmiModel.UMLClassDataType; 
    4047 
    4148import org.apache.commons.collections.CollectionUtils; 
     
    8693                return getXMIToSQL().containsKey(className); 
    8794        } 
    88          
    89         /** 
    90          * Returns an array containg on the first element the name of the package from 
    91          * where import and on the second the name of which class import 
     95 
     96        /** 
     97         * Returns an "almost" ordered list in order to avoid to the python MRO 
     98         * conflicts during a python class initialization.  
     99         * For example if B is parent of A the following python class definition  
     100         * is an error 
     101         * class C(A,B) 
     102         *   pass 
     103         *  
     104         * while 
     105         *  
     106         * class C(B,A) 
     107         *   pass 
     108         *  
     109         * is correct.  
     110         **/ 
     111        public static List<ClassModel> getOrderedParents(ClassModel classModel) {                
     112                List<ClassModel> cms = new ArrayList<ClassModel>(); 
     113                cms.addAll(classModel.getParents()); 
     114                if (cms.size() > 1) { 
     115                        Collections.sort(cms);   
     116                }                
     117                return cms; 
     118        }        
     119         
     120        public static String getPythonModule(UMLClassDataType umlClass) { 
     121                return NmParserHelper.getPackageParentName(umlClass.getUmlPackage()) + "." + umlClass.getName().toLowerCase(); 
     122        }        
     123 
     124        /** 
     125         * Returns an array containg on the first element the name of the module from 
     126         * where import and on the second the name of which class import. This methods 
     127         * takes care to substitute when necesary the   
    92128         * @param className a class name 
    93129         * @return a two elements array, <code>null</code> if {@link #isExternallyMapped(String)} returns <code>false</code>  
    94130         * */ 
    95         public static String[] getMappedImportImport(String className) { 
     131        public static String[] formatPythonImportString(UMLClassDataType umlClass) { 
    96132                String[] ret = null; 
    97                 if (isExternallyMapped(className)) { 
     133                if (isExternallyMapped(umlClass.getName())) { 
    98134                        ret = new String[2]; 
    99                         String clazz = getXMIToSQL().getProperty(className); 
     135                        String clazz = getXMIToSQL().getProperty(umlClass.getName()); 
    100136                        ret[0] = StringUtils.substringBeforeLast(clazz, "."); 
    101137                        ret[1] = StringUtils.substringAfterLast(clazz, "."); 
     138                } else { 
     139                        ret = new String[2]; 
     140                        ret[0] = NmParserHelper.getPackageParentName(umlClass.getUmlPackage()) + "." + umlClass.getName().toLowerCase(); 
     141                        ret[1] = umlClass.getName(); 
     142                } 
     143                return ret; 
     144        } 
     145         
     146//      /** 
     147//       * Returns an array containg on the first element the name of the module from 
     148//       * where import and on the second the name of which class import. This methods 
     149//       * takes care to substitute when necesary the   
     150//       * @param className a class name 
     151//       * @return a two elements array, <code>null</code> if {@link #isExternallyMapped(String)} returns <code>false</code>  
     152//       * */ 
     153//      @Deprecated 
     154//      public static String[] getMappedImportImport(String className) { 
     155//              String[] ret = null; 
     156//              if (isExternallyMapped(className)) { 
     157//                      ret = new String[2]; 
     158//                      String clazz = getXMIToSQL().getProperty(className); 
     159//                      ret[0] = StringUtils.substringBeforeLast(clazz, "."); 
     160//                      ret[1] = StringUtils.substringAfterLast(clazz, "."); 
     161//              }  
     162//              return ret; 
     163//      } 
     164// 
     165//      @Deprecated 
     166//      private static String getMappedPythonImport(String className, String type) { 
     167//              String[] ret = getMappedImportImport(className); 
     168//              if (ret != null) { 
     169//                      if (type.equals("Module")) { 
     170//                              return ret[0];   
     171//                      } else if (type.equals("Class")) { 
     172//                              return ret[1]; 
     173//                      }                        
     174//              }  
     175//              return className;  
     176//      }  
     177//       
     178//      /** 
     179//       * Returns the module from where import a given class. Is a shortway to get  
     180//       * the first element of {@link #getMappedImportImport(String)} 
     181//       * @param className a class name 
     182//       * @return the module name, else return the given className  
     183//       **/ 
     184//      @Deprecated 
     185//      public static String getMappedModule(String className) { 
     186//              return getMappedPythonImport(className, "Module"); 
     187//      }        
     188// 
     189//      /** 
     190//       * Returns the Class from where import a given class. Is a shortway to get  
     191//       * the first element of {@link #getMappedImportImport(String)} 
     192//       * @param className a class name 
     193//       * @return the module name, else return the given className  
     194//       **/ 
     195//      @Deprecated 
     196//      public static String getMappedClass(String className) { 
     197//              return getMappedPythonImport(className, "Class"); 
     198//      }        
     199         
     200        private static String formatPythonImportString(UMLClassDataType umlClass, String type) { 
     201                String[] ret = formatPythonImportString(umlClass); 
     202                if (ret != null) { 
     203                        if (type.equals("Module")) { 
     204                                return ret[0];   
     205                        } else if (type.equals("Class")) { 
     206                                return ret[1]; 
     207                        }                        
    102208                }  
    103                 return ret; 
    104         } 
    105          
    106         public static String getMappedClass(String className) { 
    107                 String[] ret = getMappedImportImport(className); 
    108                 if (ret != null) {                       
    109                         return ret[1]; 
    110                 }  
    111                 return className; 
    112         }        
     209                return "";  
     210        }  
     211         
     212        /** 
     213         * Returns the module from where import a given class. Is a shortway to get  
     214         * the first element of {@link #formatPythonImportString(UMLClassDataType)} 
     215         * @param className a class name 
     216         * @return the module name, else return the given className  
     217         **/ 
     218        public static String getMappedModule(UMLClassDataType umlClass) { 
     219                return formatPythonImportString(umlClass, "Module"); 
     220        }        
     221 
     222        /** 
     223         * Returns the Class from where import a given class. Is a shortway to get  
     224         * the first element of {@link #formatPythonImportString(UMLClassDataType)} 
     225         * @param className a class name 
     226         * @return the module name, else return the given className  
     227         **/ 
     228        public static String getMappedClass(UMLClassDataType umlClass) { 
     229                return formatPythonImportString(umlClass, "Class"); 
     230        } 
    113231         
    114232        /** 
     
    134252        }        
    135253         
    136         /** 
    137         public static String encodeUMLPackageName(UMLPackage umlPackage) { 
    138                 String path = StringUtils.replaceChars(umlPackage.toString(), ' ', '_').toLowerCase(); 
    139                 path = StringUtils.replaceChars(path, '.', File.separatorChar).toLowerCase(); 
    140                 return StringUtils.replaceChars(path, ':', '_').toLowerCase(); 
    141         } 
    142         */ 
     254        public static String substituteDBType(String text) { 
     255                String clazz = getXMIToSQL().getProperty(text); 
     256                if (clazz == null) { 
     257                        return text; 
     258                } 
     259                return StringUtils.substringAfterLast(clazz, "."); 
     260        }                
     261         
     262        public static String substituteDBType(AttributeModel attribute) { 
     263                String ret = attribute.getAssociatedType().getAssociatedClass().getName(); 
     264                String clazz = substituteDBType(ret); 
     265                 
     266                if (attribute.getAssociatedType().isCodeList() || attribute.getAssociatedType().isEnumeration()) { 
     267                        // The IF below has to be fixed 
     268                        // 1) is not admissible the equal(BOOLEAN) check 
     269                        // 2) has to be created a custom type to handle the ARRAY(ENUM) case 
     270                        //has to be fixed! cannot use the "IF" below!! 
     271                        if (!clazz.equals("BOOLEAN")) { 
     272                                clazz += ".db_type()"; 
     273                                return clazz; 
     274                        }                        
     275                } 
     276                 
     277                //Actually I cannot manage type like Sequance<Vector> and for this reason  
     278                // I set them by default to ARRAY<TEXT> 
     279                if (attribute.hasMultiplicity()) { 
     280                        if (clazz.equalsIgnoreCase(substituteDBType("Vector"))) { 
     281                                return "ARRAY(" + substituteDBType("CharacterString") + ")"; 
     282                        } else { 
     283                                return "ARRAY(" + clazz + ")";   
     284                        }                                
     285                }                
     286                return clazz; 
     287        }        
     288         
    143289        private static Properties getXMIToSQL() { 
    144290                if (xmiToSQLMaps == null) 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/PythonAttributeModel.java

    r8064 r8084  
    3131 */ 
    3232package ndg.services.newmoon.velocity.python; 
    33  
    34 import java.util.ArrayList; 
    35 import java.util.List; 
    3633 
    3734import ndg.services.newmoon.collect.AttributeModel; 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/PythonClassModel.java

    r8064 r8084  
    4747 
    4848import org.apache.commons.collections.CollectionUtils; 
    49 import org.hamcrest.core.IsInstanceOf; 
    5049 
    5150/** 
     
    8786        public Map<String, Set<String>>  generateImports() { 
    8887                PythonImportClosure closure = new PythonImportClosure(); 
    89                 List toImport = new ArrayList(); 
     88                List<? super AttributeModel> toImport = new ArrayList(); 
    9089                CollectionUtils.addAll(toImport, this.getParents().iterator());  
    9190                 
     
    9897                        CollectionUtils.addAll(toImport, this.getAttributeModel().iterator()); 
    9998                }                
    100                 for (AttributeModel am : this.getAttributeModel()) { 
    101                         if (am instanceof SuperAttribute) { 
    102                                 toImport.add(am); 
     99                 
     100//              for (AttributeModel am : this.getAttributeModel()) { 
     101//                      if (am instanceof SuperAttribute) { 
     102//                              toImport.add(am); 
     103//                      } 
     104//              } 
     105                 
     106                CollectionUtils.forAllDo(toImport, closure); 
     107                if (this.getAssociatedClass() != null  
     108                                && this.getAssociatedClass().getUmlPackage() != null 
     109                                && closure.getImportMap().containsKey(NmVelocityHelper.getMappedModule(this.getAssociatedClass()))) { 
     110                        Set<String> classes = closure.getImportMap().get(NmVelocityHelper.getMappedModule(this.getAssociatedClass())); 
     111                        if (classes.contains(this.getAssociatedClass().getName())) { 
     112                                classes.remove(this.getAssociatedClass().getName()); 
     113                        } 
     114                        if (classes.isEmpty()) { 
     115                                closure.getImportMap().remove(NmVelocityHelper.getMappedModule(this.getAssociatedClass())); 
    103116                        } 
    104117                } 
    105                  
    106                 CollectionUtils.forAllDo(toImport, closure); 
     118 
    107119                return closure.getImportMap(); 
    108120        }                
     
    157169                        return null; 
    158170                String name = am.getAssociatedType().getAssociatedClass().getName(); 
    159                 String[] imp = NmVelocityHelper.getMappedImportImport(am.getAssociatedType().getAssociatedClass().getName()); 
     171                String[] imp = NmVelocityHelper.formatPythonImportString(am.getAssociatedType().getAssociatedClass()); 
    160172                if (imp != null) { 
    161173                        name = imp[1]; 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/PythonImportClosure.java

    r8064 r8084  
    5757                        if (input == null) 
    5858                                return;  
    59                          
     59                                                 
    6060                        if (input instanceof SuperAttribute) { 
    6161                                SuperAttribute am = ((SuperAttribute)input); 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/support/ForeignKey.java

    r8040 r8084  
    128128                        return false; 
    129129                return true; 
     130        } 
     131 
     132        /* (non-Javadoc) 
     133         * @see java.lang.Object#toString() 
     134         */ 
     135        @Override 
     136        public String toString() { 
     137                return "ForeignKey [parentAttributeName=" + parentAttributeName + ", tableModel=" + tableModel + "]"; 
    130138        }                
     139         
     140         
    131141} 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/support/ImportCollector.java

    r8048 r8084  
    6666                String className = null; 
    6767                if (NmVelocityHelper.isExternallyMapped(umlClass.getName())) { 
    68                         String[] imp = NmVelocityHelper.getMappedImportImport(umlClass.getName()); 
     68                        String[] imp = NmVelocityHelper.formatPythonImportString(umlClass); 
    6969                        moduleName = imp[0]; 
    7070                        className = imp[1]; 
    7171                } else { 
    72                         moduleName = getModule(umlClass); 
     72                        moduleName = NmVelocityHelper.getPythonModule(umlClass); 
    7373                        className = umlClass.getName(); 
    7474                }                        
     
    8383        } 
    8484         
    85         private String getModule(UMLClassDataType umlClass) { 
    86                 return NmParserHelper.getPackageParentName(umlClass.getUmlPackage()) + "." + umlClass.getName().toLowerCase(); 
    87         } 
    88          
    8985        public Map<String, Set<String>> getImportMap() { 
    9086                return importMap; 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/java/ndg/services/newmoon/velocity/python/support/Relationship.java

    r8040 r8084  
    3232package ndg.services.newmoon.velocity.python.support; 
    3333 
    34 import org.apache.commons.httpclient.util.LangUtils; 
    3534 
    3635/** 
     
    5150        private final boolean useList; 
    5251        private ForeignKey associatedForeignKey  = null; 
     52        private AssociationTable associationTable  = null; 
    5353         
    5454        /** 
     
    6767        } 
    6868         
     69        /** 
     70         * @return the associationTable 
     71         */ 
     72        public AssociationTable getAssociationTable() { 
     73                return associationTable; 
     74        } 
     75 
     76 
     77 
     78        /** 
     79         * @param associationTable the associationTable to set 
     80         */ 
     81        public void setAssociationTable(AssociationTable associationTable) { 
     82                this.associationTable = associationTable; 
     83        } 
     84 
     85 
     86 
    6987        /** 
    7088         * @return the associatedForeignKey 
     
    194212                return true; 
    195213        } 
     214 
     215        /* (non-Javadoc) 
     216         * @see java.lang.Object#toString() 
     217         */ 
     218        @Override 
     219        public String toString() { 
     220                return "Relationship [name=" + name + ", fromTable=" + fromTable + ", toTable=" + toTable + "]"; 
     221        } 
    196222         
    197223         
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/global_library.vm

    r8064 r8084  
     1 
     2#macro ( associationTableName $associationTable) 
     3#set ($rn = ${associationTable.rightTable.associatedClass.name.toLowerCase()}) 
     4#set ($ln = ${associationTable.leftTable.associatedClass.name.toLowerCase()}) 
     5${rn}_${ln}#end 
     6 
    17#macro( substituteClassType $typeName) 
    28#if($typeName.equals('CharacterString')) 
     
    713#end 
    814 
    9 #macro( substituteDBType $typeName) 
    10 #if($typeName.equals('CharacterString')) 
    11 TEXT#elseif($typeName.equals('Character')) 
    12 TEXT#elseif($typeName.equals('Integer')) 
    13 Integer#elseif($typeName.equals('Boolean')) 
    14 BOOLEAN#elseif($typeName.equals('Real')) 
    15 NUMERIC#elseif($typeName.equals('Vector')) 
    16 ARRAY#elseif($typeName.equals('Number')) 
    17 NUMERIC#else 
    18 ${typeName} 
    19 #end 
    20 #end 
    21  
    2215#macro( tableName $tableModel) 
    2316${tableModel.associatedClass.name.toLowerCase()}_table#end 
    2417 
    2518#macro( relationColumns $tableModel) 
     19#set ($tmn = $tableModel.associatedClass.name) 
     20#set ($ft = $tmn) 
    2621#foreach( $relation in $tableModel.relationship) 
    27         #relationColumn($tableModel, $relation)#if($foreach.hasNext),#end 
    28 #end 
    29 #foreach( $attribute in $tableModel.associatedClassModel.attributeModel) 
    30 #if($attribute.subTypes) 
    31 #foreach($sType in $attribute.subTypes) 
    32 '_${sType.associatedClass.name.toLowerCase()}': relationship(${sType.associatedClass.name}, uselist=False, backref='${tableModel.associatedClassModel.associatedClass.name.toLowerCase()}_${attribute.name}')#if($foreach.hasNext),#end 
    33 #end 
    34 #end     
     22#relationColumn($tableModel, $relation, $foreach.hasNext) 
    3523#end 
    3624#end 
    3725 
    38 #macro(relationColumn $tableModel, $relation) 
     26 
     27#macro(relationColumn $tableModel, $relation, $hasNext) 
    3928#set ($tt = $relation.toTable.associatedClass.name) 
    4029#set ($ft = $relation.fromTable.associatedClass.name) 
    4130#set ($tmn = $tableModel.associatedClass.name) 
    42 #if ($relation.isManyToMany() && !$relation.useList) 
    43 '${relation.name}': relationship(${tt},  
    44 secondary=${tt.toLowerCase()}_${ft.toLowerCase()}_table 
    45 #if ($relation.backrefName), backref='${relation.backrefName}' #end 
     31#if ($relation.isManyToMany()) 
     32'${relation.name}': relationship(${tt}, secondary=#associationTableName($relation.associationTable)_table)#if($hasNext),#end 
    4633#elseif($relation.isOneToMany()) 
    47 '${relation.name}': relationship(${tt} 
     34'${relation.name}': relationship(${tt}, primaryjoin=${tt.toLowerCase()}_table.c.${ft.toLowerCase()}_${relation.name.toLowerCase()}==${tmn.toLowerCase()}_table.c.id)#if($hasNext),#end 
    4835#elseif($relation.isOneToOne()) 
    49 '${relation.name}': relationship(${tt}#end 
    50 #if($relation.isOneToOne() || !$relation.useList) 
    51 , uselist=False, backref='${tmn.toLowerCase()}_${relation.name}' 
     36'${relation.name}': relationship(${tt}, uselist=False, backref='${relation.backrefName}', primaryjoin=${tt.toLowerCase()}_table.c.${ft.toLowerCase()}_${relation.name.toLowerCase()}_id==${tmn.toLowerCase()}_table.c.id)#if($hasNext),#end 
    5237#end 
    5338#if($tt == $tmn) 
    5439, remote_side=[${tmn.toLowerCase()}_table.c.${tmn.toLowerCase()}_id] 
    55 #else 
    5640#end 
    57 #if($relation.isOneToMany()) 
    58 , primaryjoin=${tt.toLowerCase()}_table.c.${ft.toLowerCase()}_${relation.name.toLowerCase()}==${tmn.toLowerCase()}_table.c.id 
    5941#end 
    60 #if($relation.isOneToOne() || !$relation.useList) 
    61 , primaryjoin=${tt.toLowerCase()}_table.c.${ft.toLowerCase()}_${relation.name.toLowerCase()}_id==${tmn.toLowerCase()}_table.c.id 
    62 #end 
    63 )#end 
    6442 
    6543 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/log4j.xml

    r7974 r8084  
    3232    </category> 
    3333     
     34    <category name="ndg.services.newmoon.velocity.python.GenerateTables" additivity="false"> 
     35        <priority value="warn"/> 
     36        <appender-ref ref="nmAppender"/> 
     37    </category> 
    3438    <!-- Section: ROOT logger --> 
    3539     
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/association.vm

    r8040 r8084  
    22#set ($rn = ${associationTable.rightTable.associatedClass.name.toLowerCase()}) 
    33#set ($ln = ${associationTable.leftTable.associatedClass.name.toLowerCase()}) 
    4 #set ($totalName = "${rn}_${ln}") 
    5 ${totalName}_table = Table('${totalName}', metadata, 
     4#set ($totalName = "#associationTableName($associationTable)") 
     5${totalName}_table = Table('#associationTableName($associationTable)', metadata, 
    66${tab}Column('left_node_id', Integer, ForeignKey(${rn}_table.c.id)), 
    77${tab}Column('right_node_id', Integer, ForeignKey(${ln}_table.c.id)) 
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/pythonClass.vm

    r8064 r8084  
    99#set ($object = "object") 
    1010#set ($newline = '\n') 
    11 #macro( superclass $superclasses, $stereotype) 
     11#macro( superclass $cm, $stereotype) 
     12#set ($superclasses = $cm.parents) 
    1213#if($superclasses.size() == 0 && !$stereotype) 
    1314$object#elseif($stereotype && $superclasses.size() == 0) 
    1415${stereotype.name}#elseif($superclasses.size() > 0) 
    15 #foreach( $classModel in $superclasses) 
     16#foreach( $classModel in $vh.getOrderedParents($cm)) 
    1617##${classModel.associatedClass.name}#if($foreach.hasNext),#end 
    17 ${vh.getMappedClass(${classModel.associatedClass.name})}#if($foreach.hasNext),#end 
     18${vh.getMappedClass(${classModel.associatedClass})}#if($foreach.hasNext),#end 
    1819#end 
    1920#end 
     
    3839#macro (unionDictionary $attributeModel) 
    3940#foreach($item in $attributeModel) 
    40 '${item.name}':${vh.getMappedClass(${item.associatedType.associatedClass.name})}#if($foreach.hasNext),#end   
     41'${item.name}':${vh.getMappedClass(${item.associatedType.associatedClass})}#if($foreach.hasNext),#end   
    4142#end 
    4243#end 
     
    5051#end 
    5152 
    52 #macro (getter $attribute) 
    53 #set ( $methodName = "$display.capitalize( $attribute.name )") 
    54 #if($attribute.getParentName()) 
     53#macro (getter $attr) 
     54#set ( $methodName = "$display.capitalize( $attr.name )") 
     55#if($attr.getParentName() || $attr.subTypes) 
    5556${tab}@property 
    56 ${tab}def ${attribute.name}(self): 
    57 ${tab}${tab}return self._${attribute.getParentName().toLowerCase()}.${attribute.name} 
    58 #end 
    59 #if($attribute.subTypes) 
    60 ${tab}@property 
    61 ${tab}def ${attribute.name}(self): 
    62 #foreach($type in $attribute.subTypes) 
     57${tab}def ${attr.name}(self): 
     58#if($attr.getParentName()) 
     59${tab}${tab}return self._${attr.getParentName().toLowerCase()}.${attr.name} 
     60#elseif($attr.subTypes) 
     61#foreach($type in $attr.subTypes) 
    6362#set ( $assoClass = "$type.associatedClass.name.toLowerCase()") 
    64 ${tab}${tab}if(self._$assoClass is not None): 
    65 ${tab}${tab}${tab}return self._$assoClass 
     63${tab}${tab}if(self._${attribute.name}_$assoClass is not None): 
     64${tab}${tab}${tab}return self._${attribute.name}_$assoClass 
    6665#end 
    6766${tab}${tab}return None 
    6867#end 
    6968#end 
     69#end 
    7070 
    71 #macro(saSetter $type, $sTypes) 
    72 #foreach($stype in $sTypes) 
     71#macro(saSetter $type, $attr) 
     72#foreach($stype in $attr.subTypes) 
    7373#if(!$stype.equals($type)) 
    74 ${tab}${tab}${tab}self._${stype.associatedClass.name.toLowerCase()}#initAttributeLeft($stype) 
     74${tab}${tab}${tab}self._${attr.name}_${stype.associatedClass.name.toLowerCase()}#initAttributeLeft($stype) 
    7575#end 
    7676#end 
     
    8383#end 
    8484 
    85 #macro (setter $attribute) 
    86 #set ( $methodName = "$display.capitalize( $attribute.name )") 
    87 #if($attribute.getParentName()) 
    88 ${tab}@${attribute.name}.setter 
    89 ${tab}def ${attribute.name}(self, value): 
    90 ${tab}${tab}${tab} self._${attribute.getParentName().toLowerCase()}.${attribute.name} = value 
    91 #end 
    92 #if($attribute.subTypes) 
    93 ${tab}@${attribute.name}.setter 
    94 ${tab}def ${attribute.name}(self, value): 
    95 #foreach($type in $attribute.subTypes) 
     85#macro (setter $attr) 
     86#set ( $methodName = "$display.capitalize( $attr.name )") 
     87#if($attr.getParentName() || $attr.subTypes) 
     88${tab}@${attr.name}.setter 
     89${tab}def ${attr.name}(self, value): 
     90#if($attr.getParentName()) 
     91${tab}${tab}${tab} self._${attr.getParentName().toLowerCase()}.${attr.name} = value 
     92#elseif($attr.subTypes) 
     93${tab}${tab}valueClass = "%s.%s" % (type(value).__module__,type(value).__name__) 
     94#foreach($type in $attr.subTypes) 
    9695#set ( $assoClass = "$type.associatedClass.name") 
    9796#set ( $assoClassL = "$type.associatedClass.name.toLowerCase()") 
    98 ${tab}${tab}if isinstance(value, $assoClass): 
    99 ${tab}${tab}${tab}self._$assoClassL = value 
    100 #saSetter($type, $attribute.subTypes) 
     97${tab}${tab}if valueClass == "${vh.getMappedModule($type.associatedClass)}.${assoClass}": 
     98${tab}${tab}${tab}self._${attr.name}_$assoClassL = value 
     99#saSetter($type, $attr) 
     100#end 
    101101#end 
    102102#end 
     
    112112#end 
    113113 
    114 #macro( subTypes $subTypes) 
    115 #foreach($type in $subTypes) 
    116 ${tab}${tab}self._${type.associatedClass.name.toLowerCase()}#initAttributeLeft($type) 
     114#macro( subTypes $attribute) 
     115#foreach($type in $attribute.subTypes) 
     116${tab}${tab}self._${attribute.name}_${type.associatedClass.name.toLowerCase()}#initAttributeLeft($attribute) 
    117117#end 
    118118#end 
     
    121121#if($parents) 
    122122#foreach( $parent in $parents) 
    123 ${tab}${tab}self._${parent.associatedClass.name.toLowerCase()} = ${vh.getMappedClass(${parent.associatedClass.name})}()          
     123${tab}${tab}self._${parent.associatedClass.name.toLowerCase()} = ${vh.getMappedClass($parent.associatedClass)}()         
    124124#end 
    125125#end 
     
    127127#foreach($attribute in $attributes) 
    128128#if($attribute.subTypes) 
    129 #subTypes($attribute.subTypes) 
     129#subTypes($attribute) 
    130130#else 
    131131${tab}${tab}self.${attribute.name}#initAttributeLeft($attribute) 
     
    143143''' 
    144144 
    145 class ${classModel.associatedClass.name}(#superclass($classModel.parents, $stereotype)): 
     145class ${classModel.associatedClass.name}(#superclass($classModel, $stereotype)): 
    146146${tab}''' 
    147147${tab}${tab}Represents a data entity defined in a UML diagram and supposed to  
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/sqlAlchemyTables.vm

    r8064 r8084  
    55########################################################################## 
    66 
    7 #macro( attributeType $attribute) 
    8 #if(!$attribute.associatedType.associatedClass.name.equalsIgnoreCase('boolean') 
    9 && ($attribute.associatedType.isCodeList() || $attribute.associatedType.isEnumeration())) 
    10 ${attribute.associatedType.associatedClass.name}.db_type()#elseif($attribute.hasMultiplicity()) 
    11 ARRAY(#substituteDBType(${attribute.associatedType.associatedClass.name}))#else 
    12 #substituteDBType(${attribute.associatedType.associatedClass.name})#end 
    13 #end 
     7##macro( attributeType $attribute) 
     8##if(!$attribute.associatedType.associatedClass.name.equalsIgnoreCase('boolean') 
     9##&& ($attribute.associatedType.isCodeList() || $attribute.associatedType.isEnumeration())) 
     10##${attribute.associatedType.associatedClass.name}.db_type() 
     11##else${vh.substituteDBType($attribute)}#end 
     12##end 
    1413 
    1514#macro(checkUseAlter $fk, $fkName, $relName) 
    16 #if($fk.useAlter) 
    1715, use_alter=True, name='fk_${fkName}_${relName}'#end 
    18 #end 
    1916 
    2017#macro( fk $foreignKey, $tableModel) 
     
    4542 
    4643#macro( column $attribute) 
    47 Column('${attribute.name}', #attributeType(${attribute}) #checkNullable($attribute)), 
     44Column('${attribute.name}', ${vh.substituteDBType($attribute)} #checkNullable($attribute)), 
    4845#end 
    4946 
     
    5350#foreach($sType in $attribute.subTypes) 
    5451#set ($associatedCN = ${sType.associatedClass.name.toLowerCase()}) 
    55 Column('_${associatedCN}_id', Integer, ForeignKey('${associatedCN}.id')), 
     52Column('_${attribute.name}_${associatedCN}_id', Integer, ForeignKey('${associatedCN}.id')), 
    5653#end 
    5754#end     
     
    6461#primaryKey($tableModel) 
    6562#foreach( $foreignKey in $tableModel.fk) 
    66 ${tab}#fk($foreignKey, $tableModel) 
     63#fk($foreignKey, $tableModel) 
    6764#end 
    6865#foreach( $attribute in $tableModel.attributeModel) 
    69 ${tab}#column($attribute) 
     66#column($attribute) 
    7067#end 
    71 ${tab}#superColumn($tableModel) 
     68##${tab}#superColumn($tableModel) 
    7269${tab}extend_existing=False,) 
    7370#end 
  • mauRepo/xmi2sqlalchemy/trunk/src/test/java/ngn/services/newmoon/DOMParser.java

    r8060 r8084  
    6363                 
    6464         
    65         //@Test 
     65        @Test 
    6666        public final void testParseXmlFile() { 
    6767                //InputStream inputXML = NmParser.class.getClassLoader().getResourceAsStream("CEDA_Model/CEDA_ModelXMI.xml"); 
  • mauRepo/xmi2sqlalchemy/trunk/src/test/java/ngn/services/newmoon/TestsTester.java

    r8064 r8084  
    6262        } 
    6363                 
    64         @Test 
     64        //@Test 
    6565        public final void parseTestFiles() { 
    6666 
  • mauRepo/xmi2sqlalchemy/trunk/src/test/resources/removeAll

    r8064 r8084  
    1919 ORDER BY 1;   
    2020 
    21 "DROP SEQUENCE IF EXISTS any_id_seq CASCADE;" 
    22 "DROP SEQUENCE IF EXISTS cc_concatenatedoperation_id_seq CASCADE;" 
    23 "DROP SEQUENCE IF EXISTS cc_conversion_id_seq CASCADE;" 
    24 "DROP SEQUENCE IF EXISTS cc_coordinateoperation_id_seq CASCADE;" 
    25 "DROP SEQUENCE IF EXISTS cc_formula_id_seq CASCADE;" 
    26 "DROP SEQUENCE IF EXISTS cc_generaloperationparameter_id_seq CASCADE;" 
    27 "DROP SEQUENCE IF EXISTS cc_generalparametervalue_id_seq CASCADE;" 
    28 "DROP SEQUENCE IF EXISTS cc_operationmethod_id_seq CASCADE;" 
    29 "DROP SEQUENCE IF EXISTS cc_operationparametergroup_id_seq CASCADE;" 
    30 "DROP SEQUENCE IF EXISTS cc_parametervaluegroup_id_seq CASCADE;" 
    31 "DROP SEQUENCE IF EXISTS cc_passthroughoperation_id_seq CASCADE;" 
    32 "DROP SEQUENCE IF EXISTS cc_singleoperation_id_seq CASCADE;" 
    33 "DROP SEQUENCE IF EXISTS cd_datum_id_seq CASCADE;" 
    34 "DROP SEQUENCE IF EXISTS cd_verticaldatum_id_seq CASCADE;" 
    35 "DROP SEQUENCE IF EXISTS ceda_acquisition_id_seq CASCADE;" 
    36 "DROP SEQUENCE IF EXISTS ceda_citation_id_seq CASCADE;" 
    37 "DROP SEQUENCE IF EXISTS ceda_compositeprocess_id_seq CASCADE;" 
    38 "DROP SEQUENCE IF EXISTS ceda_instrument_id_seq CASCADE;" 
    39 "DROP SEQUENCE IF EXISTS ceda_notes_id_seq CASCADE;" 
    40 "DROP SEQUENCE IF EXISTS ceda_observationcollection_id_seq CASCADE;" 
    41 "DROP SEQUENCE IF EXISTS ceda_observation_id_seq CASCADE;" 
    42 "DROP SEQUENCE IF EXISTS ceda_operation_id_seq CASCADE;" 
    43 "DROP SEQUENCE IF EXISTS ceda_platform_id_seq CASCADE;" 
    44 "DROP SEQUENCE IF EXISTS ceda_process_id_seq CASCADE;" 
    45 "DROP SEQUENCE IF EXISTS ceda_processing_id_seq CASCADE;" 
    46 "DROP SEQUENCE IF EXISTS ceda_project_id_seq CASCADE;" 
    47 "DROP SEQUENCE IF EXISTS ceda_result_id_seq CASCADE;" 
    48 "DROP SEQUENCE IF EXISTS ceda_review_id_seq CASCADE;" 
    49 "DROP SEQUENCE IF EXISTS ci_address_id_seq CASCADE;" 
    50 "DROP SEQUENCE IF EXISTS ci_citation_id_seq CASCADE;" 
    51 "DROP SEQUENCE IF EXISTS ci_contact_id_seq CASCADE;" 
    52 "DROP SEQUENCE IF EXISTS ci_date_id_seq CASCADE;" 
    53 "DROP SEQUENCE IF EXISTS ci_individual_id_seq CASCADE;" 
    54 "DROP SEQUENCE IF EXISTS ci_onlineresource_id_seq CASCADE;" 
    55 "DROP SEQUENCE IF EXISTS ci_organisation_id_seq CASCADE;" 
    56 "DROP SEQUENCE IF EXISTS ci_party_id_seq CASCADE;" 
    57 "DROP SEQUENCE IF EXISTS ci_responsibility_id_seq CASCADE;" 
    58 "DROP SEQUENCE IF EXISTS ci_responsibleparty_id_seq CASCADE;" 
    59 "DROP SEQUENCE IF EXISTS ci_responsiblepartyinfo_id_seq CASCADE;" 
    60 "DROP SEQUENCE IF EXISTS ci_series_id_seq CASCADE;" 
    61 "DROP SEQUENCE IF EXISTS ci_telephone_id_seq CASCADE;" 
    62 "DROP SEQUENCE IF EXISTS class13_0_id_seq CASCADE;" 
    63 "DROP SEQUENCE IF EXISTS class13_1_id_seq CASCADE;" 
    64 "DROP SEQUENCE IF EXISTS class13_2_id_seq CASCADE;" 
    65 "DROP SEQUENCE IF EXISTS class13_3_id_seq CASCADE;" 
    66 "DROP SEQUENCE IF EXISTS cl_dataset_id_seq CASCADE;" 
    67 "DROP SEQUENCE IF EXISTS clocktime_id_seq CASCADE;" 
    68 "DROP SEQUENCE IF EXISTS cs_coordinatesystemaxis_id_seq CASCADE;" 
    69 "DROP SEQUENCE IF EXISTS cs_coordinatesystem_id_seq CASCADE;" 
    70 "DROP SEQUENCE IF EXISTS cs_verticalcs_id_seq CASCADE;" 
    71 "DROP SEQUENCE IF EXISTS cv_attributevalues_id_seq CASCADE;" 
    72 "DROP SEQUENCE IF EXISTS cv_coverage_id_seq CASCADE;" 
    73 "DROP SEQUENCE IF EXISTS cv_domainobject_id_seq CASCADE;" 
    74 "DROP SEQUENCE IF EXISTS cv_footprint_id_seq CASCADE;" 
    75 "DROP SEQUENCE IF EXISTS cv_gridcell_id_seq CASCADE;" 
    76 "DROP SEQUENCE IF EXISTS cv_gridcoordinate_id_seq CASCADE;" 
    77 "DROP SEQUENCE IF EXISTS cv_gridenvelope_id_seq CASCADE;" 
    78 "DROP SEQUENCE IF EXISTS cv_grid_id_seq CASCADE;" 
    79 "DROP SEQUENCE IF EXISTS cv_gridpoint_id_seq CASCADE;" 
    80 "DROP SEQUENCE IF EXISTS cv_referenceablegrid_id_seq CASCADE;" 
    81 "DROP SEQUENCE IF EXISTS date_id_seq CASCADE;" 
    82 "DROP SEQUENCE IF EXISTS dateprecision_id_seq CASCADE;" 
    83 "DROP SEQUENCE IF EXISTS datetime_id_seq CASCADE;" 
    84 "DROP SEQUENCE IF EXISTS directposition_id_seq CASCADE;" 
    85 "DROP SEQUENCE IF EXISTS distance_id_seq CASCADE;" 
    86 "DROP SEQUENCE IF EXISTS dq_dataquality_id_seq CASCADE;" 
    87 "DROP SEQUENCE IF EXISTS dq_element_id_seq CASCADE;" 
    88 "DROP SEQUENCE IF EXISTS dq_positionalaccuracy_id_seq CASCADE;" 
    89 "DROP SEQUENCE IF EXISTS dq_result_id_seq CASCADE;" 
    90 "DROP SEQUENCE IF EXISTS dq_scope_id_seq CASCADE;" 
    91 "DROP SEQUENCE IF EXISTS ds_aggregate_id_seq CASCADE;" 
    92 "DROP SEQUENCE IF EXISTS ds_dataset_id_seq CASCADE;" 
    93 "DROP SEQUENCE IF EXISTS earootclass_id_seq CASCADE;" 
    94 "DROP SEQUENCE IF EXISTS ex_extent_id_seq CASCADE;" 
    95 "DROP SEQUENCE IF EXISTS ex_geographicdescription_id_seq CASCADE;" 
    96 "DROP SEQUENCE IF EXISTS ex_geographicextent_id_seq CASCADE;" 
    97 "DROP SEQUENCE IF EXISTS ex_temporalextent_id_seq CASCADE;" 
    98 "DROP SEQUENCE IF EXISTS ex_verticalextent_id_seq CASCADE;" 
    99 "DROP SEQUENCE IF EXISTS genericname_id_seq CASCADE;" 
    100 "DROP SEQUENCE IF EXISTS gf_associationrole_id_seq CASCADE;" 
    101 "DROP SEQUENCE IF EXISTS gf_associationtype_id_seq CASCADE;" 
    102 "DROP SEQUENCE IF EXISTS gf_attributetype_id_seq CASCADE;" 
    103 "DROP SEQUENCE IF EXISTS gf_constraint_id_seq CASCADE;" 
    104 "DROP SEQUENCE IF EXISTS gf_featuretype_id_seq CASCADE;" 
    105 "DROP SEQUENCE IF EXISTS gfi_feature_id_seq CASCADE;" 
    106 "DROP SEQUENCE IF EXISTS gf_inheritancerelation_id_seq CASCADE;" 
    107 "DROP SEQUENCE IF EXISTS gf_operation_id_seq CASCADE;" 
    108 "DROP SEQUENCE IF EXISTS gf_propertytype_id_seq CASCADE;" 
    109 "DROP SEQUENCE IF EXISTS gm_complex_id_seq CASCADE;" 
    110 "DROP SEQUENCE IF EXISTS gm_composite_id_seq CASCADE;" 
    111 "DROP SEQUENCE IF EXISTS gm_compositepoint_id_seq CASCADE;" 
    112 "DROP SEQUENCE IF EXISTS gm_object_id_seq CASCADE;" 
    113 "DROP SEQUENCE IF EXISTS gm_orientableprimitive_id_seq CASCADE;" 
    114 "DROP SEQUENCE IF EXISTS gm_point_id_seq CASCADE;" 
    115 "DROP SEQUENCE IF EXISTS gm_primitive_id_seq CASCADE;" 
    116 "DROP SEQUENCE IF EXISTS io_identifiedobjectbase_id_seq CASCADE;" 
    117 "DROP SEQUENCE IF EXISTS io_identifiedobject_id_seq CASCADE;" 
    118 "DROP SEQUENCE IF EXISTS le_algorithm_id_seq CASCADE;" 
    119 "DROP SEQUENCE IF EXISTS length_id_seq CASCADE;" 
    120 "DROP SEQUENCE IF EXISTS le_nominalresolution_id_seq CASCADE;" 
    121 "DROP SEQUENCE IF EXISTS le_source_id_seq CASCADE;" 
    122 "DROP SEQUENCE IF EXISTS li_lineage_id_seq CASCADE;" 
    123 "DROP SEQUENCE IF EXISTS li_processstep_id_seq CASCADE;" 
    124 "DROP SEQUENCE IF EXISTS li_source_id_seq CASCADE;" 
    125 "DROP SEQUENCE IF EXISTS localname_id_seq CASCADE;" 
    126 "DROP SEQUENCE IF EXISTS md_aggregateinformation_id_seq CASCADE;" 
    127 "DROP SEQUENCE IF EXISTS md_applicationschemainformation_id_seq CASCADE;" 
    128 "DROP SEQUENCE IF EXISTS md_browsegraphic_id_seq CASCADE;" 
    129 "DROP SEQUENCE IF EXISTS md_constraints_id_seq CASCADE;" 
    130 "DROP SEQUENCE IF EXISTS md_contentinformation_id_seq CASCADE;" 
    131 "DROP SEQUENCE IF EXISTS md_digitaltransferoptions_id_seq CASCADE;" 
    132 "DROP SEQUENCE IF EXISTS md_distribution_id_seq CASCADE;" 
    133 "DROP SEQUENCE IF EXISTS md_distributor_id_seq CASCADE;" 
    134 "DROP SEQUENCE IF EXISTS md_extendedelementinformation_id_seq CASCADE;" 
    135 "DROP SEQUENCE IF EXISTS md_format_id_seq CASCADE;" 
    136 "DROP SEQUENCE IF EXISTS md_identification_id_seq CASCADE;" 
    137 "DROP SEQUENCE IF EXISTS md_identifier_id_seq CASCADE;" 
    138 "DROP SEQUENCE IF EXISTS md_keywords_id_seq CASCADE;" 
    139 "DROP SEQUENCE IF EXISTS md_maintenanceinformation_id_seq CASCADE;" 
    140 "DROP SEQUENCE IF EXISTS md_medium_id_seq CASCADE;" 
    141 "DROP SEQUENCE IF EXISTS md_metadataextensioninformation_id_seq CASCADE;" 
    142 "DROP SEQUENCE IF EXISTS md_metadata_id_seq CASCADE;" 
    143 "DROP SEQUENCE IF EXISTS md_portrayalcataloguereference_id_seq CASCADE;" 
    144 "DROP SEQUENCE IF EXISTS md_referencesystem_id_seq CASCADE;" 
    145 "DROP SEQUENCE IF EXISTS md_representativefraction_id_seq CASCADE;" 
    146 "DROP SEQUENCE IF EXISTS md_scopedescription_id_seq CASCADE;" 
    147 "DROP SEQUENCE IF EXISTS md_spatialrepresentation_id_seq CASCADE;" 
    148 "DROP SEQUENCE IF EXISTS md_standardorderprocess_id_seq CASCADE;" 
    149 "DROP SEQUENCE IF EXISTS md_usage_id_seq CASCADE;" 
    150 "DROP SEQUENCE IF EXISTS measure_id_seq CASCADE;" 
    151 "DROP SEQUENCE IF EXISTS mo_acquisition_id_seq CASCADE;" 
    152 "DROP SEQUENCE IF EXISTS mo_compositeprocess_id_seq CASCADE;" 
    153 "DROP SEQUENCE IF EXISTS mo_computation_id_seq CASCADE;" 
    154 "DROP SEQUENCE IF EXISTS mo_inputoutput_id_seq CASCADE;" 
    155 "DROP SEQUENCE IF EXISTS mo_instrument_id_seq CASCADE;" 
    156 "DROP SEQUENCE IF EXISTS mo_instrumentplatformpair_id_seq CASCADE;" 
    157 "DROP SEQUENCE IF EXISTS mo_location_id_seq CASCADE;" 
    158 "DROP SEQUENCE IF EXISTS mo_observationcollection_id_seq CASCADE;" 
    159 "DROP SEQUENCE IF EXISTS mo_observation_id_seq CASCADE;" 
    160 "DROP SEQUENCE IF EXISTS mo_onlineresource_id_seq CASCADE;" 
    161 "DROP SEQUENCE IF EXISTS mo_operation_id_seq CASCADE;" 
    162 "DROP SEQUENCE IF EXISTS mo_organization_id_seq CASCADE;" 
    163 "DROP SEQUENCE IF EXISTS mo_platform_id_seq CASCADE;" 
    164 "DROP SEQUENCE IF EXISTS mo_process_id_seq CASCADE;" 
    165 "DROP SEQUENCE IF EXISTS mo_processing_id_seq CASCADE;" 
    166 "DROP SEQUENCE IF EXISTS mo_project_id_seq CASCADE;" 
    167 "DROP SEQUENCE IF EXISTS mo_responsiblepartyinfo_id_seq CASCADE;" 
    168 "DROP SEQUENCE IF EXISTS mo_result_id_seq CASCADE;" 
    169 "DROP SEQUENCE IF EXISTS multiplicity_id_seq CASCADE;" 
    170 "DROP SEQUENCE IF EXISTS multiplicityrange_id_seq CASCADE;" 
    171 "DROP SEQUENCE IF EXISTS namedvalue_id_seq CASCADE;" 
    172 "DROP SEQUENCE IF EXISTS namespace_id_seq CASCADE;" 
    173 "DROP SEQUENCE IF EXISTS om_observation_id_seq CASCADE;" 
    174 "DROP SEQUENCE IF EXISTS om_process_id_seq CASCADE;" 
    175 "DROP SEQUENCE IF EXISTS record_id_seq CASCADE;" 
    176 "DROP SEQUENCE IF EXISTS recordtype_id_seq CASCADE;" 
    177 "DROP SEQUENCE IF EXISTS rs_identifier_id_seq CASCADE;" 
    178 "DROP SEQUENCE IF EXISTS rs_referencesystem_id_seq CASCADE;" 
    179 "DROP SEQUENCE IF EXISTS scale_id_seq CASCADE;" 
    180 "DROP SEQUENCE IF EXISTS sc_compoundcrs_id_seq CASCADE;" 
    181 "DROP SEQUENCE IF EXISTS sc_crs_id_seq CASCADE;" 
    182 "DROP SEQUENCE IF EXISTS sc_derivedcrs_id_seq CASCADE;" 
    183 "DROP SEQUENCE IF EXISTS sc_generalderivedcrs_id_seq CASCADE;" 
    184 "DROP SEQUENCE IF EXISTS schema_id_seq CASCADE;" 
    185 "DROP SEQUENCE IF EXISTS scopedname_id_seq CASCADE;" 
    186 "DROP SEQUENCE IF EXISTS sc_singlecrs_id_seq CASCADE;" 
    187 "DROP SEQUENCE IF EXISTS sc_verticalcrs_id_seq CASCADE;" 
    188 "DROP SEQUENCE IF EXISTS time_id_seq CASCADE;" 
    189 "DROP SEQUENCE IF EXISTS tm_complex_id_seq CASCADE;" 
    190 "DROP SEQUENCE IF EXISTS tm_duration_id_seq CASCADE;" 
    191 "DROP SEQUENCE IF EXISTS tm_edge_id_seq CASCADE;" 
    192 "DROP SEQUENCE IF EXISTS tm_geometricprimitive_id_seq CASCADE;" 
    193 "DROP SEQUENCE IF EXISTS tm_instant_id_seq CASCADE;" 
    194 "DROP SEQUENCE IF EXISTS tm_node_id_seq CASCADE;" 
    195 "DROP SEQUENCE IF EXISTS tm_object_id_seq CASCADE;" 
    196 "DROP SEQUENCE IF EXISTS tm_periodduration_id_seq CASCADE;" 
    197 "DROP SEQUENCE IF EXISTS tm_period_id_seq CASCADE;" 
    198 "DROP SEQUENCE IF EXISTS tm_position_id_seq CASCADE;" 
    199 "DROP SEQUENCE IF EXISTS tm_primitive_id_seq CASCADE;" 
    200 "DROP SEQUENCE IF EXISTS tm_referencesystem_id_seq CASCADE;" 
    201 "DROP SEQUENCE IF EXISTS tm_temporalposition_id_seq CASCADE;" 
    202 "DROP SEQUENCE IF EXISTS tm_topologicalcomplex_id_seq CASCADE;" 
    203 "DROP SEQUENCE IF EXISTS tm_topologicalprimitive_id_seq CASCADE;" 
    204 "DROP SEQUENCE IF EXISTS tp_complex_id_seq CASCADE;" 
    205 "DROP SEQUENCE IF EXISTS tp_directedtopo_id_seq CASCADE;" 
    206 "DROP SEQUENCE IF EXISTS tp_expression_id_seq CASCADE;" 
    207 "DROP SEQUENCE IF EXISTS tp_expressionterm_id_seq CASCADE;" 
    208 "DROP SEQUENCE IF EXISTS tp_primitive_id_seq CASCADE;" 
    209 "DROP SEQUENCE IF EXISTS type_id_seq CASCADE;" 
    210 "DROP SEQUENCE IF EXISTS typename_id_seq CASCADE;" 
    211 "DROP SEQUENCE IF EXISTS unitofmeasure_id_seq CASCADE;" 
    212 "DROP SEQUENCE IF EXISTS unlimitedinteger_id_seq CASCADE;" 
    213 "DROP SEQUENCE IF EXISTS uomlength_id_seq CASCADE;" 
    214 "DROP SEQUENCE IF EXISTS uomscale_id_seq CASCADE;" 
    215 "DROP SEQUENCE IF EXISTS url_id_seq CASCADE;" 
     21DROP TABLE IF EXISTS angle CASCADE; 
     22DROP TABLE IF EXISTS "any" CASCADE; 
     23DROP TABLE IF EXISTS cc_concatenatedoperation CASCADE; 
     24DROP TABLE IF EXISTS cc_concatenatedoperation_cc_concatenatedoperation CASCADE; 
     25DROP TABLE IF EXISTS cc_conversion CASCADE; 
     26DROP TABLE IF EXISTS cc_coordinateoperation CASCADE; 
     27DROP TABLE IF EXISTS cc_formula CASCADE; 
     28DROP TABLE IF EXISTS cc_generaloperationparameter CASCADE; 
     29DROP TABLE IF EXISTS cc_generalparametervalue CASCADE; 
     30DROP TABLE IF EXISTS cc_operationmethod CASCADE; 
     31DROP TABLE IF EXISTS cc_operationparameter CASCADE; 
     32DROP TABLE IF EXISTS cc_operationparametergroup CASCADE; 
     33DROP TABLE IF EXISTS cc_operationparametergroup_cc_operationparametergroup CASCADE; 
     34DROP TABLE IF EXISTS cc_operationparametervalue CASCADE; 
     35DROP TABLE IF EXISTS cc_parametervalue CASCADE; 
     36DROP TABLE IF EXISTS cc_parametervaluegroup CASCADE; 
     37DROP TABLE IF EXISTS cc_parametervaluegroup_cc_parametervaluegroup CASCADE; 
     38DROP TABLE IF EXISTS cc_passthroughoperation CASCADE; 
     39DROP TABLE IF EXISTS cc_singleoperation CASCADE; 
     40DROP TABLE IF EXISTS cc_transformation CASCADE; 
     41DROP TABLE IF EXISTS cd_datum CASCADE; 
     42DROP TABLE IF EXISTS cd_ellipsoid CASCADE; 
     43DROP TABLE IF EXISTS cd_engineeringdatum CASCADE; 
     44DROP TABLE IF EXISTS cd_geodeticdatum CASCADE; 
     45DROP TABLE IF EXISTS cd_imagedatum CASCADE; 
     46DROP TABLE IF EXISTS cd_primemeridian CASCADE; 
     47DROP TABLE IF EXISTS cd_seconddefiningparameter CASCADE; 
     48DROP TABLE IF EXISTS cd_verticaldatum CASCADE; 
     49DROP TABLE IF EXISTS ceda_acquisition CASCADE; 
     50DROP TABLE IF EXISTS ceda_citation CASCADE; 
     51DROP TABLE IF EXISTS ceda_compositeprocess CASCADE; 
     52DROP TABLE IF EXISTS ceda_instrument CASCADE; 
     53DROP TABLE IF EXISTS ceda_notes CASCADE; 
     54DROP TABLE IF EXISTS ceda_observation CASCADE; 
     55DROP TABLE IF EXISTS ceda_observationcollection CASCADE; 
     56DROP TABLE IF EXISTS ceda_operation CASCADE; 
     57DROP TABLE IF EXISTS ceda_platform CASCADE; 
     58DROP TABLE IF EXISTS ceda_process CASCADE; 
     59DROP TABLE IF EXISTS ceda_processing CASCADE; 
     60DROP TABLE IF EXISTS ceda_project CASCADE; 
     61DROP TABLE IF EXISTS ceda_result CASCADE; 
     62DROP TABLE IF EXISTS ceda_review CASCADE; 
     63DROP TABLE IF EXISTS ci_address CASCADE; 
     64DROP TABLE IF EXISTS ci_citation CASCADE; 
     65DROP TABLE IF EXISTS ci_contact CASCADE; 
     66DROP TABLE IF EXISTS ci_date CASCADE; 
     67DROP TABLE IF EXISTS ci_individual CASCADE; 
     68DROP TABLE IF EXISTS ci_onlineresource CASCADE; 
     69DROP TABLE IF EXISTS ci_organisation CASCADE; 
     70DROP TABLE IF EXISTS ci_party CASCADE; 
     71DROP TABLE IF EXISTS ci_responsibility CASCADE; 
     72DROP TABLE IF EXISTS ci_responsibleparty CASCADE; 
     73DROP TABLE IF EXISTS ci_responsiblepartyinfo CASCADE; 
     74DROP TABLE IF EXISTS ci_series CASCADE; 
     75DROP TABLE IF EXISTS ci_telephone CASCADE; 
     76DROP TABLE IF EXISTS class08_4 CASCADE; 
     77DROP TABLE IF EXISTS class09_1 CASCADE; 
     78DROP TABLE IF EXISTS class09_2 CASCADE; 
     79DROP TABLE IF EXISTS class09_3 CASCADE; 
     80DROP TABLE IF EXISTS class09_4 CASCADE; 
     81DROP TABLE IF EXISTS class10_1 CASCADE; 
     82DROP TABLE IF EXISTS class12_1 CASCADE; 
     83DROP TABLE IF EXISTS class12_2 CASCADE; 
     84DROP TABLE IF EXISTS class12_3 CASCADE; 
     85DROP TABLE IF EXISTS class12_4 CASCADE; 
     86DROP TABLE IF EXISTS cl_classificationcollection CASCADE; 
     87DROP TABLE IF EXISTS cl_classificationcollection_cv_surfacevaluepair CASCADE; 
     88DROP TABLE IF EXISTS cl_dataset CASCADE; 
     89DROP TABLE IF EXISTS cl_dataset_md_metadata CASCADE; 
     90DROP TABLE IF EXISTS clocktime CASCADE; 
     91DROP TABLE IF EXISTS cs_affinecs CASCADE; 
     92DROP TABLE IF EXISTS cs_cartesiancs CASCADE; 
     93DROP TABLE IF EXISTS cs_coordinatesystemaxis CASCADE; 
     94DROP TABLE IF EXISTS cs_coordinatesystem CASCADE; 
     95DROP TABLE IF EXISTS cs_cylindricalcs CASCADE; 
     96DROP TABLE IF EXISTS cs_ellipsoidalcs CASCADE; 
     97DROP TABLE IF EXISTS cs_engineeringcs CASCADE; 
     98DROP TABLE IF EXISTS cs_geodeticcs CASCADE; 
     99DROP TABLE IF EXISTS cs_imagecs CASCADE; 
     100DROP TABLE IF EXISTS cs_linearcs CASCADE; 
     101DROP TABLE IF EXISTS cs_polarcs CASCADE; 
     102DROP TABLE IF EXISTS cs_sphericalcs CASCADE; 
     103DROP TABLE IF EXISTS cs_userdefinedcs CASCADE; 
     104DROP TABLE IF EXISTS cs_verticalcs CASCADE; 
     105DROP TABLE IF EXISTS cv_attributevalues CASCADE; 
     106DROP TABLE IF EXISTS cv_continuouscoverage CASCADE; 
     107DROP TABLE IF EXISTS cv_continuousquadrilateralgridcoverage CASCADE; 
     108DROP TABLE IF EXISTS cv_continuousquadrilateralgridcoverage_cv_gridvaluecell CASCADE; 
     109DROP TABLE IF EXISTS cv_continuousquadrilateralgridcoverage_cv_valueobject CASCADE; 
     110DROP TABLE IF EXISTS cv_coverage CASCADE; 
     111DROP TABLE IF EXISTS cv_curvevaluepair CASCADE; 
     112DROP TABLE IF EXISTS cv_curvevaluepair_cv_discretecoverage CASCADE; 
     113DROP TABLE IF EXISTS cv_curvevaluepair_cv_discretecurvecoverage CASCADE; 
     114DROP TABLE IF EXISTS cv_curvevaluepair_cv_valueobject CASCADE; 
     115DROP TABLE IF EXISTS cv_discretecoverage CASCADE; 
     116DROP TABLE IF EXISTS cv_discretecurvecoverage CASCADE; 
     117DROP TABLE IF EXISTS cv_discretecurvecoverage_cv_curvevaluepair CASCADE; 
     118DROP TABLE IF EXISTS cv_discretecurvecoverage_cv_geometryvaluepair CASCADE; 
     119DROP TABLE IF EXISTS cv_discretegridpointcoverage CASCADE; 
     120DROP TABLE IF EXISTS cv_discretegridpointcoverage_cv_geometryvaluepair CASCADE; 
     121DROP TABLE IF EXISTS cv_discretegridpointcoverage_cv_gridpointvaluepair CASCADE; 
     122DROP TABLE IF EXISTS cv_discretepointcoverage CASCADE; 
     123DROP TABLE IF EXISTS cv_discretepointcoverage_cv_geometryvaluepair CASCADE; 
     124DROP TABLE IF EXISTS cv_discretepointcoverage_cv_gridpointvaluepair CASCADE; 
     125DROP TABLE IF EXISTS cv_discretepointcoverage_cv_pointvaluepair CASCADE; 
     126DROP TABLE IF EXISTS cv_discretesolidcoverage CASCADE; 
     127DROP TABLE IF EXISTS cv_discretesolidcoverage_cv_geometryvaluepair CASCADE; 
     128DROP TABLE IF EXISTS cv_discretesolidcoverage_cv_solidvaluepair CASCADE; 
     129DROP TABLE IF EXISTS cv_discretesurfacecoverage CASCADE; 
     130DROP TABLE IF EXISTS cv_discretesurfacecoverage_cv_geometryvaluepair CASCADE; 
     131DROP TABLE IF EXISTS cv_discretesurfacecoverage_cv_surfacevaluepair CASCADE; 
     132DROP TABLE IF EXISTS cv_domainobject CASCADE; 
     133DROP TABLE IF EXISTS cv_domainobject_cv_coverage CASCADE; 
     134DROP TABLE IF EXISTS cv_footprint CASCADE; 
     135DROP TABLE IF EXISTS cv_footprint_cv_gridpoint CASCADE; 
     136DROP TABLE IF EXISTS cv_geometryvaluepair CASCADE; 
     137DROP TABLE IF EXISTS cv_grid CASCADE; 
     138DROP TABLE IF EXISTS cv_gridcell CASCADE; 
     139DROP TABLE IF EXISTS cv_gridcell_cv_grid CASCADE; 
     140DROP TABLE IF EXISTS cv_gridcell_cv_gridpoint CASCADE; 
     141DROP TABLE IF EXISTS cv_gridcoordinate CASCADE; 
     142DROP TABLE IF EXISTS cv_gridenvelope CASCADE; 
     143DROP TABLE IF EXISTS cv_gridpoint CASCADE; 
     144DROP TABLE IF EXISTS cv_gridpoint_cv_footprint CASCADE; 
     145DROP TABLE IF EXISTS cv_gridpoint_cv_grid CASCADE; 
     146DROP TABLE IF EXISTS cv_gridpoint_cv_gridcell CASCADE; 
     147DROP TABLE IF EXISTS cv_gridpoint_gm_point CASCADE; 
     148DROP TABLE IF EXISTS cv_gridpointvaluepair CASCADE; 
     149DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_discretecoverage CASCADE; 
     150DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_discretegridpointcoverage CASCADE; 
     151DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_discretepointcoverage CASCADE; 
     152DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_gridvaluecell CASCADE; 
     153DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_valuehexagon CASCADE; 
     154DROP TABLE IF EXISTS cv_gridpointvaluepair_cv_valueobject CASCADE; 
     155DROP TABLE IF EXISTS cv_gridvaluecell CASCADE; 
     156DROP TABLE IF EXISTS cv_gridvaluecell_cv_continuouscoverage CASCADE; 
     157DROP TABLE IF EXISTS cv_gridvaluecell_cv_continuousquadrilateralgridcoverage CASCADE; 
     158DROP TABLE IF EXISTS cv_gridvaluecell_cv_geometryvaluepair CASCADE; 
     159DROP TABLE IF EXISTS cv_gridvaluecell_cv_gridpointvaluepair CASCADE; 
     160DROP TABLE IF EXISTS cv_gridvaluesmatrix CASCADE; 
     161DROP TABLE IF EXISTS cv_hexagonalgridcoverage CASCADE; 
     162DROP TABLE IF EXISTS cv_hexagonalgridcoverage_cv_gridvaluesmatrix CASCADE; 
     163DROP TABLE IF EXISTS cv_hexagonalgridcoverage_cv_valuehexagon CASCADE; 
     164DROP TABLE IF EXISTS cv_hexagonalgridcoverage_cv_valueobject CASCADE; 
     165DROP TABLE IF EXISTS cv_pointvaluepair CASCADE; 
     166DROP TABLE IF EXISTS cv_pointvaluepair_cv_discretecoverage CASCADE; 
     167DROP TABLE IF EXISTS cv_pointvaluepair_cv_discretepointcoverage CASCADE; 
     168DROP TABLE IF EXISTS cv_pointvaluepair_cv_thiessenvaluepolygon CASCADE; 
     169DROP TABLE IF EXISTS cv_pointvaluepair_cv_valuecurve CASCADE; 
     170DROP TABLE IF EXISTS cv_pointvaluepair_cv_valueobject CASCADE; 
     171DROP TABLE IF EXISTS cv_rectifiedgrid CASCADE; 
     172DROP TABLE IF EXISTS cv_referenceablegrid CASCADE; 
     173DROP TABLE IF EXISTS cv_segmentedcurvecoverage CASCADE; 
     174DROP TABLE IF EXISTS cv_segmentedcurvecoverage_cv_valuecurve CASCADE; 
     175DROP TABLE IF EXISTS cv_segmentedcurvecoverage_cv_valueobject CASCADE; 
     176DROP TABLE IF EXISTS cv_sequencerule CASCADE; 
     177DROP TABLE IF EXISTS cv_solidvaluepair CASCADE; 
     178DROP TABLE IF EXISTS cv_solidvaluepair_cv_discretesolidcoverage CASCADE; 
     179DROP TABLE IF EXISTS cv_solidvaluepair_cv_valueobject CASCADE; 
     180DROP TABLE IF EXISTS cv_surfacevaluepair CASCADE; 
     181DROP TABLE IF EXISTS cv_surfacevaluepair_cl_classificationcollection CASCADE; 
     182DROP TABLE IF EXISTS cv_surfacevaluepair_cv_discretecoverage CASCADE; 
     183DROP TABLE IF EXISTS cv_surfacevaluepair_cv_discretesurfacecoverage CASCADE; 
     184DROP TABLE IF EXISTS cv_surfacevaluepair_cv_valueobject CASCADE; 
     185DROP TABLE IF EXISTS cvt_discretetimeinstantcoverage CASCADE; 
     186DROP TABLE IF EXISTS cvt_discretetimeinstantcoverage_cv_geometryvaluepair CASCADE; 
     187DROP TABLE IF EXISTS cvt_discretetimeinstantcoverage_cvt_timeinstantvaluepair CASCADE; 
     188DROP TABLE IF EXISTS cv_thiessenpolygoncoverage CASCADE; 
     189DROP TABLE IF EXISTS cv_thiessenpolygoncoverage_cv_thiessenvaluepolygon CASCADE; 
     190DROP TABLE IF EXISTS cv_thiessenpolygoncoverage_cv_valueobject CASCADE; 
     191DROP TABLE IF EXISTS cv_thiessenvaluepolygon CASCADE; 
     192DROP TABLE IF EXISTS cv_thiessenvaluepolygon_cv_continuouscoverage CASCADE; 
     193DROP TABLE IF EXISTS cv_thiessenvaluepolygon_cv_geometryvaluepair CASCADE; 
     194DROP TABLE IF EXISTS cv_thiessenvaluepolygon_cv_pointvaluepair CASCADE; 
     195DROP TABLE IF EXISTS cv_thiessenvaluepolygon_cv_thiessenpolygoncoverage CASCADE; 
     196DROP TABLE IF EXISTS cv_tincoverage CASCADE; 
     197DROP TABLE IF EXISTS cvt_timeinstantvaluepair CASCADE; 
     198DROP TABLE IF EXISTS cvt_timeinstantvaluepair_cv_discretecoverage CASCADE; 
     199DROP TABLE IF EXISTS cvt_timeinstantvaluepair_cvt_discretetimeinstantcoverage CASCADE; 
     200DROP TABLE IF EXISTS cvt_timeinstantvaluepair_cv_valueobject CASCADE; 
     201DROP TABLE IF EXISTS cv_valuecurve CASCADE; 
     202DROP TABLE IF EXISTS cv_valuecurve_cv_continuouscoverage CASCADE; 
     203DROP TABLE IF EXISTS cv_valuecurve_cv_geometryvaluepair CASCADE; 
     204DROP TABLE IF EXISTS cv_valuecurve_cv_pointvaluepair CASCADE; 
     205DROP TABLE IF EXISTS cv_valuecurve_cv_segmentedcurvecoverage CASCADE; 
     206DROP TABLE IF EXISTS cv_valuecurve_cv_valuesegment CASCADE; 
     207DROP TABLE IF EXISTS cv_valuehexagon CASCADE; 
     208DROP TABLE IF EXISTS cv_valuehexagon_cv_continuouscoverage CASCADE; 
     209DROP TABLE IF EXISTS cv_valuehexagon_cv_geometryvaluepair CASCADE; 
     210DROP TABLE IF EXISTS cv_valuehexagon_cv_gridpointvaluepair CASCADE; 
     211DROP TABLE IF EXISTS cv_valuehexagon_cv_hexagonalgridcoverage CASCADE; 
     212DROP TABLE IF EXISTS cv_valueobject CASCADE; 
     213DROP TABLE IF EXISTS cv_valuesegment CASCADE; 
     214DROP TABLE IF EXISTS cv_valuesegment_cv_valuecurve CASCADE; 
     215DROP TABLE IF EXISTS cv_valuetriangle CASCADE; 
     216DROP TABLE IF EXISTS date CASCADE; 
     217DROP TABLE IF EXISTS dateprecision CASCADE; 
     218DROP TABLE IF EXISTS datetime CASCADE; 
     219DROP TABLE IF EXISTS decimal CASCADE; 
     220DROP TABLE IF EXISTS directposition CASCADE; 
     221DROP TABLE IF EXISTS distance CASCADE; 
     222DROP TABLE IF EXISTS dq_absoluteexternalpositionalaccuracy CASCADE; 
     223DROP TABLE IF EXISTS dq_completeness CASCADE; 
     224DROP TABLE IF EXISTS dq_conformanceresult CASCADE; 
     225DROP TABLE IF EXISTS dq_dataquality CASCADE; 
     226DROP TABLE IF EXISTS dq_element CASCADE; 
     227DROP TABLE IF EXISTS dq_griddeddatapositionalaccuracy CASCADE; 
     228DROP TABLE IF EXISTS dq_logicalconsistency CASCADE; 
     229DROP TABLE IF EXISTS dq_positionalaccuracy CASCADE; 
     230DROP TABLE IF EXISTS dq_quantitativeresult CASCADE; 
     231DROP TABLE IF EXISTS dq_relativeinternalpositionalaccuracy CASCADE; 
     232DROP TABLE IF EXISTS dq_result CASCADE; 
     233DROP TABLE IF EXISTS dq_scope CASCADE; 
     234DROP TABLE IF EXISTS dq_temporalaccuracy CASCADE; 
     235DROP TABLE IF EXISTS dq_thematicaccuracy CASCADE; 
     236DROP TABLE IF EXISTS ds_aggregate CASCADE; 
     237DROP TABLE IF EXISTS ds_dataset CASCADE; 
     238DROP TABLE IF EXISTS ds_dataset_ds_aggregate CASCADE; 
     239DROP TABLE IF EXISTS ds_dataset_md_metadata CASCADE; 
     240DROP TABLE IF EXISTS ds_initiative CASCADE; 
     241DROP TABLE IF EXISTS ds_otheraggregate CASCADE; 
     242DROP TABLE IF EXISTS ds_series CASCADE; 
     243DROP TABLE IF EXISTS earootclass CASCADE; 
     244DROP TABLE IF EXISTS ex_boundingpolygon CASCADE; 
     245DROP TABLE IF EXISTS ex_boundingpolygon_ex_extent CASCADE; 
     246DROP TABLE IF EXISTS ex_boundingpolygon_mo_observation CASCADE; 
     247DROP TABLE IF EXISTS ex_boundingpolygon_mo_observationcollection CASCADE; 
     248DROP TABLE IF EXISTS ex_extent CASCADE; 
     249DROP TABLE IF EXISTS ex_extent_ci_responsiblepartyinfo CASCADE; 
     250DROP TABLE IF EXISTS ex_extent_cv_coverage CASCADE; 
     251DROP TABLE IF EXISTS ex_extent_li_source CASCADE; 
     252DROP TABLE IF EXISTS ex_extent_tm_referencesystem CASCADE; 
     253DROP TABLE IF EXISTS ex_geographicboundingbox CASCADE; 
     254DROP TABLE IF EXISTS ex_geographicdescription CASCADE; 
     255DROP TABLE IF EXISTS ex_geographicextent CASCADE; 
     256DROP TABLE IF EXISTS ex_temporalextent CASCADE; 
     257DROP TABLE IF EXISTS ex_verticalextent CASCADE; 
     258DROP TABLE IF EXISTS genericname CASCADE; 
     259DROP TABLE IF EXISTS gf_aggregationtype CASCADE; 
     260DROP TABLE IF EXISTS gf_associationrole CASCADE; 
     261DROP TABLE IF EXISTS gf_associationtype CASCADE; 
     262DROP TABLE IF EXISTS gf_attributetype CASCADE; 
     263DROP TABLE IF EXISTS gf_attributetype_gf_featuretype CASCADE; 
     264DROP TABLE IF EXISTS gf_attributetype_md_metadata CASCADE; 
     265DROP TABLE IF EXISTS gf_attributetype_md_scopedescription CASCADE; 
     266DROP TABLE IF EXISTS gf_constraint CASCADE; 
     267DROP TABLE IF EXISTS gf_featuretype CASCADE; 
     268DROP TABLE IF EXISTS gf_featuretype_gf_associationtype CASCADE; 
     269DROP TABLE IF EXISTS gf_featuretype_md_metadata CASCADE; 
     270DROP TABLE IF EXISTS gf_featuretype_md_scopedescription CASCADE; 
     271DROP TABLE IF EXISTS gfi_domainfeature CASCADE; 
     272DROP TABLE IF EXISTS gfi_feature CASCADE; 
     273DROP TABLE IF EXISTS gf_inheritancerelation CASCADE; 
     274DROP TABLE IF EXISTS gf_locationalattributetype CASCADE; 
     275DROP TABLE IF EXISTS gf_metadataattributetype CASCADE; 
     276DROP TABLE IF EXISTS gf_operation CASCADE; 
     277DROP TABLE IF EXISTS gf_propertytype CASCADE; 
     278DROP TABLE IF EXISTS gf_spatialassociationtype CASCADE; 
     279DROP TABLE IF EXISTS gf_spatialattributetype CASCADE; 
     280DROP TABLE IF EXISTS gf_temporalassociationtype CASCADE; 
     281DROP TABLE IF EXISTS gf_temporalattributetype CASCADE; 
     282DROP TABLE IF EXISTS gf_thematicattributetype CASCADE; 
     283DROP TABLE IF EXISTS gm_affineplacement CASCADE; 
     284DROP TABLE IF EXISTS gm_aggregate CASCADE; 
     285DROP TABLE IF EXISTS gm_aggregate_cv_domainobject CASCADE; 
     286DROP TABLE IF EXISTS gm_aggregate_ex_boundingpolygon CASCADE; 
     287DROP TABLE IF EXISTS gm_aggregate_gm_aggregate CASCADE; 
     288DROP TABLE IF EXISTS gm_aggregate_sc_crs CASCADE; 
     289DROP TABLE IF EXISTS gm_arcstringbybulge CASCADE; 
     290DROP TABLE IF EXISTS gm_arcstring CASCADE; 
     291DROP TABLE IF EXISTS gm_boundary CASCADE; 
     292DROP TABLE IF EXISTS gm_clothoid CASCADE; 
     293DROP TABLE IF EXISTS gm_complex CASCADE; 
     294DROP TABLE IF EXISTS gm_complex_cv_domainobject CASCADE; 
     295DROP TABLE IF EXISTS gm_complex_ex_boundingpolygon CASCADE; 
     296DROP TABLE IF EXISTS gm_complex_gm_aggregate CASCADE; 
     297DROP TABLE IF EXISTS gm_complex_gm_complex CASCADE; 
     298DROP TABLE IF EXISTS gm_complex_gm_primitive CASCADE; 
     299DROP TABLE IF EXISTS gm_complex_sc_crs CASCADE; 
     300DROP TABLE IF EXISTS gm_composite CASCADE; 
     301DROP TABLE IF EXISTS gm_compositecurve CASCADE; 
     302DROP TABLE IF EXISTS gm_compositecurve_gm_compositecurve CASCADE; 
     303DROP TABLE IF EXISTS gm_compositepoint CASCADE; 
     304DROP TABLE IF EXISTS gm_compositesolid CASCADE; 
     305DROP TABLE IF EXISTS gm_compositesolid_gm_primitive CASCADE; 
     306DROP TABLE IF EXISTS gm_compositesolid_gm_solid CASCADE; 
     307DROP TABLE IF EXISTS gm_compositesurface CASCADE; 
     308DROP TABLE IF EXISTS gm_compositesurface_gm_compositesurface CASCADE; 
     309DROP TABLE IF EXISTS gm_conic CASCADE; 
     310DROP TABLE IF EXISTS gm_curve CASCADE; 
     311DROP TABLE IF EXISTS gm_curvesegment CASCADE; 
     312DROP TABLE IF EXISTS gm_geodesicstring CASCADE; 
     313DROP TABLE IF EXISTS gm_knot CASCADE; 
     314DROP TABLE IF EXISTS gm_linestring CASCADE; 
     315DROP TABLE IF EXISTS gm_object CASCADE; 
     316DROP TABLE IF EXISTS gm_offsetcurve CASCADE; 
     317DROP TABLE IF EXISTS gm_orientablecurve CASCADE; 
     318DROP TABLE IF EXISTS gm_orientableprimitive CASCADE; 
     319DROP TABLE IF EXISTS gm_orientablesurface CASCADE; 
     320DROP TABLE IF EXISTS gm_parametriccurvesurface CASCADE; 
     321DROP TABLE IF EXISTS gm_pointarray CASCADE; 
     322DROP TABLE IF EXISTS gm_point CASCADE; 
     323DROP TABLE IF EXISTS gm_point_cv_gridpoint CASCADE; 
     324DROP TABLE IF EXISTS gm_point_gm_complex CASCADE; 
     325DROP TABLE IF EXISTS gm_point_gm_composite CASCADE; 
     326DROP TABLE IF EXISTS gm_point_gm_primitive CASCADE; 
     327DROP TABLE IF EXISTS gm_pointref CASCADE; 
     328DROP TABLE IF EXISTS gm_polygon CASCADE; 
     329DROP TABLE IF EXISTS gm_polyhedralsurface CASCADE; 
     330DROP TABLE IF EXISTS gm_position CASCADE; 
     331DROP TABLE IF EXISTS gm_primitiveboundary CASCADE; 
     332DROP TABLE IF EXISTS gm_primitive CASCADE; 
     333DROP TABLE IF EXISTS gm_primitive_cv_domainobject CASCADE; 
     334DROP TABLE IF EXISTS gm_primitive_ex_boundingpolygon CASCADE; 
     335DROP TABLE IF EXISTS gm_primitive_gm_aggregate CASCADE; 
     336DROP TABLE IF EXISTS gm_primitive_sc_crs CASCADE; 
     337DROP TABLE IF EXISTS gm_ring CASCADE; 
     338DROP TABLE IF EXISTS gm_solid CASCADE; 
     339DROP TABLE IF EXISTS gm_solid_gm_complex CASCADE; 
     340DROP TABLE IF EXISTS gm_solid_gm_composite CASCADE; 
     341DROP TABLE IF EXISTS gm_solid_gm_compositesolid CASCADE; 
     342DROP TABLE IF EXISTS gm_solid_gm_primitive CASCADE; 
     343DROP TABLE IF EXISTS gm_splinecurve CASCADE; 
     344DROP TABLE IF EXISTS gm_surfaceboundary CASCADE; 
     345DROP TABLE IF EXISTS gm_surface CASCADE; 
     346DROP TABLE IF EXISTS gm_surfacepatch CASCADE; 
     347DROP TABLE IF EXISTS gm_tin CASCADE; 
     348DROP TABLE IF EXISTS gm_triangle CASCADE; 
     349DROP TABLE IF EXISTS gm_triangulatedsurface CASCADE; 
     350DROP TABLE IF EXISTS if_classificationattributetype CASCADE; 
     351DROP TABLE IF EXISTS io_identifiedobjectbase CASCADE; 
     352DROP TABLE IF EXISTS io_identifiedobject CASCADE; 
     353DROP TABLE IF EXISTS juliandate CASCADE; 
     354DROP TABLE IF EXISTS le_algorithm CASCADE; 
     355DROP TABLE IF EXISTS length CASCADE; 
     356DROP TABLE IF EXISTS le_nominalresolution CASCADE; 
     357DROP TABLE IF EXISTS le_source CASCADE; 
     358DROP TABLE IF EXISTS li_lineage CASCADE; 
     359DROP TABLE IF EXISTS li_processstep CASCADE; 
     360DROP TABLE IF EXISTS li_processstep_li_lineage CASCADE; 
     361DROP TABLE IF EXISTS li_processstep_li_source CASCADE; 
     362DROP TABLE IF EXISTS li_source CASCADE; 
     363DROP TABLE IF EXISTS li_source_li_lineage CASCADE; 
     364DROP TABLE IF EXISTS li_source_li_processstep CASCADE; 
     365DROP TABLE IF EXISTS localname CASCADE; 
     366DROP TABLE IF EXISTS location CASCADE; 
     367DROP TABLE IF EXISTS md_aggregateinformation CASCADE; 
     368DROP TABLE IF EXISTS md_applicationschemainformation CASCADE; 
     369DROP TABLE IF EXISTS md_browsegraphic CASCADE; 
     370DROP TABLE IF EXISTS md_constraints CASCADE; 
     371DROP TABLE IF EXISTS md_contentinformation CASCADE; 
     372DROP TABLE IF EXISTS md_coveragedescription CASCADE; 
     373DROP TABLE IF EXISTS md_digitaltransferoptions CASCADE; 
     374DROP TABLE IF EXISTS md_dimension CASCADE; 
     375DROP TABLE IF EXISTS md_distribution CASCADE; 
     376DROP TABLE IF EXISTS md_distributor CASCADE; 
     377DROP TABLE IF EXISTS md_distributor_md_distribution CASCADE; 
     378DROP TABLE IF EXISTS md_distributor_md_format CASCADE; 
     379DROP TABLE IF EXISTS md_extendedelementinformation CASCADE; 
     380DROP TABLE IF EXISTS md_featurecataloguedescription CASCADE; 
     381DROP TABLE IF EXISTS md_format CASCADE; 
     382DROP TABLE IF EXISTS md_format_md_distribution CASCADE; 
     383DROP TABLE IF EXISTS md_format_md_distributor CASCADE; 
     384DROP TABLE IF EXISTS md_format_md_identification CASCADE; 
     385DROP TABLE IF EXISTS md_geometricobjects CASCADE; 
     386DROP TABLE IF EXISTS md_gridspatialrepresentation CASCADE; 
     387DROP TABLE IF EXISTS md_identification CASCADE; 
     388DROP TABLE IF EXISTS md_identification_md_metadata CASCADE; 
     389DROP TABLE IF EXISTS md_identifier CASCADE; 
     390DROP TABLE IF EXISTS md_imagedescription CASCADE; 
     391DROP TABLE IF EXISTS md_keywords CASCADE; 
     392DROP TABLE IF EXISTS md_legalconstraints CASCADE; 
     393DROP TABLE IF EXISTS md_maintenanceinformation CASCADE; 
     394DROP TABLE IF EXISTS md_maintenanceinformation_md_identification CASCADE; 
     395DROP TABLE IF EXISTS md_medium CASCADE; 
     396DROP TABLE IF EXISTS md_metadata CASCADE; 
     397DROP TABLE IF EXISTS md_metadata_cl_dataset CASCADE; 
     398DROP TABLE IF EXISTS md_metadata_ds_aggregate CASCADE; 
     399DROP TABLE IF EXISTS md_metadata_ds_dataset CASCADE; 
     400DROP TABLE IF EXISTS md_metadataextensioninformation CASCADE; 
     401DROP TABLE IF EXISTS md_metadata_gf_attributetype CASCADE; 
     402DROP TABLE IF EXISTS md_metadata_gf_featuretype CASCADE; 
     403DROP TABLE IF EXISTS md_metadata_gf_propertytype CASCADE; 
     404DROP TABLE IF EXISTS md_metadata_mo_observationcollection CASCADE; 
     405DROP TABLE IF EXISTS md_portrayalcataloguereference CASCADE; 
     406DROP TABLE IF EXISTS md_rangedimension CASCADE; 
     407DROP TABLE IF EXISTS md_referencesystem CASCADE; 
     408DROP TABLE IF EXISTS md_representativefraction CASCADE; 
     409DROP TABLE IF EXISTS md_scopedescription CASCADE; 
     410DROP TABLE IF EXISTS md_scopedescription_dq_scope CASCADE; 
     411DROP TABLE IF EXISTS md_scopedescription_md_maintenanceinformation CASCADE; 
     412DROP TABLE IF EXISTS md_securityconstraints CASCADE; 
     413DROP TABLE IF EXISTS md_spatialrepresentation CASCADE; 
     414DROP TABLE IF EXISTS md_standardorderprocess CASCADE; 
     415DROP TABLE IF EXISTS md_usage CASCADE; 
     416DROP TABLE IF EXISTS md_vectorspatialrepresentation CASCADE; 
     417DROP TABLE IF EXISTS measure CASCADE; 
     418DROP TABLE IF EXISTS membername CASCADE; 
     419DROP TABLE IF EXISTS mi_coveragedescription CASCADE; 
     420DROP TABLE IF EXISTS mi_rangeelementdescription CASCADE; 
     421DROP TABLE IF EXISTS mo_acquisition CASCADE; 
     422DROP TABLE IF EXISTS mo_compositeprocess CASCADE; 
     423DROP TABLE IF EXISTS mo_computation CASCADE; 
     424DROP TABLE IF EXISTS mo_featureofinterest CASCADE; 
     425DROP TABLE IF EXISTS mo_inputoutput CASCADE; 
     426DROP TABLE IF EXISTS mo_instrument CASCADE; 
     427DROP TABLE IF EXISTS mo_instrument_mo_instrument CASCADE; 
     428DROP TABLE IF EXISTS mo_instrumentplatformpair CASCADE; 
     429DROP TABLE IF EXISTS mo_location CASCADE; 
     430DROP TABLE IF EXISTS mo_observation CASCADE; 
     431DROP TABLE IF EXISTS mo_observationcollection CASCADE; 
     432DROP TABLE IF EXISTS mo_observationcollection_mo_observationcollection CASCADE; 
     433DROP TABLE IF EXISTS mo_observationcollection_mo_project CASCADE; 
     434DROP TABLE IF EXISTS mo_observation_gfi_feature CASCADE; 
     435DROP TABLE IF EXISTS mo_observation_mo_observationcollection CASCADE; 
     436DROP TABLE IF EXISTS mo_observation_om_observation CASCADE; 
     437DROP TABLE IF EXISTS mo_observation_om_process CASCADE; 
     438DROP TABLE IF EXISTS mo_observation_sf_samplingfeature CASCADE; 
     439DROP TABLE IF EXISTS mo_onlineresource CASCADE; 
     440DROP TABLE IF EXISTS mo_operation CASCADE; 
     441DROP TABLE IF EXISTS mo_operation_mo_operation CASCADE; 
     442DROP TABLE IF EXISTS mo_organization CASCADE; 
     443DROP TABLE IF EXISTS mo_platform CASCADE; 
     444DROP TABLE IF EXISTS mo_platform_mo_platform CASCADE; 
     445DROP TABLE IF EXISTS mo_process CASCADE; 
     446DROP TABLE IF EXISTS mo_processing CASCADE; 
     447DROP TABLE IF EXISTS mo_project CASCADE; 
     448DROP TABLE IF EXISTS mo_project_mo_project CASCADE; 
     449DROP TABLE IF EXISTS mo_responsiblepartyinfo CASCADE; 
     450DROP TABLE IF EXISTS mo_result CASCADE; 
     451DROP TABLE IF EXISTS mo_result_mo_result CASCADE; 
     452DROP TABLE IF EXISTS multiplicity CASCADE; 
     453DROP TABLE IF EXISTS multiplicityrange CASCADE; 
     454DROP TABLE IF EXISTS mx_datafile CASCADE; 
     455DROP TABLE IF EXISTS namedvalue CASCADE; 
     456DROP TABLE IF EXISTS namespace CASCADE; 
     457DROP TABLE IF EXISTS obs_coll_migration CASCADE; 
     458DROP TABLE IF EXISTS observation_migration CASCADE; 
     459DROP TABLE IF EXISTS om_categoryobservation CASCADE; 
     460DROP TABLE IF EXISTS om_complexobservation CASCADE; 
     461DROP TABLE IF EXISTS om_countobservation CASCADE; 
     462DROP TABLE IF EXISTS om_discretecoverageobservation CASCADE; 
     463DROP TABLE IF EXISTS om_geometryobservation CASCADE; 
     464DROP TABLE IF EXISTS om_measurement CASCADE; 
     465DROP TABLE IF EXISTS om_observation CASCADE; 
     466DROP TABLE IF EXISTS om_process CASCADE; 
     467DROP TABLE IF EXISTS om_process_sf_spatialsamplingfeature CASCADE; 
     468DROP TABLE IF EXISTS om_temporalobservation CASCADE; 
     469DROP TABLE IF EXISTS om_truthobservation CASCADE; 
     470DROP TABLE IF EXISTS qe_coverageresult CASCADE; 
     471DROP TABLE IF EXISTS qe_usability CASCADE; 
     472DROP TABLE IF EXISTS record CASCADE; 
     473DROP TABLE IF EXISTS recordtype CASCADE; 
     474DROP TABLE IF EXISTS rs_identifier CASCADE; 
     475DROP TABLE IF EXISTS rs_referencesystem CASCADE; 
     476DROP TABLE IF EXISTS scale CASCADE; 
     477DROP TABLE IF EXISTS sc_compoundcrs CASCADE; 
     478DROP TABLE IF EXISTS sc_crs CASCADE; 
     479DROP TABLE IF EXISTS sc_derivedcrs CASCADE; 
     480DROP TABLE IF EXISTS sc_engineeringcrs CASCADE; 
     481DROP TABLE IF EXISTS sc_generalderivedcrs CASCADE; 
     482DROP TABLE IF EXISTS sc_geodeticcrs CASCADE; 
     483DROP TABLE IF EXISTS schema CASCADE; 
     484DROP TABLE IF EXISTS sc_imagecrs CASCADE; 
     485DROP TABLE IF EXISTS scopedname CASCADE; 
     486DROP TABLE IF EXISTS sc_projectedcrs CASCADE; 
     487DROP TABLE IF EXISTS sc_singlecrs CASCADE; 
     488DROP TABLE IF EXISTS sc_verticalcrs CASCADE; 
     489DROP TABLE IF EXISTS sf_process CASCADE; 
     490DROP TABLE IF EXISTS sf_samplingfeature CASCADE; 
     491DROP TABLE IF EXISTS sf_samplingfeature_sf_samplingfeature CASCADE; 
     492DROP TABLE IF EXISTS sf_spatialsamplingfeature CASCADE; 
     493DROP TABLE IF EXISTS sf_spatialsamplingfeature_sf_samplingfeature CASCADE; 
     494DROP TABLE IF EXISTS sf_specimen CASCADE; 
     495DROP TABLE IF EXISTS time CASCADE; 
     496DROP TABLE IF EXISTS tm_caldate CASCADE; 
     497DROP TABLE IF EXISTS tm_calendar CASCADE; 
     498DROP TABLE IF EXISTS tm_calendarera CASCADE; 
     499DROP TABLE IF EXISTS tm_calendarera_tm_calendar CASCADE; 
     500DROP TABLE IF EXISTS tm_calendar_tm_calendarera CASCADE; 
     501DROP TABLE IF EXISTS tm_calendar_tm_clock CASCADE; 
     502DROP TABLE IF EXISTS tm_clock CASCADE; 
     503DROP TABLE IF EXISTS tm_clocktime CASCADE; 
     504DROP TABLE IF EXISTS tm_complex CASCADE; 
     505DROP TABLE IF EXISTS tm_coordinate CASCADE; 
     506DROP TABLE IF EXISTS tm_coordinatesystem CASCADE; 
     507DROP TABLE IF EXISTS tm_duration CASCADE; 
     508DROP TABLE IF EXISTS tm_edge CASCADE; 
     509DROP TABLE IF EXISTS tm_geometricprimitive CASCADE; 
     510DROP TABLE IF EXISTS tm_instant CASCADE; 
     511DROP TABLE IF EXISTS tm_node CASCADE; 
     512DROP TABLE IF EXISTS tm_object CASCADE; 
     513DROP TABLE IF EXISTS tm_ordinalera CASCADE; 
     514DROP TABLE IF EXISTS tm_ordinalera_tm_ordinalera CASCADE; 
     515DROP TABLE IF EXISTS tm_ordinalposition CASCADE; 
     516DROP TABLE IF EXISTS tm_ordinalreferencesystem CASCADE; 
     517DROP TABLE IF EXISTS tm_period CASCADE; 
     518DROP TABLE IF EXISTS tm_periodduration CASCADE; 
     519DROP TABLE IF EXISTS tm_position CASCADE; 
     520DROP TABLE IF EXISTS tm_primitive CASCADE; 
     521DROP TABLE IF EXISTS tm_referencesystem CASCADE; 
     522DROP TABLE IF EXISTS tm_temporalcrs CASCADE; 
     523DROP TABLE IF EXISTS tm_temporalposition CASCADE; 
     524DROP TABLE IF EXISTS tm_topologicalcomplex CASCADE; 
     525DROP TABLE IF EXISTS tm_topologicalprimitive CASCADE; 
     526DROP TABLE IF EXISTS tp_boundary CASCADE; 
     527DROP TABLE IF EXISTS tp_complex CASCADE; 
     528DROP TABLE IF EXISTS tp_complex_tp_complex CASCADE; 
     529DROP TABLE IF EXISTS tp_complex_tp_primitive CASCADE; 
     530DROP TABLE IF EXISTS tp_directededge CASCADE; 
     531DROP TABLE IF EXISTS tp_directededge_tp_face CASCADE; 
     532DROP TABLE IF EXISTS tp_directededge_tp_node CASCADE; 
     533DROP TABLE IF EXISTS tp_directedface CASCADE; 
     534DROP TABLE IF EXISTS tp_directedface_tp_edge CASCADE; 
     535DROP TABLE IF EXISTS tp_directedface_tp_solid CASCADE; 
     536DROP TABLE IF EXISTS tp_directednode CASCADE; 
     537DROP TABLE IF EXISTS tp_directedsolid CASCADE; 
     538DROP TABLE IF EXISTS tp_directedsolid_tp_face CASCADE; 
     539DROP TABLE IF EXISTS tp_directedtopo CASCADE; 
     540DROP TABLE IF EXISTS tp_edge CASCADE; 
     541DROP TABLE IF EXISTS tp_edge_gm_primitive CASCADE; 
     542DROP TABLE IF EXISTS tp_edge_tp_complex CASCADE; 
     543DROP TABLE IF EXISTS tp_edge_tp_directedface CASCADE; 
     544DROP TABLE IF EXISTS tp_edge_tp_directednode CASCADE; 
     545DROP TABLE IF EXISTS tp_edge_tp_primitive CASCADE; 
     546DROP TABLE IF EXISTS tp_expression CASCADE; 
     547DROP TABLE IF EXISTS tp_expressionterm CASCADE; 
     548DROP TABLE IF EXISTS tp_face CASCADE; 
     549DROP TABLE IF EXISTS tp_face_gm_primitive CASCADE; 
     550DROP TABLE IF EXISTS tp_face_tp_complex CASCADE; 
     551DROP TABLE IF EXISTS tp_face_tp_directededge CASCADE; 
     552DROP TABLE IF EXISTS tp_face_tp_directedsolid CASCADE; 
     553DROP TABLE IF EXISTS tp_face_tp_primitive CASCADE; 
     554DROP TABLE IF EXISTS tp_node CASCADE; 
     555DROP TABLE IF EXISTS tp_node_gm_primitive CASCADE; 
     556DROP TABLE IF EXISTS tp_node_tp_complex CASCADE; 
     557DROP TABLE IF EXISTS tp_node_tp_primitive CASCADE; 
     558DROP TABLE IF EXISTS tp_primitive CASCADE; 
     559DROP TABLE IF EXISTS tp_ring CASCADE; 
     560DROP TABLE IF EXISTS tp_shell CASCADE; 
     561DROP TABLE IF EXISTS tp_solid CASCADE; 
     562DROP TABLE IF EXISTS tp_solid_gm_primitive CASCADE; 
     563DROP TABLE IF EXISTS tp_solid_tp_complex CASCADE; 
     564DROP TABLE IF EXISTS tp_solid_tp_directedface CASCADE; 
     565DROP TABLE IF EXISTS tp_solid_tp_primitive CASCADE; 
     566DROP TABLE IF EXISTS type CASCADE; 
     567DROP TABLE IF EXISTS typename CASCADE; 
     568DROP TABLE IF EXISTS unitofmeasure CASCADE; 
     569DROP TABLE IF EXISTS unlimitedinteger CASCADE; 
     570DROP TABLE IF EXISTS uomangle CASCADE; 
     571DROP TABLE IF EXISTS uomlength CASCADE; 
     572DROP TABLE IF EXISTS uomscale CASCADE; 
     573DROP TABLE IF EXISTS url CASCADE; 
    216574 
    217575 
    218 "DROP TABLE IF EXISTS any CASCADE;" 
    219 "DROP TABLE IF EXISTS cc_concatenatedoperation CASCADE;" 
    220 "DROP TABLE IF EXISTS cc_conversion CASCADE;" 
    221 "DROP TABLE IF EXISTS cc_coordinateoperation CASCADE;" 
    222 "DROP TABLE IF EXISTS cc_formula CASCADE;" 
    223 "DROP TABLE IF EXISTS cc_generaloperationparameter CASCADE;" 
    224 "DROP TABLE IF EXISTS cc_generalparametervalue CASCADE;" 
    225 "DROP TABLE IF EXISTS cc_operationmethod CASCADE;" 
    226 "DROP TABLE IF EXISTS cc_operationparametergroup CASCADE;" 
    227 "DROP TABLE IF EXISTS cc_parametervaluegroup CASCADE;" 
    228 "DROP TABLE IF EXISTS cc_passthroughoperation CASCADE;" 
    229 "DROP TABLE IF EXISTS cc_singleoperation CASCADE;" 
    230 "DROP TABLE IF EXISTS cd_datum CASCADE;" 
    231 "DROP TABLE IF EXISTS cd_verticaldatum CASCADE;" 
    232 "DROP TABLE IF EXISTS ceda_acquisition CASCADE;" 
    233 "DROP TABLE IF EXISTS ceda_citation CASCADE;" 
    234 "DROP TABLE IF EXISTS ceda_compositeprocess CASCADE;" 
    235 "DROP TABLE IF EXISTS ceda_instrument CASCADE;" 
    236 "DROP TABLE IF EXISTS ceda_notes CASCADE;" 
    237 "DROP TABLE IF EXISTS ceda_observation CASCADE;" 
    238 "DROP TABLE IF EXISTS ceda_observationcollection CASCADE;" 
    239 "DROP TABLE IF EXISTS ceda_operation CASCADE;" 
    240 "DROP TABLE IF EXISTS ceda_platform CASCADE;" 
    241 "DROP TABLE IF EXISTS ceda_process CASCADE;" 
    242 "DROP TABLE IF EXISTS ceda_processing CASCADE;" 
    243 "DROP TABLE IF EXISTS ceda_project CASCADE;" 
    244 "DROP TABLE IF EXISTS ceda_result CASCADE;" 
    245 "DROP TABLE IF EXISTS ceda_review CASCADE;" 
    246 "DROP TABLE IF EXISTS ci_address CASCADE;" 
    247 "DROP TABLE IF EXISTS ci_citation CASCADE;" 
    248 "DROP TABLE IF EXISTS ci_contact CASCADE;" 
    249 "DROP TABLE IF EXISTS ci_date CASCADE;" 
    250 "DROP TABLE IF EXISTS ci_individual CASCADE;" 
    251 "DROP TABLE IF EXISTS ci_onlineresource CASCADE;" 
    252 "DROP TABLE IF EXISTS ci_organisation CASCADE;" 
    253 "DROP TABLE IF EXISTS ci_party CASCADE;" 
    254 "DROP TABLE IF EXISTS ci_responsibility CASCADE;" 
    255 "DROP TABLE IF EXISTS ci_responsibleparty CASCADE;" 
    256 "DROP TABLE IF EXISTS ci_responsiblepartyinfo CASCADE;" 
    257 "DROP TABLE IF EXISTS ci_series CASCADE;" 
    258 "DROP TABLE IF EXISTS ci_telephone CASCADE;" 
    259 "DROP TABLE IF EXISTS class13_0 CASCADE;" 
    260 "DROP TABLE IF EXISTS class13_1 CASCADE;" 
    261 "DROP TABLE IF EXISTS class13_2 CASCADE;" 
    262 "DROP TABLE IF EXISTS class13_3 CASCADE;" 
    263 "DROP TABLE IF EXISTS cl_dataset CASCADE;" 
    264 "DROP TABLE IF EXISTS clocktime CASCADE;" 
    265 "DROP TABLE IF EXISTS cs_coordinatesystemaxis CASCADE;" 
    266 "DROP TABLE IF EXISTS cs_coordinatesystem CASCADE;" 
    267 "DROP TABLE IF EXISTS cs_verticalcs CASCADE;" 
    268 "DROP TABLE IF EXISTS cv_attributevalues CASCADE;" 
    269 "DROP TABLE IF EXISTS cv_coverage CASCADE;" 
    270 "DROP TABLE IF EXISTS cv_domainobject CASCADE;" 
    271 "DROP TABLE IF EXISTS cv_footprint CASCADE;" 
    272 "DROP TABLE IF EXISTS cv_grid CASCADE;" 
    273 "DROP TABLE IF EXISTS cv_gridcell CASCADE;" 
    274 "DROP TABLE IF EXISTS cv_gridcoordinate CASCADE;" 
    275 "DROP TABLE IF EXISTS cv_gridenvelope CASCADE;" 
    276 "DROP TABLE IF EXISTS cv_gridpoint CASCADE;" 
    277 "DROP TABLE IF EXISTS cv_referenceablegrid CASCADE;" 
    278 "DROP TABLE IF EXISTS date CASCADE;" 
    279 "DROP TABLE IF EXISTS dateprecision CASCADE;" 
    280 "DROP TABLE IF EXISTS datetime CASCADE;" 
    281 "DROP TABLE IF EXISTS directposition CASCADE;" 
    282 "DROP TABLE IF EXISTS distance CASCADE;" 
    283 "DROP TABLE IF EXISTS dq_dataquality CASCADE;" 
    284 "DROP TABLE IF EXISTS dq_element CASCADE;" 
    285 "DROP TABLE IF EXISTS dq_positionalaccuracy CASCADE;" 
    286 "DROP TABLE IF EXISTS dq_result CASCADE;" 
    287 "DROP TABLE IF EXISTS dq_scope CASCADE;" 
    288 "DROP TABLE IF EXISTS ds_aggregate CASCADE;" 
    289 "DROP TABLE IF EXISTS ds_aggregate_ds_aggregate CASCADE;" 
    290 "DROP TABLE IF EXISTS ds_dataset CASCADE;" 
    291 "DROP TABLE IF EXISTS earootclass CASCADE;" 
    292 "DROP TABLE IF EXISTS ex_extent CASCADE;" 
    293 "DROP TABLE IF EXISTS ex_geographicdescription CASCADE;" 
    294 "DROP TABLE IF EXISTS ex_geographicextent CASCADE;" 
    295 "DROP TABLE IF EXISTS ex_temporalextent CASCADE;" 
    296 "DROP TABLE IF EXISTS ex_verticalextent CASCADE;" 
    297 "DROP TABLE IF EXISTS genericname CASCADE;" 
    298 "DROP TABLE IF EXISTS gf_associationrole CASCADE;" 
    299 "DROP TABLE IF EXISTS gf_associationtype CASCADE;" 
    300 "DROP TABLE IF EXISTS gf_attributetype CASCADE;" 
    301 "DROP TABLE IF EXISTS gf_attributetype_gf_attributetype CASCADE;" 
    302 "DROP TABLE IF EXISTS gf_constraint CASCADE;" 
    303 "DROP TABLE IF EXISTS gf_featuretype CASCADE;" 
    304 "DROP TABLE IF EXISTS gfi_feature CASCADE;" 
    305 "DROP TABLE IF EXISTS gf_inheritancerelation CASCADE;" 
    306 "DROP TABLE IF EXISTS gf_operation CASCADE;" 
    307 "DROP TABLE IF EXISTS gf_propertytype CASCADE;" 
    308 "DROP TABLE IF EXISTS gm_complex CASCADE;" 
    309 "DROP TABLE IF EXISTS gm_complex_gm_complex CASCADE;" 
    310 "DROP TABLE IF EXISTS gm_composite CASCADE;" 
    311 "DROP TABLE IF EXISTS gm_compositepoint CASCADE;" 
    312 "DROP TABLE IF EXISTS gm_object CASCADE;" 
    313 "DROP TABLE IF EXISTS gm_orientableprimitive CASCADE;" 
    314 "DROP TABLE IF EXISTS gm_point CASCADE;" 
    315 "DROP TABLE IF EXISTS gm_primitive CASCADE;" 
    316 "DROP TABLE IF EXISTS gm_primitive_gm_primitive CASCADE;" 
    317 "DROP TABLE IF EXISTS io_identifiedobjectbase CASCADE;" 
    318 "DROP TABLE IF EXISTS io_identifiedobject CASCADE;" 
    319 "DROP TABLE IF EXISTS le_algorithm CASCADE;" 
    320 "DROP TABLE IF EXISTS length CASCADE;" 
    321 "DROP TABLE IF EXISTS le_nominalresolution CASCADE;" 
    322 "DROP TABLE IF EXISTS le_source CASCADE;" 
    323 "DROP TABLE IF EXISTS li_lineage CASCADE;" 
    324 "DROP TABLE IF EXISTS li_processstep CASCADE;" 
    325 "DROP TABLE IF EXISTS li_source CASCADE;" 
    326 "DROP TABLE IF EXISTS localname CASCADE;" 
    327 "DROP TABLE IF EXISTS md_aggregateinformation CASCADE;" 
    328 "DROP TABLE IF EXISTS md_applicationschemainformation CASCADE;" 
    329 "DROP TABLE IF EXISTS md_browsegraphic CASCADE;" 
    330 "DROP TABLE IF EXISTS md_constraints CASCADE;" 
    331 "DROP TABLE IF EXISTS md_contentinformation CASCADE;" 
    332 "DROP TABLE IF EXISTS md_digitaltransferoptions CASCADE;" 
    333 "DROP TABLE IF EXISTS md_distribution CASCADE;" 
    334 "DROP TABLE IF EXISTS md_distributor CASCADE;" 
    335 "DROP TABLE IF EXISTS md_extendedelementinformation CASCADE;" 
    336 "DROP TABLE IF EXISTS md_format CASCADE;" 
    337 "DROP TABLE IF EXISTS md_identification CASCADE;" 
    338 "DROP TABLE IF EXISTS md_identifier CASCADE;" 
    339 "DROP TABLE IF EXISTS md_keywords CASCADE;" 
    340 "DROP TABLE IF EXISTS md_maintenanceinformation CASCADE;" 
    341 "DROP TABLE IF EXISTS md_medium CASCADE;" 
    342 "DROP TABLE IF EXISTS md_metadata CASCADE;" 
    343 "DROP TABLE IF EXISTS md_metadataextensioninformation CASCADE;" 
    344 "DROP TABLE IF EXISTS md_portrayalcataloguereference CASCADE;" 
    345 "DROP TABLE IF EXISTS md_referencesystem CASCADE;" 
    346 "DROP TABLE IF EXISTS md_representativefraction CASCADE;" 
    347 "DROP TABLE IF EXISTS md_scopedescription CASCADE;" 
    348 "DROP TABLE IF EXISTS md_spatialrepresentation CASCADE;" 
    349 "DROP TABLE IF EXISTS md_standardorderprocess CASCADE;" 
    350 "DROP TABLE IF EXISTS md_usage CASCADE;" 
    351 "DROP TABLE IF EXISTS measure CASCADE;" 
    352 "DROP TABLE IF EXISTS mo_acquisition CASCADE;" 
    353 "DROP TABLE IF EXISTS mo_compositeprocess CASCADE;" 
    354 "DROP TABLE IF EXISTS mo_computation CASCADE;" 
    355 "DROP TABLE IF EXISTS mo_inputoutput CASCADE;" 
    356 "DROP TABLE IF EXISTS mo_instrument CASCADE;" 
    357 "DROP TABLE IF EXISTS mo_instrument_mo_instrument CASCADE;" 
    358 "DROP TABLE IF EXISTS mo_instrumentplatformpair CASCADE;" 
    359 "DROP TABLE IF EXISTS mo_location CASCADE;" 
    360 "DROP TABLE IF EXISTS mo_observation CASCADE;" 
    361 "DROP TABLE IF EXISTS mo_observationcollection CASCADE;" 
    362 "DROP TABLE IF EXISTS mo_observationcollection_mo_observationcollection CASCADE;" 
    363 "DROP TABLE IF EXISTS mo_onlineresource CASCADE;" 
    364 "DROP TABLE IF EXISTS mo_operation CASCADE;" 
    365 "DROP TABLE IF EXISTS mo_operation_mo_operation CASCADE;" 
    366 "DROP TABLE IF EXISTS mo_organization CASCADE;" 
    367 "DROP TABLE IF EXISTS mo_platform CASCADE;" 
    368 "DROP TABLE IF EXISTS mo_platform_mo_platform CASCADE;" 
    369 "DROP TABLE IF EXISTS mo_process CASCADE;" 
    370 "DROP TABLE IF EXISTS mo_processing CASCADE;" 
    371 "DROP TABLE IF EXISTS mo_project CASCADE;" 
    372 "DROP TABLE IF EXISTS mo_project_mo_project CASCADE;" 
    373 "DROP TABLE IF EXISTS mo_responsiblepartyinfo CASCADE;" 
    374 "DROP TABLE IF EXISTS mo_result CASCADE;" 
    375 "DROP TABLE IF EXISTS mo_result_mo_result CASCADE;" 
    376 "DROP TABLE IF EXISTS multiplicity CASCADE;" 
    377 "DROP TABLE IF EXISTS multiplicityrange CASCADE;" 
    378 "DROP TABLE IF EXISTS namedvalue CASCADE;" 
    379 "DROP TABLE IF EXISTS namespace CASCADE;" 
    380 "DROP TABLE IF EXISTS obs_coll_migration CASCADE;" 
    381 "DROP TABLE IF EXISTS observation_migration CASCADE;" 
    382 "DROP TABLE IF EXISTS om_observation CASCADE;" 
    383 "DROP TABLE IF EXISTS om_observation_om_observation CASCADE;" 
    384 "DROP TABLE IF EXISTS om_process CASCADE;" 
    385 "DROP TABLE IF EXISTS record CASCADE;" 
    386 "DROP TABLE IF EXISTS recordtype CASCADE;" 
    387 "DROP TABLE IF EXISTS rs_identifier CASCADE;" 
    388 "DROP TABLE IF EXISTS rs_referencesystem CASCADE;" 
    389 "DROP TABLE IF EXISTS scale CASCADE;" 
    390 "DROP TABLE IF EXISTS sc_compoundcrs CASCADE;" 
    391 "DROP TABLE IF EXISTS sc_crs CASCADE;" 
    392 "DROP TABLE IF EXISTS sc_derivedcrs CASCADE;" 
    393 "DROP TABLE IF EXISTS sc_generalderivedcrs CASCADE;" 
    394 "DROP TABLE IF EXISTS schema CASCADE;" 
    395 "DROP TABLE IF EXISTS scopedname CASCADE;" 
    396 "DROP TABLE IF EXISTS sc_singlecrs CASCADE;" 
    397 "DROP TABLE IF EXISTS sc_verticalcrs CASCADE;" 
    398 "DROP TABLE IF EXISTS time CASCADE;" 
    399 "DROP TABLE IF EXISTS tm_complex CASCADE;" 
    400 "DROP TABLE IF EXISTS tm_duration CASCADE;" 
    401 "DROP TABLE IF EXISTS tm_edge CASCADE;" 
    402 "DROP TABLE IF EXISTS tm_geometricprimitive CASCADE;" 
    403 "DROP TABLE IF EXISTS tm_instant CASCADE;" 
    404 "DROP TABLE IF EXISTS tm_node CASCADE;" 
    405 "DROP TABLE IF EXISTS tm_object CASCADE;" 
    406 "DROP TABLE IF EXISTS tm_period CASCADE;" 
    407 "DROP TABLE IF EXISTS tm_periodduration CASCADE;" 
    408 "DROP TABLE IF EXISTS tm_position CASCADE;" 
    409 "DROP TABLE IF EXISTS tm_primitive CASCADE;" 
    410 "DROP TABLE IF EXISTS tm_referencesystem CASCADE;" 
    411 "DROP TABLE IF EXISTS tm_temporalposition CASCADE;" 
    412 "DROP TABLE IF EXISTS tm_topologicalcomplex CASCADE;" 
    413 "DROP TABLE IF EXISTS tm_topologicalprimitive CASCADE;" 
    414 "DROP TABLE IF EXISTS tp_complex CASCADE;" 
    415 "DROP TABLE IF EXISTS tp_complex_tp_complex CASCADE;" 
    416 "DROP TABLE IF EXISTS tp_directedtopo CASCADE;" 
    417 "DROP TABLE IF EXISTS tp_expression CASCADE;" 
    418 "DROP TABLE IF EXISTS tp_expressionterm CASCADE;" 
    419 "DROP TABLE IF EXISTS tp_primitive CASCADE;" 
    420 "DROP TABLE IF EXISTS tp_primitive_tp_primitive CASCADE;" 
    421 "DROP TABLE IF EXISTS type CASCADE;" 
    422 "DROP TABLE IF EXISTS typename CASCADE;" 
    423 "DROP TABLE IF EXISTS unitofmeasure CASCADE;" 
    424 "DROP TABLE IF EXISTS unlimitedinteger CASCADE;" 
    425 "DROP TABLE IF EXISTS uomlength CASCADE;" 
    426 "DROP TABLE IF EXISTS uomscale CASCADE;" 
    427 "DROP TABLE IF EXISTS url CASCADE;" 
    428  
    429  
     576DROP SEQUENCE IF EXISTS angle_id_seq CASCADE; 
     577DROP SEQUENCE IF EXISTS any_id_seq CASCADE; 
     578DROP SEQUENCE IF EXISTS cc_concatenatedoperation_id_seq CASCADE; 
     579DROP SEQUENCE IF EXISTS cc_conversion_id_seq CASCADE; 
     580DROP SEQUENCE IF EXISTS cc_coordinateoperation_id_seq CASCADE; 
     581DROP SEQUENCE IF EXISTS cc_formula_id_seq CASCADE; 
     582DROP SEQUENCE IF EXISTS cc_generaloperationparameter_id_seq CASCADE; 
     583DROP SEQUENCE IF EXISTS cc_generalparametervalue_id_seq CASCADE; 
     584DROP SEQUENCE IF EXISTS cc_operationmethod_id_seq CASCADE; 
     585DROP SEQUENCE IF EXISTS cc_operationparametergroup_id_seq CASCADE; 
     586DROP SEQUENCE IF EXISTS cc_operationparameter_id_seq CASCADE; 
     587DROP SEQUENCE IF EXISTS cc_operationparametervalue_id_seq CASCADE; 
     588DROP SEQUENCE IF EXISTS cc_parametervaluegroup_id_seq CASCADE; 
     589DROP SEQUENCE IF EXISTS cc_parametervalue_id_seq CASCADE; 
     590DROP SEQUENCE IF EXISTS cc_passthroughoperation_id_seq CASCADE; 
     591DROP SEQUENCE IF EXISTS cc_singleoperation_id_seq CASCADE; 
     592DROP SEQUENCE IF EXISTS cc_transformation_id_seq CASCADE; 
     593DROP SEQUENCE IF EXISTS cd_datum_id_seq CASCADE; 
     594DROP SEQUENCE IF EXISTS cd_ellipsoid_id_seq CASCADE; 
     595DROP SEQUENCE IF EXISTS cd_engineeringdatum_id_seq CASCADE; 
     596DROP SEQUENCE IF EXISTS cd_geodeticdatum_id_seq CASCADE; 
     597DROP SEQUENCE IF EXISTS cd_imagedatum_id_seq CASCADE; 
     598DROP SEQUENCE IF EXISTS cd_primemeridian_id_seq CASCADE; 
     599DROP SEQUENCE IF EXISTS cd_seconddefiningparameter_id_seq CASCADE; 
     600DROP SEQUENCE IF EXISTS cd_verticaldatum_id_seq CASCADE; 
     601DROP SEQUENCE IF EXISTS ceda_acquisition_id_seq CASCADE; 
     602DROP SEQUENCE IF EXISTS ceda_citation_id_seq CASCADE; 
     603DROP SEQUENCE IF EXISTS ceda_compositeprocess_id_seq CASCADE; 
     604DROP SEQUENCE IF EXISTS ceda_instrument_id_seq CASCADE; 
     605DROP SEQUENCE IF EXISTS ceda_notes_id_seq CASCADE; 
     606DROP SEQUENCE IF EXISTS ceda_observationcollection_id_seq CASCADE; 
     607DROP SEQUENCE IF EXISTS ceda_observation_id_seq CASCADE; 
     608DROP SEQUENCE IF EXISTS ceda_operation_id_seq CASCADE; 
     609DROP SEQUENCE IF EXISTS ceda_platform_id_seq CASCADE; 
     610DROP SEQUENCE IF EXISTS ceda_process_id_seq CASCADE; 
     611DROP SEQUENCE IF EXISTS ceda_processing_id_seq CASCADE; 
     612DROP SEQUENCE IF EXISTS ceda_project_id_seq CASCADE; 
     613DROP SEQUENCE IF EXISTS ceda_result_id_seq CASCADE; 
     614DROP SEQUENCE IF EXISTS ceda_review_id_seq CASCADE; 
     615DROP SEQUENCE IF EXISTS ci_address_id_seq CASCADE; 
     616DROP SEQUENCE IF EXISTS ci_citation_id_seq CASCADE; 
     617DROP SEQUENCE IF EXISTS ci_contact_id_seq CASCADE; 
     618DROP SEQUENCE IF EXISTS ci_date_id_seq CASCADE; 
     619DROP SEQUENCE IF EXISTS ci_individual_id_seq CASCADE; 
     620DROP SEQUENCE IF EXISTS ci_onlineresource_id_seq CASCADE; 
     621DROP SEQUENCE IF EXISTS ci_organisation_id_seq CASCADE; 
     622DROP SEQUENCE IF EXISTS ci_party_id_seq CASCADE; 
     623DROP SEQUENCE IF EXISTS ci_responsibility_id_seq CASCADE; 
     624DROP SEQUENCE IF EXISTS ci_responsibleparty_id_seq CASCADE; 
     625DROP SEQUENCE IF EXISTS ci_responsiblepartyinfo_id_seq CASCADE; 
     626DROP SEQUENCE IF EXISTS ci_series_id_seq CASCADE; 
     627DROP SEQUENCE IF EXISTS ci_telephone_id_seq CASCADE; 
     628DROP SEQUENCE IF EXISTS class01_id_seq CASCADE; 
     629DROP SEQUENCE IF EXISTS class02_id_seq CASCADE; 
     630DROP SEQUENCE IF EXISTS class03_1_id_seq CASCADE; 
     631DROP SEQUENCE IF EXISTS class03_2_id_seq CASCADE; 
     632DROP SEQUENCE IF EXISTS class04_1_id_seq CASCADE; 
     633DROP SEQUENCE IF EXISTS class04_2_id_seq CASCADE; 
     634DROP SEQUENCE IF EXISTS class05_1_id_seq CASCADE; 
     635DROP SEQUENCE IF EXISTS class05_2_id_seq CASCADE; 
     636DROP SEQUENCE IF EXISTS class06_1_id_seq CASCADE; 
     637DROP SEQUENCE IF EXISTS class06_2_id_seq CASCADE; 
     638DROP SEQUENCE IF EXISTS class07_1_id_seq CASCADE; 
     639DROP SEQUENCE IF EXISTS class07_2_id_seq CASCADE; 
     640DROP SEQUENCE IF EXISTS class07_3_id_seq CASCADE; 
     641DROP SEQUENCE IF EXISTS class08_1_id_seq CASCADE; 
     642DROP SEQUENCE IF EXISTS class08_2_id_seq CASCADE; 
     643DROP SEQUENCE IF EXISTS class08_3_id_seq CASCADE; 
     644DROP SEQUENCE IF EXISTS class08_4_id_seq CASCADE; 
     645DROP SEQUENCE IF EXISTS class09_1_id_seq CASCADE; 
     646DROP SEQUENCE IF EXISTS class09_2_id_seq CASCADE; 
     647DROP SEQUENCE IF EXISTS class09_3_id_seq CASCADE; 
     648DROP SEQUENCE IF EXISTS class09_4_id_seq CASCADE; 
     649DROP SEQUENCE IF EXISTS class10_1_id_seq CASCADE; 
     650DROP SEQUENCE IF EXISTS class12_1_id_seq CASCADE; 
     651DROP SEQUENCE IF EXISTS class12_2_id_seq CASCADE; 
     652DROP SEQUENCE IF EXISTS class12_3_id_seq CASCADE; 
     653DROP SEQUENCE IF EXISTS class12_4_id_seq CASCADE; 
     654DROP SEQUENCE IF EXISTS cl_classificationcollection_id_seq CASCADE; 
     655DROP SEQUENCE IF EXISTS cl_dataset_id_seq CASCADE; 
     656DROP SEQUENCE IF EXISTS clocktime_id_seq CASCADE; 
     657DROP SEQUENCE IF EXISTS cs_affinecs_id_seq CASCADE; 
     658DROP SEQUENCE IF EXISTS cs_cartesiancs_id_seq CASCADE; 
     659DROP SEQUENCE IF EXISTS cs_coordinatesystemaxis_id_seq CASCADE; 
     660DROP SEQUENCE IF EXISTS cs_coordinatesystem_id_seq CASCADE; 
     661DROP SEQUENCE IF EXISTS cs_cylindricalcs_id_seq CASCADE; 
     662DROP SEQUENCE IF EXISTS cs_ellipsoidalcs_id_seq CASCADE; 
     663DROP SEQUENCE IF EXISTS cs_engineeringcs_id_seq CASCADE; 
     664DROP SEQUENCE IF EXISTS cs_geodeticcs_id_seq CASCADE; 
     665DROP SEQUENCE IF EXISTS cs_imagecs_id_seq CASCADE; 
     666DROP SEQUENCE IF EXISTS cs_linearcs_id_seq CASCADE; 
     667DROP SEQUENCE IF EXISTS cs_polarcs_id_seq CASCADE; 
     668DROP SEQUENCE IF EXISTS cs_sphericalcs_id_seq CASCADE; 
     669DROP SEQUENCE IF EXISTS cs_userdefinedcs_id_seq CASCADE; 
     670DROP SEQUENCE IF EXISTS cs_verticalcs_id_seq CASCADE; 
     671DROP SEQUENCE IF EXISTS cv_attributevalues_id_seq CASCADE; 
     672DROP SEQUENCE IF EXISTS cv_continuouscoverage_id_seq CASCADE; 
     673DROP SEQUENCE IF EXISTS cv_continuousquadrilateralgridcoverage_id_seq CASCADE; 
     674DROP SEQUENCE IF EXISTS cv_coverage_id_seq CASCADE; 
     675DROP SEQUENCE IF EXISTS cv_curvevaluepair_id_seq CASCADE; 
     676DROP SEQUENCE IF EXISTS cv_discretecoverage_id_seq CASCADE; 
     677DROP SEQUENCE IF EXISTS cv_discretecurvecoverage_id_seq CASCADE; 
     678DROP SEQUENCE IF EXISTS cv_discretegridpointcoverage_id_seq CASCADE; 
     679DROP SEQUENCE IF EXISTS cv_discretepointcoverage_id_seq CASCADE; 
     680DROP SEQUENCE IF EXISTS cv_discretesolidcoverage_id_seq CASCADE; 
     681DROP SEQUENCE IF EXISTS cv_discretesurfacecoverage_id_seq CASCADE; 
     682DROP SEQUENCE IF EXISTS cv_domainobject_id_seq CASCADE; 
     683DROP SEQUENCE IF EXISTS cv_footprint_id_seq CASCADE; 
     684DROP SEQUENCE IF EXISTS cv_geometryvaluepair_id_seq CASCADE; 
     685DROP SEQUENCE IF EXISTS cv_gridcell_id_seq CASCADE; 
     686DROP SEQUENCE IF EXISTS cv_gridcoordinate_id_seq CASCADE; 
     687DROP SEQUENCE IF EXISTS cv_gridenvelope_id_seq CASCADE; 
     688DROP SEQUENCE IF EXISTS cv_grid_id_seq CASCADE; 
     689DROP SEQUENCE IF EXISTS cv_gridpoint_id_seq CASCADE; 
     690DROP SEQUENCE IF EXISTS cv_gridpointvaluepair_id_seq CASCADE; 
     691DROP SEQUENCE IF EXISTS cv_gridvaluecell_id_seq CASCADE; 
     692DROP SEQUENCE IF EXISTS cv_gridvaluesmatrix_id_seq CASCADE; 
     693DROP SEQUENCE IF EXISTS cv_hexagonalgridcoverage_id_seq CASCADE; 
     694DROP SEQUENCE IF EXISTS cv_pointvaluepair_id_seq CASCADE; 
     695DROP SEQUENCE IF EXISTS cv_rectifiedgrid_id_seq CASCADE; 
     696DROP SEQUENCE IF EXISTS cv_referenceablegrid_id_seq CASCADE; 
     697DROP SEQUENCE IF EXISTS cv_segmentedcurvecoverage_id_seq CASCADE; 
     698DROP SEQUENCE IF EXISTS cv_sequencerule_id_seq CASCADE; 
     699DROP SEQUENCE IF EXISTS cv_solidvaluepair_id_seq CASCADE; 
     700DROP SEQUENCE IF EXISTS cv_surfacevaluepair_id_seq CASCADE; 
     701DROP SEQUENCE IF EXISTS cvt_discretetimeinstantcoverage_id_seq CASCADE; 
     702DROP SEQUENCE IF EXISTS cv_thiessenpolygoncoverage_id_seq CASCADE; 
     703DROP SEQUENCE IF EXISTS cv_thiessenvaluepolygon_id_seq CASCADE; 
     704DROP SEQUENCE IF EXISTS cv_tincoverage_id_seq CASCADE; 
     705DROP SEQUENCE IF EXISTS cvt_timeinstantvaluepair_id_seq CASCADE; 
     706DROP SEQUENCE IF EXISTS cv_valuecurve_id_seq CASCADE; 
     707DROP SEQUENCE IF EXISTS cv_valuehexagon_id_seq CASCADE; 
     708DROP SEQUENCE IF EXISTS cv_valueobject_id_seq CASCADE; 
     709DROP SEQUENCE IF EXISTS cv_valuesegment_id_seq CASCADE; 
     710DROP SEQUENCE IF EXISTS cv_valuetriangle_id_seq CASCADE; 
     711DROP SEQUENCE IF EXISTS date_id_seq CASCADE; 
     712DROP SEQUENCE IF EXISTS dateprecision_id_seq CASCADE; 
     713DROP SEQUENCE IF EXISTS datetime_id_seq CASCADE; 
     714DROP SEQUENCE IF EXISTS decimal_id_seq CASCADE; 
     715DROP SEQUENCE IF EXISTS directposition_id_seq CASCADE; 
     716DROP SEQUENCE IF EXISTS distance_id_seq CASCADE; 
     717DROP SEQUENCE IF EXISTS dq_absoluteexternalpositionalaccuracy_id_seq CASCADE; 
     718DROP SEQUENCE IF EXISTS dq_completeness_id_seq CASCADE; 
     719DROP SEQUENCE IF EXISTS dq_conformanceresult_id_seq CASCADE; 
     720DROP SEQUENCE IF EXISTS dq_dataquality_id_seq CASCADE; 
     721DROP SEQUENCE IF EXISTS dq_element_id_seq CASCADE; 
     722DROP SEQUENCE IF EXISTS dq_griddeddatapositionalaccuracy_id_seq CASCADE; 
     723DROP SEQUENCE IF EXISTS dq_logicalconsistency_id_seq CASCADE; 
     724DROP SEQUENCE IF EXISTS dq_positionalaccuracy_id_seq CASCADE; 
     725DROP SEQUENCE IF EXISTS dq_quantitativeresult_id_seq CASCADE; 
     726DROP SEQUENCE IF EXISTS dq_relativeinternalpositionalaccuracy_id_seq CASCADE; 
     727DROP SEQUENCE IF EXISTS dq_result_id_seq CASCADE; 
     728DROP SEQUENCE IF EXISTS dq_scope_id_seq CASCADE; 
     729DROP SEQUENCE IF EXISTS dq_temporalaccuracy_id_seq CASCADE; 
     730DROP SEQUENCE IF EXISTS dq_thematicaccuracy_id_seq CASCADE; 
     731DROP SEQUENCE IF EXISTS ds_aggregate_id_seq CASCADE; 
     732DROP SEQUENCE IF EXISTS ds_dataset_id_seq CASCADE; 
     733DROP SEQUENCE IF EXISTS ds_initiative_id_seq CASCADE; 
     734DROP SEQUENCE IF EXISTS ds_otheraggregate_id_seq CASCADE; 
     735DROP SEQUENCE IF EXISTS ds_series_id_seq CASCADE; 
     736DROP SEQUENCE IF EXISTS earootclass_id_seq CASCADE; 
     737DROP SEQUENCE IF EXISTS ex_boundingpolygon_id_seq CASCADE; 
     738DROP SEQUENCE IF EXISTS ex_extent_id_seq CASCADE; 
     739DROP SEQUENCE IF EXISTS ex_geographicboundingbox_id_seq CASCADE; 
     740DROP SEQUENCE IF EXISTS ex_geographicdescription_id_seq CASCADE; 
     741DROP SEQUENCE IF EXISTS ex_geographicextent_id_seq CASCADE; 
     742DROP SEQUENCE IF EXISTS ex_temporalextent_id_seq CASCADE; 
     743DROP SEQUENCE IF EXISTS ex_verticalextent_id_seq CASCADE; 
     744DROP SEQUENCE IF EXISTS genericname_id_seq CASCADE; 
     745DROP SEQUENCE IF EXISTS gf_aggregationtype_id_seq CASCADE; 
     746DROP SEQUENCE IF EXISTS gf_associationrole_id_seq CASCADE; 
     747DROP SEQUENCE IF EXISTS gf_associationtype_id_seq CASCADE; 
     748DROP SEQUENCE IF EXISTS gf_attributetype_id_seq CASCADE; 
     749DROP SEQUENCE IF EXISTS gf_constraint_id_seq CASCADE; 
     750DROP SEQUENCE IF EXISTS gf_featuretype_id_seq CASCADE; 
     751DROP SEQUENCE IF EXISTS gfi_domainfeature_id_seq CASCADE; 
     752DROP SEQUENCE IF EXISTS gfi_feature_id_seq CASCADE; 
     753DROP SEQUENCE IF EXISTS gf_inheritancerelation_id_seq CASCADE; 
     754DROP SEQUENCE IF EXISTS gf_locationalattributetype_id_seq CASCADE; 
     755DROP SEQUENCE IF EXISTS gf_metadataattributetype_id_seq CASCADE; 
     756DROP SEQUENCE IF EXISTS gf_operation_id_seq CASCADE; 
     757DROP SEQUENCE IF EXISTS gf_propertytype_id_seq CASCADE; 
     758DROP SEQUENCE IF EXISTS gf_spatialassociationtype_id_seq CASCADE; 
     759DROP SEQUENCE IF EXISTS gf_spatialattributetype_id_seq CASCADE; 
     760DROP SEQUENCE IF EXISTS gf_temporalassociationtype_id_seq CASCADE; 
     761DROP SEQUENCE IF EXISTS gf_temporalattributetype_id_seq CASCADE; 
     762DROP SEQUENCE IF EXISTS gf_thematicattributetype_id_seq CASCADE; 
     763DROP SEQUENCE IF EXISTS gm_affineplacement_id_seq CASCADE; 
     764DROP SEQUENCE IF EXISTS gm_aggregate_id_seq CASCADE; 
     765DROP SEQUENCE IF EXISTS gm_arcstringbybulge_id_seq CASCADE; 
     766DROP SEQUENCE IF EXISTS gm_arcstring_id_seq CASCADE; 
     767DROP SEQUENCE IF EXISTS gm_boundary_id_seq CASCADE; 
     768DROP SEQUENCE IF EXISTS gm_clothoid_id_seq CASCADE; 
     769DROP SEQUENCE IF EXISTS gm_complex_id_seq CASCADE; 
     770DROP SEQUENCE IF EXISTS gm_compositecurve_id_seq CASCADE; 
     771DROP SEQUENCE IF EXISTS gm_composite_id_seq CASCADE; 
     772DROP SEQUENCE IF EXISTS gm_compositepoint_id_seq CASCADE; 
     773DROP SEQUENCE IF EXISTS gm_compositesolid_id_seq CASCADE; 
     774DROP SEQUENCE IF EXISTS gm_compositesurface_id_seq CASCADE; 
     775DROP SEQUENCE IF EXISTS gm_conic_id_seq CASCADE; 
     776DROP SEQUENCE IF EXISTS gm_curve_id_seq CASCADE; 
     777DROP SEQUENCE IF EXISTS gm_curvesegment_id_seq CASCADE; 
     778DROP SEQUENCE IF EXISTS gm_geodesicstring_id_seq CASCADE; 
     779DROP SEQUENCE IF EXISTS gm_knot_id_seq CASCADE; 
     780DROP SEQUENCE IF EXISTS gm_linestring_id_seq CASCADE; 
     781DROP SEQUENCE IF EXISTS gm_object_id_seq CASCADE; 
     782DROP SEQUENCE IF EXISTS gm_offsetcurve_id_seq CASCADE; 
     783DROP SEQUENCE IF EXISTS gm_orientablecurve_id_seq CASCADE; 
     784DROP SEQUENCE IF EXISTS gm_orientableprimitive_id_seq CASCADE; 
     785DROP SEQUENCE IF EXISTS gm_orientablesurface_id_seq CASCADE; 
     786DROP SEQUENCE IF EXISTS gm_parametriccurvesurface_id_seq CASCADE; 
     787DROP SEQUENCE IF EXISTS gm_pointarray_id_seq CASCADE; 
     788DROP SEQUENCE IF EXISTS gm_point_id_seq CASCADE; 
     789DROP SEQUENCE IF EXISTS gm_pointref_id_seq CASCADE; 
     790DROP SEQUENCE IF EXISTS gm_polygon_id_seq CASCADE; 
     791DROP SEQUENCE IF EXISTS gm_polyhedralsurface_id_seq CASCADE; 
     792DROP SEQUENCE IF EXISTS gm_position_id_seq CASCADE; 
     793DROP SEQUENCE IF EXISTS gm_primitiveboundary_id_seq CASCADE; 
     794DROP SEQUENCE IF EXISTS gm_primitive_id_seq CASCADE; 
     795DROP SEQUENCE IF EXISTS gm_ring_id_seq CASCADE; 
     796DROP SEQUENCE IF EXISTS gm_solid_id_seq CASCADE; 
     797DROP SEQUENCE IF EXISTS gm_splinecurve_id_seq CASCADE; 
     798DROP SEQUENCE IF EXISTS gm_surfaceboundary_id_seq CASCADE; 
     799DROP SEQUENCE IF EXISTS gm_surface_id_seq CASCADE; 
     800DROP SEQUENCE IF EXISTS gm_surfacepatch_id_seq CASCADE; 
     801DROP SEQUENCE IF EXISTS gm_tin_id_seq CASCADE; 
     802DROP SEQUENCE IF EXISTS gm_triangle_id_seq CASCADE; 
     803DROP SEQUENCE IF EXISTS gm_triangulatedsurface_id_seq CASCADE; 
     804DROP SEQUENCE IF EXISTS if_classificationattributetype_id_seq CASCADE; 
     805DROP SEQUENCE IF EXISTS io_identifiedobjectbase_id_seq CASCADE; 
     806DROP SEQUENCE IF EXISTS io_identifiedobject_id_seq CASCADE; 
     807DROP SEQUENCE IF EXISTS juliandate_id_seq CASCADE; 
     808DROP SEQUENCE IF EXISTS le_algorithm_id_seq CASCADE; 
     809DROP SEQUENCE IF EXISTS length_id_seq CASCADE; 
     810DROP SEQUENCE IF EXISTS le_nominalresolution_id_seq CASCADE; 
     811DROP SEQUENCE IF EXISTS le_source_id_seq CASCADE; 
     812DROP SEQUENCE IF EXISTS li_lineage_id_seq CASCADE; 
     813DROP SEQUENCE IF EXISTS li_processstep_id_seq CASCADE; 
     814DROP SEQUENCE IF EXISTS li_source_id_seq CASCADE; 
     815DROP SEQUENCE IF EXISTS localname_id_seq CASCADE; 
     816DROP SEQUENCE IF EXISTS location_id_seq CASCADE; 
     817DROP SEQUENCE IF EXISTS md_aggregateinformation_id_seq CASCADE; 
     818DROP SEQUENCE IF EXISTS md_applicationschemainformation_id_seq CASCADE; 
     819DROP SEQUENCE IF EXISTS md_browsegraphic_id_seq CASCADE; 
     820DROP SEQUENCE IF EXISTS md_constraints_id_seq CASCADE; 
     821DROP SEQUENCE IF EXISTS md_contentinformation_id_seq CASCADE; 
     822DROP SEQUENCE IF EXISTS md_coveragedescription_id_seq CASCADE; 
     823DROP SEQUENCE IF EXISTS md_digitaltransferoptions_id_seq CASCADE; 
     824DROP SEQUENCE IF EXISTS md_dimension_id_seq CASCADE; 
     825DROP SEQUENCE IF EXISTS md_distribution_id_seq CASCADE; 
     826DROP SEQUENCE IF EXISTS md_distributor_id_seq CASCADE; 
     827DROP SEQUENCE IF EXISTS md_extendedelementinformation_id_seq CASCADE; 
     828DROP SEQUENCE IF EXISTS md_featurecataloguedescription_id_seq CASCADE; 
     829DROP SEQUENCE IF EXISTS md_format_id_seq CASCADE; 
     830DROP SEQUENCE IF EXISTS md_geometricobjects_id_seq CASCADE; 
     831DROP SEQUENCE IF EXISTS md_gridspatialrepresentation_id_seq CASCADE; 
     832DROP SEQUENCE IF EXISTS md_identification_id_seq CASCADE; 
     833DROP SEQUENCE IF EXISTS md_identifier_id_seq CASCADE; 
     834DROP SEQUENCE IF EXISTS md_imagedescription_id_seq CASCADE; 
     835DROP SEQUENCE IF EXISTS md_keywords_id_seq CASCADE; 
     836DROP SEQUENCE IF EXISTS md_legalconstraints_id_seq CASCADE; 
     837DROP SEQUENCE IF EXISTS md_maintenanceinformation_id_seq CASCADE; 
     838DROP SEQUENCE IF EXISTS md_medium_id_seq CASCADE; 
     839DROP SEQUENCE IF EXISTS md_metadataextensioninformation_id_seq CASCADE; 
     840DROP SEQUENCE IF EXISTS md_metadata_id_seq CASCADE; 
     841DROP SEQUENCE IF EXISTS md_portrayalcataloguereference_id_seq CASCADE; 
     842DROP SEQUENCE IF EXISTS md_rangedimension_id_seq CASCADE; 
     843DROP SEQUENCE IF EXISTS md_referencesystem_id_seq CASCADE; 
     844DROP SEQUENCE IF EXISTS md_representativefraction_id_seq CASCADE; 
     845DROP SEQUENCE IF EXISTS md_scopedescription_id_seq CASCADE; 
     846DROP SEQUENCE IF EXISTS md_securityconstraints_id_seq CASCADE; 
     847DROP SEQUENCE IF EXISTS md_spatialrepresentation_id_seq CASCADE; 
     848DROP SEQUENCE IF EXISTS md_standardorderprocess_id_seq CASCADE; 
     849DROP SEQUENCE IF EXISTS md_usage_id_seq CASCADE; 
     850DROP SEQUENCE IF EXISTS md_vectorspatialrepresentation_id_seq CASCADE; 
     851DROP SEQUENCE IF EXISTS measure_id_seq CASCADE; 
     852DROP SEQUENCE IF EXISTS membername_id_seq CASCADE; 
     853DROP SEQUENCE IF EXISTS mi_coveragedescription_id_seq CASCADE; 
     854DROP SEQUENCE IF EXISTS mi_rangeelementdescription_id_seq CASCADE; 
     855DROP SEQUENCE IF EXISTS mo_acquisition_id_seq CASCADE; 
     856DROP SEQUENCE IF EXISTS mo_compositeprocess_id_seq CASCADE; 
     857DROP SEQUENCE IF EXISTS mo_computation_id_seq CASCADE; 
     858DROP SEQUENCE IF EXISTS mo_featureofinterest_id_seq CASCADE; 
     859DROP SEQUENCE IF EXISTS mo_inputoutput_id_seq CASCADE; 
     860DROP SEQUENCE IF EXISTS mo_instrument_id_seq CASCADE; 
     861DROP SEQUENCE IF EXISTS mo_instrumentplatformpair_id_seq CASCADE; 
     862DROP SEQUENCE IF EXISTS mo_location_id_seq CASCADE; 
     863DROP SEQUENCE IF EXISTS mo_observationcollection_id_seq CASCADE; 
     864DROP SEQUENCE IF EXISTS mo_observation_id_seq CASCADE; 
     865DROP SEQUENCE IF EXISTS mo_onlineresource_id_seq CASCADE; 
     866DROP SEQUENCE IF EXISTS mo_operation_id_seq CASCADE; 
     867DROP SEQUENCE IF EXISTS mo_organization_id_seq CASCADE; 
     868DROP SEQUENCE IF EXISTS mo_platform_id_seq CASCADE; 
     869DROP SEQUENCE IF EXISTS mo_process_id_seq CASCADE; 
     870DROP SEQUENCE IF EXISTS mo_processing_id_seq CASCADE; 
     871DROP SEQUENCE IF EXISTS mo_project_id_seq CASCADE; 
     872DROP SEQUENCE IF EXISTS mo_responsiblepartyinfo_id_seq CASCADE; 
     873DROP SEQUENCE IF EXISTS mo_result_id_seq CASCADE; 
     874DROP SEQUENCE IF EXISTS multiplicity_id_seq CASCADE; 
     875DROP SEQUENCE IF EXISTS multiplicityrange_id_seq CASCADE; 
     876DROP SEQUENCE IF EXISTS mx_datafile_id_seq CASCADE; 
     877DROP SEQUENCE IF EXISTS namedvalue_id_seq CASCADE; 
     878DROP SEQUENCE IF EXISTS namespace_id_seq CASCADE; 
     879DROP SEQUENCE IF EXISTS om_categoryobservation_id_seq CASCADE; 
     880DROP SEQUENCE IF EXISTS om_complexobservation_id_seq CASCADE; 
     881DROP SEQUENCE IF EXISTS om_countobservation_id_seq CASCADE; 
     882DROP SEQUENCE IF EXISTS om_discretecoverageobservation_id_seq CASCADE; 
     883DROP SEQUENCE IF EXISTS om_geometryobservation_id_seq CASCADE; 
     884DROP SEQUENCE IF EXISTS om_measurement_id_seq CASCADE; 
     885DROP SEQUENCE IF EXISTS om_observation_id_seq CASCADE; 
     886DROP SEQUENCE IF EXISTS om_process_id_seq CASCADE; 
     887DROP SEQUENCE IF EXISTS om_temporalobservation_id_seq CASCADE; 
     888DROP SEQUENCE IF EXISTS om_truthobservation_id_seq CASCADE; 
     889DROP SEQUENCE IF EXISTS qe_coverageresult_id_seq CASCADE; 
     890DROP SEQUENCE IF EXISTS qe_usability_id_seq CASCADE; 
     891DROP SEQUENCE IF EXISTS record_id_seq CASCADE; 
     892DROP SEQUENCE IF EXISTS recordtype_id_seq CASCADE; 
     893DROP SEQUENCE IF EXISTS rs_identifier_id_seq CASCADE; 
     894DROP SEQUENCE IF EXISTS rs_referencesystem_id_seq CASCADE; 
     895DROP SEQUENCE IF EXISTS scale_id_seq CASCADE; 
     896DROP SEQUENCE IF EXISTS sc_compoundcrs_id_seq CASCADE; 
     897DROP SEQUENCE IF EXISTS sc_crs_id_seq CASCADE; 
     898DROP SEQUENCE IF EXISTS sc_derivedcrs_id_seq CASCADE; 
     899DROP SEQUENCE IF EXISTS sc_engineeringcrs_id_seq CASCADE; 
     900DROP SEQUENCE IF EXISTS sc_generalderivedcrs_id_seq CASCADE; 
     901DROP SEQUENCE IF EXISTS sc_geodeticcrs_id_seq CASCADE; 
     902DROP SEQUENCE IF EXISTS schema_id_seq CASCADE; 
     903DROP SEQUENCE IF EXISTS sc_imagecrs_id_seq CASCADE; 
     904DROP SEQUENCE IF EXISTS scopedname_id_seq CASCADE; 
     905DROP SEQUENCE IF EXISTS sc_projectedcrs_id_seq CASCADE; 
     906DROP SEQUENCE IF EXISTS sc_singlecrs_id_seq CASCADE; 
     907DROP SEQUENCE IF EXISTS sc_verticalcrs_id_seq CASCADE; 
     908DROP SEQUENCE IF EXISTS sf_process_id_seq CASCADE; 
     909DROP SEQUENCE IF EXISTS sf_samplingfeature_id_seq CASCADE; 
     910DROP SEQUENCE IF EXISTS sf_spatialsamplingfeature_id_seq CASCADE; 
     911DROP SEQUENCE IF EXISTS sf_specimen_id_seq CASCADE; 
     912DROP SEQUENCE IF EXISTS time_id_seq CASCADE; 
     913DROP SEQUENCE IF EXISTS tm_caldate_id_seq CASCADE; 
     914DROP SEQUENCE IF EXISTS tm_calendarera_id_seq CASCADE; 
     915DROP SEQUENCE IF EXISTS tm_calendar_id_seq CASCADE; 
     916DROP SEQUENCE IF EXISTS tm_clock_id_seq CASCADE; 
     917DROP SEQUENCE IF EXISTS tm_clocktime_id_seq CASCADE; 
     918DROP SEQUENCE IF EXISTS tm_complex_id_seq CASCADE; 
     919DROP SEQUENCE IF EXISTS tm_coordinate_id_seq CASCADE; 
     920DROP SEQUENCE IF EXISTS tm_coordinatesystem_id_seq CASCADE; 
     921DROP SEQUENCE IF EXISTS tm_duration_id_seq CASCADE; 
     922DROP SEQUENCE IF EXISTS tm_edge_id_seq CASCADE; 
     923DROP SEQUENCE IF EXISTS tm_geometricprimitive_id_seq CASCADE; 
     924DROP SEQUENCE IF EXISTS tm_instant_id_seq CASCADE; 
     925DROP SEQUENCE IF EXISTS tm_node_id_seq CASCADE; 
     926DROP SEQUENCE IF EXISTS tm_object_id_seq CASCADE; 
     927DROP SEQUENCE IF EXISTS tm_ordinalera_id_seq CASCADE; 
     928DROP SEQUENCE IF EXISTS tm_ordinalposition_id_seq CASCADE; 
     929DROP SEQUENCE IF EXISTS tm_ordinalreferencesystem_id_seq CASCADE; 
     930DROP SEQUENCE IF EXISTS tm_periodduration_id_seq CASCADE; 
     931DROP SEQUENCE IF EXISTS tm_period_id_seq CASCADE; 
     932DROP SEQUENCE IF EXISTS tm_position_id_seq CASCADE; 
     933DROP SEQUENCE IF EXISTS tm_primitive_id_seq CASCADE; 
     934DROP SEQUENCE IF EXISTS tm_referencesystem_id_seq CASCADE; 
     935DROP SEQUENCE IF EXISTS tm_temporalcrs_id_seq CASCADE; 
     936DROP SEQUENCE IF EXISTS tm_temporalposition_id_seq CASCADE; 
     937DROP SEQUENCE IF EXISTS tm_topologicalcomplex_id_seq CASCADE; 
     938DROP SEQUENCE IF EXISTS tm_topologicalprimitive_id_seq CASCADE; 
     939DROP SEQUENCE IF EXISTS tp_boundary_id_seq CASCADE; 
     940DROP SEQUENCE IF EXISTS tp_complex_id_seq CASCADE; 
     941DROP SEQUENCE IF EXISTS tp_directededge_id_seq CASCADE; 
     942DROP SEQUENCE IF EXISTS tp_directedface_id_seq CASCADE; 
     943DROP SEQUENCE IF EXISTS tp_directednode_id_seq CASCADE; 
     944DROP SEQUENCE IF EXISTS tp_directedsolid_id_seq CASCADE; 
     945DROP SEQUENCE IF EXISTS tp_directedtopo_id_seq CASCADE; 
     946DROP SEQUENCE IF EXISTS tp_edge_id_seq CASCADE; 
     947DROP SEQUENCE IF EXISTS tp_expression_id_seq CASCADE; 
     948DROP SEQUENCE IF EXISTS tp_expressionterm_id_seq CASCADE; 
     949DROP SEQUENCE IF EXISTS tp_face_id_seq CASCADE; 
     950DROP SEQUENCE IF EXISTS tp_node_id_seq CASCADE; 
     951DROP SEQUENCE IF EXISTS tp_primitive_id_seq CASCADE; 
     952DROP SEQUENCE IF EXISTS tp_ring_id_seq CASCADE; 
     953DROP SEQUENCE IF EXISTS tp_shell_id_seq CASCADE; 
     954DROP SEQUENCE IF EXISTS tp_solid_id_seq CASCADE; 
     955DROP SEQUENCE IF EXISTS type_id_seq CASCADE; 
     956DROP SEQUENCE IF EXISTS typename_id_seq CASCADE; 
     957DROP SEQUENCE IF EXISTS unitofmeasure_id_seq CASCADE; 
     958DROP SEQUENCE IF EXISTS unlimitedinteger_id_seq CASCADE; 
     959DROP SEQUENCE IF EXISTS uomangle_id_seq CASCADE; 
     960DROP SEQUENCE IF EXISTS uomlength_id_seq CASCADE; 
     961DROP SEQUENCE IF EXISTS uomscale_id_seq CASCADE; 
     962DROP SEQUENCE IF EXISTS url_id_seq CASCADE; 
Note: See TracChangeset for help on using the changeset viewer.