lib/browser_web_data_entity_sumarization/entity_sumarization_statistics.rb
###
# The method helps update found predicates to stored links.
#
# @param [String] resource_uri
# @param [String] type
#
# @return [Array<Hash>] old_data, new_data
The method helps update found predicates to stored links.
The method helps update found predicates to stored links .
def update_nif_file_properties(resource_uri, type)
        if block_given?
          path = get_resource_file_path(resource_uri, type)
          old_data = ensure_load_json(path, {}, symbolize_names: true)
          new_data = old_data.dup
          time = Benchmark.realtime {
            new_data[:nif_data] = old_data[:nif_data].map { |hash|
              actual_link = hash[:link].to_sym
              result = yield actual_link
              hash[:strict_properties] = result[:strict_properties] if result[:strict_properties]
              hash[:properties] = result[:properties] if result[:properties]
              hash
            }
          }
          new_data[:process_time][:relations_find] = time.round(2)
          File.write(path, JSON.pretty_generate(new_data))
          return old_data, new_data
        end
      end
def update_nif_file_properties ( resource_uri , type ) if block_given? path = get_resource_file_path ( resource_uri , type ) old_data = ensure_load_json ( path , { } , symbolize_names : true ) new_data = old_data . dup time = Benchmark . realtime { new_data [ :nif_data ] = old_data [ :nif_data ] . map { | hash | actual_link = hash [ :link ] . to_sym result = yield actual_link hash [ :strict_properties ] = result [ :strict_properties ] if result [ :strict_properties ] hash [ :properties ] = result [ :properties ] if result [ :properties ] hash } } new_data [ :process_time ] [ :relations_find ] = time . round ( 2 ) File . write ( path , JSON . pretty_generate ( new_data ) ) return old_data , new_data end end
The method helps update found predicates to stored links.
The method helps update found predicates to stored links .
None
Array<Hash>
resource_uri
<not_specific>
type
<not_specific>
<not_specific>
None