lib/term_bootstrapper.rb
# NOTE: This must be updated if you intend to pick up new fields from EolTerms
This must be updated if you intend to pick up new fields from EolTerms
This must be updated if you intend to pick up new fields from EolTerms
def compare_with_gem
    seen_uris = {}
    terms_from_neo4j.each do |term_from_neo4j|
      next if term_from_neo4j['uri'].nil?
      seen_uris[term_from_neo4j['uri'].downcase] = true
      unless term_from_gem_by_uri.key?(term_from_neo4j['uri'])
        @uris_to_delete << term_from_neo4j['uri']
        next
      end
      term_from_gem = term_from_gem_by_uri[term_from_neo4j['uri']]
      unless equivalent_terms(term_from_gem, term_from_neo4j)
        puts "** Needs update: #{term_from_gem['uri']}"
        term_from_gem.keys.sort.each do |k|
          puts "key #{k}: gem: '#{term_from_gem[k]}' vs neo4j: '#{term_from_neo4j[k]}'" unless term_from_gem[k].to_s == term_from_neo4j[k].to_s
        end
        @update_terms << term_from_gem
      end
    end
    term_from_gem_by_uri.each do |uri, term_from_gem|
      @new_terms << term_from_gem unless seen_uris.key?(uri.downcase)
    end
  end
def compare_with_gem seen_uris = { } terms_from_neo4j . each do | term_from_neo4j | next if term_from_neo4j [ 'uri' ] . nil? seen_uris [ term_from_neo4j [ 'uri' ] . downcase ] = true unless term_from_gem_by_uri . key? ( term_from_neo4j [ 'uri' ] ) @uris_to_delete << term_from_neo4j [ 'uri' ] next end term_from_gem = term_from_gem_by_uri [ term_from_neo4j [ 'uri' ] ] unless equivalent_terms ( term_from_gem , term_from_neo4j ) puts "** Needs update: #{term_from_gem['uri']}" term_from_gem . keys . sort . each do | k | puts "key #{k}: gem: '#{term_from_gem[k]}' vs neo4j: '#{term_from_neo4j[k]}'" unless term_from_gem [ k ] . to_s == term_from_neo4j [ k ] . to_s end @update_terms << term_from_gem end end term_from_gem_by_uri . each do | uri , term_from_gem | @new_terms << term_from_gem unless seen_uris . key? ( uri . downcase ) end end
NOTE: This must be updated if you intend to pick up new fields from EolTerms
NOTE : This must be updated if you intend to pick up new fields from EolTerms
# Nothing we can do about these. They *should* be removed... but that's not the job of this class.