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 equivalent_terms(term_from_gem, term_from_neo4j)
    return true if term_from_gem == term_from_neo4j 
    term_from_gem.keys.each do |key|
      if (
          (key == 'eol_id' && term_from_gem[key] != term_from_neo4j[key]) || 
          term_from_gem[key].to_s != term_from_neo4j[key].to_s
      )
        next if term_from_gem[key] == [] && term_from_neo4j[key].blank?
        next if term_from_gem[key].blank? && term_from_neo4j[key] == []
        next if term_from_gem[key].is_a?(Array) && term_from_gem[key].first.blank? && term_from_neo4j[key] == []
        next if term_from_gem[key] == 'false' && term_from_neo4j[key].blank?
        next if term_from_neo4j[key] == 'false' && term_from_gem[key].blank?
        next if term_from_neo4j[key] == 'false' && term_from_gem[key].blank?
        puts "TERM #{term_from_gem['uri']} does not match on '#{key}':\n"\
             "gem: {#{term_from_gem[key]}}\n"\
             "neo: {#{term_from_neo4j[key]}}"
        return false
      end
    end
    return false if term_from_gem.keys.sort != term_from_neo4j.keys.sort
    true
  end
def equivalent_terms ( term_from_gem , term_from_neo4j ) return true if term_from_gem == term_from_neo4j term_from_gem . keys . each do | key | if ( ( key == 'eol_id' && term_from_gem [ key ] != term_from_neo4j [ key ] ) || term_from_gem [ key ] . to_s != term_from_neo4j [ key ] . to_s ) next if term_from_gem [ key ] == [ ] && term_from_neo4j [ key ] . blank? next if term_from_gem [ key ] . blank? && term_from_neo4j [ key ] == [ ] next if term_from_gem [ key ] . is_a? ( Array ) && term_from_gem [ key ] . first . blank? && term_from_neo4j [ key ] == [ ] next if term_from_gem [ key ] == 'false' && term_from_neo4j [ key ] . blank? next if term_from_neo4j [ key ] == 'false' && term_from_gem [ key ] . blank? next if term_from_neo4j [ key ] == 'false' && term_from_gem [ key ] . blank? puts "TERM #{term_from_gem['uri']} does not match on '#{key}':\n" "gem: {#{term_from_gem[key]}}\n" "neo: {#{term_from_neo4j[key]}}" return false end end return false if term_from_gem . keys . sort != term_from_neo4j . keys . sort true 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
# simple, fast check # if one has an integer eol_id and the other a string, they aren't equivalent # Ignore false-like values compared to false:
term_from_gem
<not_specific>
term_from_neo4j
<not_specific>