Ignore:
Timestamp:
2023-10-06T18:15:02+13:00 (8 months ago)
Author:
davidb
Message:

Further development, but starting to realize 'extra' orthogonal not designed to run at the point we want

Location:
gs3-extensions/structured-image/trunk/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/structured-image/trunk/perllib/plugins/GoogleVisionAPIConverter.pm

    r38292 r38297  
    461461
    462462    my $self_openannotation_resources = $self->{'openannotation-list'}->{'resources'};
    463 
     463    my $top_section = $doc_obj->get_top_section();
     464   
    464465    my $block_i = 0;
    465466
     
    470471
    471472    my $annotation_id_uri = "${uri_prefix}${OID_with_section}/annotation/gv-block-$block_i";
    472        
     473    $doc_obj->add_utf8_metadata($top_section, "GoogleVisionBlocks", $annotation_id_uri);
     474   
    473475    my $openannotation_resource = {
    474476        "\@context"  => "http://iiif.io/api/presentation/2/context.json",
  • gs3-extensions/structured-image/trunk/perllib/sasOpenAnnotationBuildproc.pm

    r38290 r38297  
    6464    my $build_dir  = $self->{'build_dir'};
    6565
    66     # full path to adb database
    67 #    my $adb_filename
    68 #   = &util::filename_cat($build_dir, "sasOpenAnnotation", "lsh-features.adb");
    6966
    7067    # get doc id
     
    7673   
    7774    if ((defined $tl_contains_openannotation_json) && ($tl_contains_openannotation_json eq "1")) {
    78     print STDERR "*** ### Processing $doc_oid for its OpenAnnotation associated files\n";
    79    
     75
     76    print STDERR "**** Hardwiring port value to: 8383\n";
     77    my $gs_http_port   = "8383";   
     78    my $site           = $self->{'site'};       
     79    my $collect        = $ENV{'GSDLCOLLECTION'};
     80    my $gs_library_url = "http://localhost:${gs_http_port}/greenstone3/library";
     81       
     82    my $internal_url_base = "http://localhost:${gs_http_port}/simpleAnnotationStore/annotation";
     83
     84    my $destroy_delete_url = "${internal_url_base}/destroy";
     85    my $populate_post_url  = "${internal_url_base}/populate";
     86
     87    # First remove any previous gv-blocks
     88    my $gv_block_uris = $doc_obj->get_metadata($top_section,"GoogleVisionBlocks");
     89    for my $gv_block_uri (@$gv_block_uris) {
     90        print $outhandle "  Deleting previous OpenAnnotation GV-block:\n    $gv_block_uri\n";
     91
     92        my $cmd = "curl --silent -X DELETE $destroy_delete_url?uri=${gv_block_uri}";
     93       
     94        my $status = system($cmd);
     95        if ($status != 0) {
     96        print STDERR "Error: failed to run:\n  $cmd\n$!\n";
     97        }
     98       
     99    }
     100           
    80101    # map to assoc dir
    81102    my $assoc_file  = $doc_obj->get_metadata_element ($top_section,"assocfilepath");
    82103    # my $assoc_filename = &util::filename_cat($source_dir,$assoc_file);
    83104
    84     my $tl_root_oa_id = "openannotation-list";
    85 
    86     my $gs_http_port = "8383";
    87        
    88     my $internal_url_base = "http://localhost:${gs_http_port}/simpleAnnotationStore/annotation";
    89     my $post_url="${internal_url_base}/populate";
    90 
    91     my $gs_library_url = "http://localhost:${gs_http_port}/greenstone3/library";
    92     my $site           = $self->{'site'};       
    93     my $collect        = $ENV{'GSDLCOLLECTION'};
     105    my $tl_root_oa_id = "openannotation-list"; 
     106    my $iuri_prefix = "$gs_library_url/sites/$site/collect/$collect/index/assoc/$assoc_file/";
    94107   
    95     my $iuri_prefix = "$gs_library_url/sites/$site/collect/$collect/index/assoc/$assoc_file/";
    96 
    97    
    98 
    99108    # For each page:
    100109    #    send the openannotation-list<n>.json to SAS endpoint
     
    115124        $sec_oa_file .= ".json";
    116125
    117         #my $sec_oa_filename = &util::filename_cat($assoc_filename,$sec_oa_file);
    118                
    119126        print $outhandle "  Inserting Open Annotation for $doc_oid.$section\n";
    120127
     
    122129        my $iuri="${iuri_prefix}${iuri_tail}";
    123130
    124         my $cmd = "curl -X POST -d \"uri=${iuri}\" \"$post_url\"";
    125         print STDERR "!!!!! cmd = $cmd\n";
    126        
     131        my $cmd = "curl --silent -X POST -d \"uri=${iuri}\" \"$populate_post_url\"";
    127132       
    128133        my $status = system($cmd);
     
    133138        $section = $doc_obj->get_next_section($section);
    134139    }
    135     }
    136    
    137    
    138 #    my $chr12_filename = &util::filename_cat($assoc_filename,"doc.chr12");
    139 #    my $powerlog_filename = &util::filename_cat($assoc_filename,"doc.power");
    140 
    141 #    print $outhandle "  Inserting features for $doc_oid\n";
    142 
    143 #    my $cmd = "sasOpenAnnotation -d \"$adb_filename\" -I -k \"$doc_oid\" -f \"$chr12_filename\" -w \"$powerlog_filename\"";
    144 
    145 #    my $status = system($cmd);
    146 #    if ($status != 0) {
    147 #   print STDERR "Error: failed to run:\n  $cmd\n$!\n";
    148 #    }
     140    }       
    149141}
    150142
Note: See TracChangeset for help on using the changeset viewer.