Sha256: 3680fbc07c8fd9b08d1c82b0d3bc1dd7c8af37a97e3f30aee9a12e8ec52381ba

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

#
# ActiveFacts Compositions, Binary Compositor.
#
#       Fans of RDF will like this one.
#
# Copyright (c) 2015 Clifford Heath. Read the LICENSE file.
#
require "activefacts/compositions"

module ActiveFacts
  module Compositions
    class Binary < Compositor
      def initialize constellation, name, options = {}, compositor_name = 'Binary'
        super constellation, name, options, compositor_name
      end

      def self.options
        {}
      end

      def self.compatibility
        %i{binary}
      end

      def generate
        super

        trace :binary!, "Constructing Binary Composition" do
          @binary_mappings.keys.sort_by(&:name).each do |object_type|
            mapping = @binary_mappings[object_type]
            mapping.re_rank
            composite = @constellation.Composite(mapping, composition: @composition)
          end
        end

        trace :binary!, "Full binary composition" do
          @binary_mappings.keys.sort_by(&:name).each do |object_type|
            mapping = @binary_mappings[object_type]
            mapping.show_trace 
          end
        end

      end
    end
    publish_compositor Binary, "A composition reduced to binary relationships, suitable for object-oriented programming"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activefacts-compositions-1.9.23 lib/activefacts/compositions/binary.rb