lib/browser_web_data_entity_sumarization/entity_sumarization_predicates_similarity.rb
###
# The method verify every combination of two predicates.
# Method store identify combination in two files identical_predicates.json and different_predicates.json
# files contains Array of combination keys.
# Given predicates count are is reduced to #IMPORTANCE_TO_IDENTIFY_MAX_COUNT (250)
#
# @param [Array<String>] predicates
The method verify every combination of two predicates.
Method store identify combination in two files identical_predicates.json and different_predicates.json
files contains Array of combination keys.
Given predicates count are is reduced to #IMPORTANCE_TO_IDENTIFY_MAX_COUNT (250)
The method verify every combination of two predicates . Method store identify combination in two files identical_predicates . json and different_predicates . json files contains Array of combination keys . Given predicates count are is reduced to #IMPORTANCE_TO_IDENTIFY_MAX_COUNT ( 250 )
def identify_identical_predicates(predicates, identical_limit = @identical_limit)
        combination = predicates.take(IMPORTANCE_TO_IDENTIFY_MAX_COUNT).map { |p| p.to_sym }.combination(2)
        times_count = combination.size / 10.0
        combination.each_with_index { |values, i|
          already_mark_same = find_identical(values)
          already_mark_different = find_different(values)
          if already_mark_same.nil? && already_mark_different.nil?
            unless is_identical_property_ontology?(values)
              unless @counts[values[0]]
                @counts[values[0]] = @query.get_count_of_identical_predicates(values[0])
              end
              unless @counts[values[1]]
                @counts[values[1]] = @query.get_count_of_identical_predicates(values[1])
              end
              x = @counts[values[0]]
              y = @counts[values[1]]
              z = @query.get_count_of_identical_predicates(values)
              identical_level = z / [x, y].max
              if identical_level >= identical_limit
                puts "     - result[#{identical_level}] z[#{z}] x[#{x}] y[#{y}] #{values.inspect}" if @console_output
                add_identical(values)
              else
                add_different(values)
              end
            end
          end
          if @console_output && ( i == 0 || (i+1) % times_count == 0 )
            puts "#{Time.now.localtime} | #{(((i+1)/combination.size.to_f) * 100).round(0)}% | [#{(i+1)}/#{combination.size}]"
          end
        }
        store_counts
      end
def identify_identical_predicates ( predicates , identical_limit = @identical_limit ) combination = predicates . take ( IMPORTANCE_TO_IDENTIFY_MAX_COUNT ) . map { | p | p . to_sym } . combination ( 2 ) times_count = combination . size / 10.0 combination . each_with_index { | values , i | already_mark_same = find_identical ( values ) already_mark_different = find_different ( values ) if already_mark_same . nil? && already_mark_different . nil? unless is_identical_property_ontology? ( values ) unless @counts [ values [ 0 ] ] @counts [ values [ 0 ] ] = @query . get_count_of_identical_predicates ( values [ 0 ] ) end unless @counts [ values [ 1 ] ] @counts [ values [ 1 ] ] = @query . get_count_of_identical_predicates ( values [ 1 ] ) end x = @counts [ values [ 0 ] ] y = @counts [ values [ 1 ] ] z = @query . get_count_of_identical_predicates ( values ) identical_level = z / [ x , y ] . max if identical_level >= identical_limit puts "     - result[#{identical_level}] z[#{z}] x[#{x}] y[#{y}] #{values.inspect}" if @console_output add_identical ( values ) else add_different ( values ) end end end if @console_output && ( i == 0 || ( i + 1 ) % times_count == 0 ) puts "#{Time.now.localtime} | #{(((i+1)/combination.size.to_f) * 100).round(0)}% | [#{(i+1)}/#{combination.size}]" end } store_counts end
The method verify every combination of two predicates.
The method verify every combination of two predicates .
# in case of dbpedia ontology vs. property # automatically became identical
predicates
<not_specific>
identical_limit
<not_specific>
<not_specific>
None