Changeset 28802
- Timestamp:
- 2014-01-30T15:11:04+13:00 (9 years ago)
- Location:
- gs2-extensions/apache-jena/trunk/src/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/apache-jena/trunk/src/perllib/jenaTDBBuilder.pm
r28410 r28802 98 98 99 99 } 100 100 101 101 # Run the docs through the jenaTDB document processor 102 102 103 103 $self->{'buildproc'}->set_mode ('text'); 104 104 $self->{'buildproc'}->reset(); 105 106 # If '-removeold' in effect (i.e. *not* keepold), then clear out 107 # the triple-store graph for this collection 108 109 if (!$self->{'keepold'}) { 110 my $collection = $self->{'collection'}; 111 my $cmd = "gs-triplestore-reset $collection"; 112 113 my $status = system($cmd); 114 if ($status == 0) { 115 print $outhandle " => removeold: Deleting triplestore graph for $collection\n"; 116 } 117 else { 118 print STDERR "Error: failed to run:\n $cmd\n$!\n"; 119 print STDERR " Graph has not been deleted\n"; 120 } 121 } 122 105 123 &plugin::begin($self->{'pluginfo'}, $self->{'source_dir'}, 106 124 $self->{'buildproc'}, $self->{'maxdocs'}); -
gs2-extensions/apache-jena/trunk/src/perllib/jenaTDBBuildproc.pm
r28488 r28802 148 148 } 149 149 150 open(*XMLWRITER, $cmd) 151 or die "can't open pipe to xslt: $!"; 152 153 $self->{'xslt_writer'} = *XMLWRITER; 154 155 print XMLWRITER "<?DocStart?>\n"; 156 print XMLWRITER "$output_file_name\n"; 157 150 if (!open(*XMLWRITER, $cmd)) { 151 print STDERR "Can't open pipe to xslt: $!"; 152 print STDERR "Command was:\n $cmd\n"; 153 $self->{'xslt_writer'} = undef; 154 } 155 else { 156 $self->{'xslt_writer'} = *XMLWRITER; 157 158 print XMLWRITER "<?DocStart?>\n"; 159 print XMLWRITER "$output_file_name\n"; 160 } 158 161 } 159 162 … … 163 166 my $self = shift @_; 164 167 165 166 168 return unless defined $self->{'xslt_writer'} ; 167 169 … … 203 205 $self->open_xslt_pipe($tmp_doc_filename_cc, $xslt_filename); # stops with error if not able to open pipe 204 206 205 my $outhandler = $self->{'xslt_writer'}; 206 binmode($outhandler,":utf8"); 207 208 my $section_text = &docprint::get_section_xml($doc_obj,$doc_obj->get_top_section()); 207 my $xml_outhandler = $self->{'xslt_writer'}; 208 209 if (defined $xml_outhandler) { 210 binmode($xml_outhandler,":utf8"); 211 212 my $section_text = &docprint::get_section_xml($doc_obj,$doc_obj->get_top_section()); 209 213 210 214 # $section_text =~ s/[\r\n]+$//s; # remove very last newline char … … 229 233 # exit -1; 230 234 231 235 $section_text =~ s/(<Metadata[^>]*>)(.*?)(<\/Metadata>)/&make_ttl_safe($1,$2,$3)/gse; 232 236 233 237 ## $1&make_ttl_safe($2)$3 … … 236 240 237 241 238 print $outhandler $section_text; 242 print $xml_outhandler $section_text; 243 } 239 244 240 245 $self->close_xslt_pipe(); 241 246 242 # now feed t ogenerated file to jena's (TDB) tripple store247 # now feed the generated file to jena's (TDB) tripple store 243 248 244 249 my $outhandle = $self->{'outhandle'};
Note:
See TracChangeset
for help on using the changeset viewer.