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

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

Simple version that looks for a hardwired title as metadata

File size: 3.1 KB
RevLine 
[28391]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;
[28392]30no strict 'refs'; # allow filehandles to be variables and viceversa
[28391]31
32use extrabuilder;
33
34sub BEGIN {
35 @jenaTDBBuilder::ISA = ('extrabuilder');
36}
37
38
39sub new {
40 my $class = shift(@_);
41 my $self = new extrabuilder (@_);
42 $self = bless $self, $class;
43
44 $self->{'buildtype'} = "jenaTDB";
45
46 return $self;
47}
48
49
50sub default_buildproc {
51 my $self = shift (@_);
52
53 return "jenaTDBBuildproc";
54}
55
56
57sub build_indexes {
58 my $self = shift (@_);
59 my ($indexname) = @_;
60
61 my $outhandle = $self->{'outhandle'};
62 my $build_dir = $self->{'build_dir'};
63 my $verbosity = $self->{'verbosity'};
64
65 print $outhandle "\n*** Apache Jena TDB-configured Tripple store\n" if ($verbosity >= 1);
66
67 my $jenaTDB_dir = &util::filename_cat($build_dir, "jenaTDB");
68
69 if (! -d $jenaTDB_dir) {
70 &util::mk_all_dir ($jenaTDB_dir);
71 }
72
73 my $opt_create_index = ($self->{'incremental'}) ? "" : "-removeold";
74
75
76 if ($opt_create_index) {
77
78 # init an jenaTDB database
79
80# my $adb_filename = &util::filename_cat($jenaTDB_dir,"lsh-features.adb");
81
82 print $outhandle "\n creating jenaTDB dataset for collection\n" if ($verbosity >= 1);
83
84# my $init_cmd = "jenaTDB -N -d $adb_filename";
85# my $init_status = system($init_cmd);
86# if ($init_status != 0) {
87# print STDERR "Error: failed to initialize the jenaTDB database\n";
88# print STDERR " $adb_filename\n";
89# print STDERR " $!\n";
90# if ($verbosity>=2) {
91# print STDERR " cmd: $init_cmd\n";
92# }
93# return;
94# }
95
96 }
97
98 # Run the docs through the jenaTDB document processor
99
100 $self->{'buildproc'}->set_mode ('text');
101 $self->{'buildproc'}->reset();
102 &plugin::begin($self->{'pluginfo'}, $self->{'source_dir'},
103 $self->{'buildproc'}, $self->{'maxdocs'});
104 &plugin::read ($self->{'pluginfo'}, $self->{'source_dir'},
105 "", {}, {}, $self->{'buildproc'}, $self->{'maxdocs'}, 0, $self->{'gli'});
106 &plugin::end($self->{'pluginfo'});
107
108
109}
110
1111;
112
Note: See TracBrowser for help on using the repository browser.