Class: Taxonifi::Export::Prolog

Inherits:
Base
  • Object
show all
Defined in:
lib/taxonifi/export/format/prolog.rb

Overview

Dumps tables identical to the existing structure in SpeciesFile. Will only work in the pre Identity world. Will reconfigure as templates for Jim’s work after the fact.

Constant Summary

Constants inherited from Base

Base::EXPORT_BASE, Base::TAXRANKS

Instance Attribute Summary collapse

Attributes inherited from Base

#base_export_path, #export_folder

Instance Method Summary collapse

Methods inherited from Base

#configure_folders, #export_path, #new_output_file, #sanitize, #sql_insert_statement, #sqlize, #write_file

Constructor Details

#initialize(options = {}) ⇒ Prolog

Returns a new instance of Prolog.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/taxonifi/export/format/prolog.rb', line 16

def initialize(options = {})
  opts = {
    :nc => Taxonifi::Model::NameCollection.new,
    :export_folder => 'prolog',
    :starting_ref_id => 1,                              # should be configured elsewhere... but
    :manifest => %w{tblPubs tblRefs tblPeople tblRefAuthors tblTaxa tblGenusNames tblSpeciesNames tblNomenclator tblCites} 
  }.merge!(options)

  @manifest = opts[:manifest]

  super(opts)
  raise Taxonifi::Export::ExportError, 'NameCollection not passed to SpeciesFile export.' if ! opts[:nc].class == Taxonifi::Model::NameCollection
  #   raise Taxonifi::Export::ExportError, 'You must provide authorized_user_id for species_file export initialization.' if opts[:authorized_user_id].nil?
  #  @name_collection = opts[:nc]
  #  @pub_collection = {} # title => id
  #  @authorized_user_id = opts[:authorized_user_id]
  #  @author_index = {}
  #  @starting_ref_id = opts[:starting_ref_id]
  #  
  #  # Careful here, at present we are just generating Reference micro-citations from our names, so the indexing "just works"
  #  # because it's all internal.  There will is a strong potential for key collisions if this pipeline is modified to 
  #  # include references external to the initialized name_collection.  See also export_references.
  #  #
  #  # @by_author_reference_index = {}
  #  @genus_names = {}
  #  @species_names = {}
  #  @nomenclator = {}

  @time = Time.now.strftime("%F %T") 
  @empty_quotes = "" 
end

Instance Attribute Details

#author_indexObject

Returns the value of attribute author_index.



11
12
13
# File 'lib/taxonifi/export/format/prolog.rb', line 11

def author_index
  @author_index
end

#authorized_user_idObject

Returns the value of attribute authorized_user_id.



13
14
15
# File 'lib/taxonifi/export/format/prolog.rb', line 13

def authorized_user_id
  @authorized_user_id
end

#genus_namesObject

Returns the value of attribute genus_names.



12
13
14
# File 'lib/taxonifi/export/format/prolog.rb', line 12

def genus_names
  @genus_names
end

#name_collectionObject

Returns the value of attribute name_collection.



8
9
10
# File 'lib/taxonifi/export/format/prolog.rb', line 8

def name_collection
  @name_collection
end

#nomenclatorObject

Returns the value of attribute nomenclator.



12
13
14
# File 'lib/taxonifi/export/format/prolog.rb', line 12

def nomenclator
  @nomenclator
end

#pub_collectionObject

Returns the value of attribute pub_collection.



10
11
12
# File 'lib/taxonifi/export/format/prolog.rb', line 10

def pub_collection
  @pub_collection
end

#ref_collectionObject

Returns the value of attribute ref_collection.



9
10
11
# File 'lib/taxonifi/export/format/prolog.rb', line 9

def ref_collection
  @ref_collection
end

#species_namesObject

Returns the value of attribute species_names.



12
13
14
# File 'lib/taxonifi/export/format/prolog.rb', line 12

def species_names
  @species_names
end

#starting_ref_idObject

Returns the value of attribute starting_ref_id.



14
15
16
# File 'lib/taxonifi/export/format/prolog.rb', line 14

def starting_ref_id
  @starting_ref_id
end

#timeObject

Returns the value of attribute time.



13
14
15
# File 'lib/taxonifi/export/format/prolog.rb', line 13

def time
  @time
end

Instance Method Details

#exportObject



48
49
50
51
52
53
54
55
56
# File 'lib/taxonifi/export/format/prolog.rb', line 48

def export()
  super
  configure_folders
  str = ["FOO"]

  write_file('foo.pl', str.join("\n\n"))

  true
end