model/systematic_review_views_mixin.rb
# Entrega dataset con las references que existen entre
# canonicos.
# Los campos son cd_start y cd_end
Entrega dataset con las references que existen entre
canonicos.
Entrega dataset con las references que existen entre canonicos .
def references_bw_canonical
    view_name = references_bw_canonical_tn
    if @references_bw_canonical_tn_exists.nil?
      @references_bw_canonical_tn_exists=true
      if !$db.table_exists?(view_name)
        $db.run("CREATE VIEW #{view_name} AS SELECT r.canonical_document_id as cd_start, ref.canonical_document_id as cd_end FROM records r INNER JOIN records_searches br ON r.id=br.record_id INNER JOIN searches b ON br.search_id=b.id  INNER JOIN  records_references rr ON rr.record_id=r.id INNER JOIN bib_references ref ON ref.id=rr.reference_id   WHERE systematic_review_id='#{self[:id]}' AND ref.canonical_document_id IS NOT NULL AND b.valid=1 GROUP BY cd_start, cd_end")
      end
    end
    $db[view_name.to_sym]
  end
def references_bw_canonical view_name = references_bw_canonical_tn if @references_bw_canonical_tn_exists . nil? @references_bw_canonical_tn_exists = true if ! $db . table_exists? ( view_name ) $db . run ( "CREATE VIEW #{view_name} AS SELECT r.canonical_document_id as cd_start, ref.canonical_document_id as cd_end FROM records r INNER JOIN records_searches br ON r.id=br.record_id INNER JOIN searches b ON br.search_id=b.id  INNER JOIN  records_references rr ON rr.record_id=r.id INNER JOIN bib_references ref ON ref.id=rr.reference_id   WHERE systematic_review_id='#{self[:id]}' AND ref.canonical_document_id IS NOT NULL AND b.valid=1 GROUP BY cd_start, cd_end" ) end end $db [ view_name . to_sym ] end
Entrega dataset con las references que existen entre
canonicos.
Entrega dataset con las references que existen entre canonicos .