app/models/trait_bank/resource_porter.rb
# Returns the set of taxa which were affected. NOTE that you should probably
# flatten those taxa in TB.
Returns the set of taxa which were affected. NOTE that you should probably
flatten those taxa in TB.
Returns the set of taxa which were affected . NOTE that you should probably flatten those taxa in TB .
def port
      EOL.log_call
      reset
      TraitBank.delete_resource(@resource)
      build_traits
      build_associations
      build_metadata
      build_references
      if @triples.empty?
        EOL.log("No data to insert, skipping.", prefix: ".")
      else
        unless insert_triples
          EOL.log("Data not inserted: #{@triples.inspect}", prefix: "!")
          raise "Failed to insert data"
        end
      end
      EOL.log_return
      @taxa = @taxa.to_a 
      @taxa.each do |id|
        Rails.cache.delete(PageTraits.cache_key(id))
      end
      @taxa.in_groups_of(5000, false) do |group|
        PageJson.where(page_id: group).delete_all
      end
      @taxa
    end
def port EOL . log_call reset TraitBank . delete_resource ( @resource ) build_traits build_associations build_metadata build_references if @triples . empty? EOL . log ( "No data to insert, skipping." , prefix : "." ) else unless insert_triples EOL . log ( "Data not inserted: #{@triples.inspect}" , prefix : "!" ) raise "Failed to insert data" end end EOL . log_return @taxa = @taxa . to_a @taxa . each do | id | Rails . cache . delete ( PageTraits . cache_key ( id ) ) end @taxa . in_groups_of ( 5000 , false ) do | group | PageJson . where ( page_id : group ) . delete_all end @taxa end
Returns the set of taxa which were affected.
Returns the set of taxa which were affected .
# TODO: Ideally, we would first get a diff of what's in the graph vs what # we're going to put in the graph, and add the new stuff and remove the # old. That's a lot of work! Not doing that now. # Just make things easier from here on out... # Clear caches! # TODO: perhaps we should background a task here to re-create all of # them.