Class: RDFgrid::Mapper::StatementMapper

Inherits:
show all
Defined in:
lib/rdfgrid/mapper.rb

Constant Summary

Constants inherited from RDFgrid::Processor

SEPARATOR

Class Method Summary

Instance Method Summary

Methods inherited from

#call

Methods inherited from RDFgrid::Processor

#initialize, process!

Constructor Details

This class inherits a constructor from RDFgrid::Processor

Class Method Details

+ process(input, options = {}, &block)

This method returns an undefined value.

Parameters:

  • (IO, File, #each_line) input
  • (Hash{Symbol => Object}) options (defaults to: {})


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rdfgrid/mapper.rb', line 56

def self.process(input, options = {}, &block)
  mapper = self.new(options)
  count  = 0
  RDF::NTriples::Reader.new(input) do |reader|
    reader.each_statement do |statement|
      if block_given?
        mapper.call(count += 1, statement, &block)
      else
        mapper.call(count += 1, statement) do |key, value|
          puts [key, value].join(SEPARATOR)
        end
      end
    end
  end
end

Instance Method Details

- process(statement, &block)

This method is abstract.

This method returns an undefined value.

Parameters:

  • (RDF::Statement) statement


76
77
78
# File 'lib/rdfgrid/mapper.rb', line 76

def process(statement, &block)
  super
end