Changeset 38297
- Timestamp:
- 2023-10-06T18:15:02+13:00 (2 months ago)
- 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 461 461 462 462 my $self_openannotation_resources = $self->{'openannotation-list'}->{'resources'}; 463 463 my $top_section = $doc_obj->get_top_section(); 464 464 465 my $block_i = 0; 465 466 … … 470 471 471 472 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 473 475 my $openannotation_resource = { 474 476 "\@context" => "http://iiif.io/api/presentation/2/context.json", -
gs3-extensions/structured-image/trunk/perllib/sasOpenAnnotationBuildproc.pm
r38290 r38297 64 64 my $build_dir = $self->{'build_dir'}; 65 65 66 # full path to adb database67 # my $adb_filename68 # = &util::filename_cat($build_dir, "sasOpenAnnotation", "lsh-features.adb");69 66 70 67 # get doc id … … 76 73 77 74 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 80 101 # map to assoc dir 81 102 my $assoc_file = $doc_obj->get_metadata_element ($top_section,"assocfilepath"); 82 103 # my $assoc_filename = &util::filename_cat($source_dir,$assoc_file); 83 104 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/"; 94 107 95 my $iuri_prefix = "$gs_library_url/sites/$site/collect/$collect/index/assoc/$assoc_file/";96 97 98 99 108 # For each page: 100 109 # send the openannotation-list<n>.json to SAS endpoint … … 115 124 $sec_oa_file .= ".json"; 116 125 117 #my $sec_oa_filename = &util::filename_cat($assoc_filename,$sec_oa_file);118 119 126 print $outhandle " Inserting Open Annotation for $doc_oid.$section\n"; 120 127 … … 122 129 my $iuri="${iuri_prefix}${iuri_tail}"; 123 130 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\""; 127 132 128 133 my $status = system($cmd); … … 133 138 $section = $doc_obj->get_next_section($section); 134 139 } 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 } 149 141 } 150 142
Note:
See TracChangeset
for help on using the changeset viewer.