class ActiveFacts::Metamodel::Vocabulary

The Vocabulary class is defined in the metamodel; full documentation is not generated. This section shows the features relevant to relational mapping.

Public Class Methods

relational_transform(&block) click to toggle source
# File lib/activefacts/rmap/tables.rb, line 174
def self.relational_transform &block
  # Add this block to the additional transformations which will be applied
  # to the relational schema after the initial absorption.
  # For example, to perform injection of surrogate keys to replace composite keys...
  @@relational_transforms << block
end

Public Instance Methods

finish_schema() click to toggle source

Make schema transformations like adding ValueType self-value columns (and later, Rails-friendly ID fields). Override this method to change the transformations

# File lib/activefacts/rmap/columns.rb, line 418
def finish_schema
  all_object_type.each do |object_type|
    object_type.self_value_reference if object_type.is_a?(ActiveFacts::Metamodel::ValueType) && object_type.is_table
  end
end
show_all_references() click to toggle source
# File lib/activefacts/rmap/reference.rb, line 415
def show_all_references
  if trace :references
    trace :references, "Finished object_type references" do
      all_object_type.each do |object_type|
        trace :references?, "#{object_type.name}:" do
          object_type.references_from.each do |ref|
            trace :references, "#{ref}"
          end
        end
      end
    end
  end
end
tables() click to toggle source

return an Array of ObjectTypes that will have their own tables

# File lib/activefacts/rmap/tables.rb, line 168
def tables
  decide_tables if !@tables
  @@relational_transforms.each{|tr| tr.call(self)}
  @tables
end
wipe_existing_mapping() click to toggle source
# File lib/activefacts/rmap/tables.rb, line 181
def wipe_existing_mapping
  all_object_type.each do |object_type|
    object_type.clear_references
    object_type.wipe_columns
    object_type.is_table = nil      # Undecided; force an attempt to decide
    object_type.tentative = true    # Uncertain
  end
end