NAME

loadDB - Create the SemiS database from a text file specification.


SYNOPSIS

  loadDB
    [-help] |
    [-version] |
    [-verbose] 
    [-databaseName databaseName] 
    [-databaseMode GDBM | DBM | BSD] 
    < CompanyDB


DESCRIPTION

loadDB reads the text file representation of a semi-structured DB and creates the necessary DB.


EXAMPLE USAGE

Create the specifications.

 perl -I../lib loadDB -verbose CompanyDB

See also the SemiStructuredDB manpage.


OPTIONS

-help
Display a short help message with a reminder of supported command-line options.

-version
Display the version of loadDB.

-verbose
Enable verbose reporting.

-databaseName databaseName
The name of the database, overides the default name in the SemiStructuredDB::Constants manpage.

-databaseMode databaseMode
The mode of the database, overides the default mode in the SemiStructuredDB::Constants manpage.


NAME Main


Parse the text file and create the SemiS DB.

=head1 DESCRIPTION

This is the parser for the specification file.  It is a top-down
recursive descent parser.

=cut

#-----------------------------------------------------------------------
# Parse the command line
#-----------------------------------------------------------------------
  &ParseCommandLine();
  my $globals = new SemiStructuredDB::Globals();
  $Global::SSGraph = $globals->{'SSGraph'};
  my $parser = new Parser::LoadDB();
  $parser->Run();
  #&dump('&root', '', '');

  print "alldone!\n" if $VERBOSE;
  #foreach (keys %Global::Paths) { print "$_\n"; }

#----------------------------------------------------------------------- # Dump the paths # No longer works, must fix the Globals #----------------------------------------------------------------------- sub dump { my ($current,$prefix,$cleanPrefix) = @_; die ``Undefined object $current'' unless defined $Global::Values{$current}; die ``Undefined object $current'' unless defined $Global::Objects{$current}; my $values = $Global::Values{$current}; my $objects = $Global::Objects{$current}; foreach (@$objects) { my ($edge, $rest) = @$_; #print ``$prefix.$current.$edge\n''; if ($current eq '&root') { &dump ($rest, ``$edge'', ``$edge''); } else { $Global::Paths{``$cleanPrefix.$edge''} = 1; &dump ($rest, ``$prefix.$current.$edge'', ``$cleanPrefix.$edge''); } } foreach (@$values) { my ($edge, $rest) = @$_; $Global::Paths{``$cleanPrefix.$edge''} = 1; print ``$prefix.$current.$edge.$rest\n''; }

  }

#------------------------------------------------------------------------ # ParseCommandLine() - handle command line #------------------------------------------------------------------------ sub ParseCommandLine { my @switches = ( 'databaseMode=s', \$SemiStructuredDB::Constants::databaseMode, 'databaseName=s', \$SemiStructuredDB::Constants::databaseName, 'help', \$HELP, 'verbose', \$VERBOSE, 'version', \$SHOW_VERSION, );

  &GetOptions(@switches) || die "use -help switch to display brief help\n";
  if ($SHOW_VERSION) {
    print "This is $COMMAND_NAME, version $VERSION\n";
    exit 0;
    }

  if ($HELP) {
    print <<HelpEnd;
    $COMMAND_NAME, v$VERSION - parse the Incomplete Data Cube specifications

    Usage: $COMMAND_NAME 
                         [-help] |
                         [-version] |
                         [-verbose]
                         [-databaseName databaseName]
                         [-databaseMode GDBM | DBM | BSD]
                         < inputFile

        -help            : display this message
        -verbose         : display verbose information as running
        -databaseName name : name of the database
        -databaseMode mode : mode for the database 

HelpEnd exit 0; }

}