app/models/run.rb
# transform arrows to cluster hedge(set of cluster trees) to SQL joins and conditions
transform arrows to cluster hedge(set of cluster trees) to SQL joins and conditions
transform arrows to cluster hedge ( set of cluster trees ) to SQL joins and conditions
def arrows_to_cluster_hedge_to_sql(arrows)
      self_arrow = arrows.detect{|arw| arw.pre_value_ref.entity.model_name == self.name || arw.pos_value_ref.entity.model_name == self.name}
      fail "#{arrows.inspect} does not have base model."  unless self_arrow
      base = self_arrow.pre_value_ref.entity.model_name == self.name ? self_arrow.pre_value_ref.entity : self_arrow.pos_value_ref.entity   
      cluster_hedge = [].to_set << 
                      ClusterTree.new([].to_set << base, 
                                      [].to_set<< eigen_cond(base), 
                                      nil, 
                                      [].to_set)
      partial_arrows = [].to_set
      odd_arrows     = [].to_set
      global_cond    = [].to_set
      register_full_arrow(cluster_hedge, arrows.to_set, partial_arrows)
      assign_parent_to_cluster_tree(cluster_hedge, partial_arrows, odd_arrows) 
      merge_top_level_clusters(cluster_hedge)
      register_odd_arrow(cluster_hedge, global_cond, odd_arrows)
      cluster_hedge_to_sql(cluster_hedge, global_cond)
    end
def arrows_to_cluster_hedge_to_sql ( arrows ) self_arrow = arrows . detect { | arw | arw . pre_value_ref . entity . model_name == self . name || arw . pos_value_ref . entity . model_name == self . name } fail "#{arrows.inspect} does not have base model." unless self_arrow base = self_arrow . pre_value_ref . entity . model_name == self . name ? self_arrow . pre_value_ref . entity : self_arrow . pos_value_ref . entity cluster_hedge = [ ] . to_set << ClusterTree . new ( [ ] . to_set << base , [ ] . to_set << eigen_cond ( base ) , nil , [ ] . to_set ) partial_arrows = [ ] . to_set odd_arrows = [ ] . to_set global_cond = [ ] . to_set register_full_arrow ( cluster_hedge , arrows . to_set , partial_arrows ) assign_parent_to_cluster_tree ( cluster_hedge , partial_arrows , odd_arrows ) merge_top_level_clusters ( cluster_hedge ) register_odd_arrow ( cluster_hedge , global_cond , odd_arrows ) cluster_hedge_to_sql ( cluster_hedge , global_cond ) end
transform arrows to cluster hedge(set of cluster trees) to SQL joins and conditions
transform arrows to cluster hedge ( set of cluster trees ) to SQL joins and conditions
# self as base for cluster_hedge # fail "Since RAILS calculation misses aliasing in :from option, :self as base cannot have entity name (alias in SQL) different from the table name." unless base.name == self.table_name
arrows
<not_specific>