source: gs2-extensions/apache-jena/trunk/src/perllib/jenaTDBBuilder.pm@ 28410

Last change on this file since 28410 was 28410, checked in by davidb, 11 years ago

Code now runs an XSLT over the doc.xml file

File size: 3.1 KB
Line 
1###########################################################################
2#
3# jenaTDBBuilder.pm -- topup builder that gets jenaTDB initialized correctly
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 1999 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
27package jenaTDBBuilder;
28
29use strict;
30no strict 'refs'; # allow filehandles to be variables and viceversa
31
32use util;
33use FileUtils;
34
35use extrabuilder;
36
37sub BEGIN {
38 @jenaTDBBuilder::ISA = ('extrabuilder');
39}
40
41
42sub new {
43 my $class = shift(@_);
44 my $self = new extrabuilder (@_);
45 $self = bless $self, $class;
46
47 $self->{'buildtype'} = "jenaTDB";
48
49 return $self;
50}
51
52
53sub default_buildproc {
54 my $self = shift (@_);
55
56 return "jenaTDBBuildproc";
57}
58
59
60sub build_indexes {
61 my $self = shift (@_);
62 my ($indexname) = @_;
63
64 my $outhandle = $self->{'outhandle'};
65 my $build_dir = $self->{'build_dir'};
66 my $verbosity = $self->{'verbosity'};
67
68 print $outhandle "\n*** Apache Jena TDB-configured Tripple store\n" if ($verbosity >= 1);
69
70 my $jenaTDB_dir = &util::filename_cat($build_dir, "jenaTDB");
71
72 if (! -d $jenaTDB_dir) {
73 &FileUtils::makeAllDirectories($jenaTDB_dir);
74 }
75
76 my $opt_create_index = ($self->{'incremental'}) ? "" : "-removeold";
77
78
79 if ($opt_create_index) {
80
81 # init an jenaTDB database
82
83# my $adb_filename = &util::filename_cat($jenaTDB_dir,"lsh-features.adb");
84
85 print $outhandle "\n creating jenaTDB dataset for collection\n" if ($verbosity >= 1);
86
87# my $init_cmd = "jenaTDB -N -d $adb_filename";
88# my $init_status = system($init_cmd);
89# if ($init_status != 0) {
90# print STDERR "Error: failed to initialize the jenaTDB database\n";
91# print STDERR " $adb_filename\n";
92# print STDERR " $!\n";
93# if ($verbosity>=2) {
94# print STDERR " cmd: $init_cmd\n";
95# }
96# return;
97# }
98
99 }
100
101 # Run the docs through the jenaTDB document processor
102
103 $self->{'buildproc'}->set_mode ('text');
104 $self->{'buildproc'}->reset();
105 &plugin::begin($self->{'pluginfo'}, $self->{'source_dir'},
106 $self->{'buildproc'}, $self->{'maxdocs'});
107 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
108 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
109 &plugin::end($self->{'pluginfo'});
110
111
112}
113
1141;
115
Note: See TracBrowser for help on using the repository browser.