Changeset 28488


Ignore:
Timestamp:
10/17/13 17:03:01 (7 years ago)
Author:
davidb
Message:

Further work was necessary to better process the data passing through to be suitable escaped for TTL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/apache-jena/trunk/src/perllib/jenaTDBBuildproc.pm

    r28468 r28488  
    8585    my ($hashmap,$value) = @_;
    8686   
    87     print STDERR "*** checking value = '$value'\n";
    88 
    89     print STDERR "*** lookup = ", $hashmap->{$value}, "\n";
    90 
    9187    my $lookup = (defined $hashmap->{$value}) ? $hashmap->{$value} : "\@$value\@";
    9288
     
    179175}
    180176
     177sub make_ttl_safe
     178{
     179    my ($front,$str,$back) = @_;
     180   
     181    $str =~ s/\\/\\\\/g;
     182   
     183    $str =~ s/\&#x([0-9A-F]+);/chr(hex($1))/eig;
     184    $str =~ s/\&#([0-9]+);/chr($1)/eig;
     185
     186    $str =~ s/[\r\n]+/\\n/g;
     187
     188    return "$front$str$back";
     189}
    181190
    182191sub textedit {
     
    198207
    199208    my $section_text = &docprint::get_section_xml($doc_obj,$doc_obj->get_top_section());
     209
     210#    $section_text =~ s/[\r\n]+$//s; # remove very last newline char
     211
     212##    $section_text =~ s/&#x([0-9A-F]+);/chr(hex($1))/eig;
     213##    $section_text =~ s/\&#([0-9]+);/chr($1)/eig;
     214
     215#    $section_text =~ s/\\/\\\\/g;
     216
     217#    $section_text =~ s/\&#x([0-9A-F]+);/chr(hex($1))/eig;
     218#    $section_text =~ s/\&#([0-9]+);/chr($1)/eig;
     219
     220#    $section_text =~ s/(\r|\n)+/<br \/>/gs;
     221#    $section_text =~ s/[\r\n]+/ /gs;
     222
     223##    $section_text =~ s/\n/ AND /gs;
     224
     225#    open(DOUT,">/tmp/debug.xml") || die "Failed to open";
     226#    print DOUT $section_text;
     227#    print DOUT "\n";
     228#    close DOUT;
     229#    exit -1;
     230
     231    $section_text =~ s/(<Metadata[^>]*>)(.*?)(<\/Metadata>)/&make_ttl_safe($1,$2,$3)/gse;
     232
     233## $1&make_ttl_safe($2)$3
     234
     235##    print STDERR "*** st = $section_text\n\n";
     236
     237
    200238    print $outhandler $section_text;
    201239
     
    212250
    213251    my $cmd = "gs-triplestore-add $collection \"$tmp_doc_filename\"";
    214    
     252       
    215253    my $status = system($cmd);
    216254    if ($status != 0) {
Note: See TracChangeset for help on using the changeset viewer.