lib/trait_bank/stats.rb
# Usual trait search MATCHes, collect tgt_obj and obj nodes for each filter/page
Usual trait search MATCHes, collect tgt_obj and obj nodes for each filter/page
Usual trait search MATCHes collect tgt_obj and obj nodes for each filter / page
def add_sankey_match_part(term_query, query_parts, params, collected_obj_pairs_vars, obj_var_pairs)
        query_parts << TraitBank::Search.term_search_matches_helper(
          term_query, 
          params, 
          always_match_obj: true, 
          with_tgt_vars: true
        ) do |i, filter, trait_var, pred_var, tgt_pred_var, obj_var, tgt_obj_var|
          with = "WITH page, "
          collected_obj_pairs_var = nil
          tgt_obj_var = filter.object_term? ? tgt_obj_var : nil
          if i < term_query.filters.length - 1
            collected_obj_pairs_var = obj_var + "_pairs"
            collect = filter.object_term? ? 
              "{ obj: #{obj_var}, tgt_obj: #{tgt_obj_var} }" :
              "{ obj: #{obj_var} }"
            with.concat("collect(#{collect}) AS #{collected_obj_pairs_var}")
          else
            with.concat("#{obj_var}")
            with.concat(", #{tgt_obj_var}") if filter.object_term?
          end
          if collected_obj_pairs_vars.any?
            with.concat(", #{collected_obj_pairs_vars.join(", ")}")
          end
          collected_obj_pairs_vars << collected_obj_pairs_var if collected_obj_pairs_var
          obj_var_pairs << { obj: obj_var, tgt_obj: tgt_obj_var }
          with
        end
      end
def add_sankey_match_part ( term_query , query_parts , params , collected_obj_pairs_vars , obj_var_pairs ) query_parts << TraitBank :: Search . term_search_matches_helper ( term_query , params , always_match_obj : true , with_tgt_vars : true ) do | i , filter , trait_var , pred_var , tgt_pred_var , obj_var , tgt_obj_var | with = "WITH page, " collected_obj_pairs_var = nil tgt_obj_var = filter . object_term? ? tgt_obj_var : nil if i < term_query . filters . length - 1 collected_obj_pairs_var = obj_var + "_pairs" collect = filter . object_term? ? "{ obj: #{obj_var}, tgt_obj: #{tgt_obj_var} }" : "{ obj: #{obj_var} }" with . concat ( "collect(#{collect}) AS #{collected_obj_pairs_var}" ) else with . concat ( "#{obj_var}" ) with . concat ( ", #{tgt_obj_var}" ) if filter . object_term? end if collected_obj_pairs_vars . any? with . concat ( ", #{collected_obj_pairs_vars.join(", ")}" ) end collected_obj_pairs_vars << collected_obj_pairs_var if collected_obj_pairs_var obj_var_pairs << { obj : obj_var , tgt_obj : tgt_obj_var } with end end
Usual trait search MATCHes, collect tgt_obj and obj nodes for each filter/page
Usual trait search MATCHes collect tgt_obj and obj nodes for each filter / page
term_query
<not_specific>
query_parts
<not_specific>
params
<not_specific>
collected_obj_pairs_vars
<not_specific>
obj_var_pairs
<not_specific>