lib/browser_web_data_entity_sumarization/entity_sumarization_statistics.rb
###
# The method generate simple statistics that contain all predicates that links to literal.
# Predicates are grouped by entity class type and also contains count of total occurrence.
# Predicates find from best ranked resources.
#
# @param [String] type Type from http://mappings.dbpedia.org/server/ontology/classes/
# @param [Fixnum] count Count of best ranked resources
The method generate simple statistics that contain all predicates that links to literal.
Predicates are grouped by entity class type and also contains count of total occurrence.
Predicates find from best ranked resources.
The method generate simple statistics that contain all predicates that links to literal . Predicates are grouped by entity class type and also contains count of total occurrence . Predicates find from best ranked resources .
def generate_literal_statistics(type = nil, count = 10000)
        unless type
          type = get_all_classes
        end
        type = [type] unless type.is_a?(Array)
        type.each_with_index { |entity_type, index|
          all_properties = {}
          puts "#{__method__} - start process entity type: #{entity_type} [#{(index / type.size.to_f).round(2)}]" if @console_output
          entity_type = entity_type.to_s.to_sym
          get_best_ranked_resources(entity_type, count).each { |resource, _|
            properties = @query.get_all_predicates_by_subject(resource.to_s, true).map { |solution_prop|
              solution_prop[:property].to_s
            } || []
            properties.uniq.each { |prop|
              next if Predicate.unimportant?(prop)
              all_properties[entity_type] ||= {}
              all_properties[entity_type][prop] ||= 0
              all_properties[entity_type][prop] += 1
            }
          }
          update_global_statistic(all_properties)
        }
      end
def generate_literal_statistics ( type = nil , count = 10000 ) unless type type = get_all_classes end type = [ type ] unless type . is_a? ( Array ) type . each_with_index { | entity_type , index | all_properties = { } puts "#{__method__} - start process entity type: #{entity_type} [#{(index / type.size.to_f).round(2)}]" if @console_output entity_type = entity_type . to_s . to_sym get_best_ranked_resources ( entity_type , count ) . each { | resource , _ | properties = @query . get_all_predicates_by_subject ( resource . to_s , true ) . map { | solution_prop | solution_prop [ :property ] . to_s } || [ ] properties . uniq . each { | prop | next if Predicate . unimportant? ( prop ) all_properties [ entity_type ] ||= { } all_properties [ entity_type ] [ prop ] ||= 0 all_properties [ entity_type ] [ prop ] += 1 } } update_global_statistic ( all_properties ) } end
The method generate simple statistics that contain all predicates that links to literal.
The method generate simple statistics that contain all predicates that links to literal .
type
<not_specific>
count
<not_specific>
<not_specific>
count Count of best ranked resources
count Count of best ranked resources