class RDF::Benchmark::BerlinGenerator
Constants
- DEFAULT_FACTOR
- DEFAULT_FILENAME
- DEFAULT_FORMAT
- DEFAULT_PATH
Attributes
@!attribute [rw] filename @!attribute [rw] product_factor
@!attribute [rw] format @!attribute [rw] tool_path
@!attribute [rw] filename @!attribute [rw] product_factor
@!attribute [rw] format @!attribute [rw] tool_path
@!attribute [rw] filename @!attribute [rw] product_factor
@!attribute [rw] format @!attribute [rw] tool_path
@!attribute [rw] filename @!attribute [rw] product_factor
@!attribute [rw] format @!attribute [rw] tool_path
Public Class Methods
@param filename [String] (default: 'dataset') @param products [Integer] (default: 2000) @param format [String] (default: 'nt')
# File lib/rdf/benchmark/berlin_generator.rb, line 23 def initialize(filename: DEFAULT_FILENAME, product_factor: DEFAULT_FACTOR, format: DEFAULT_FORMAT, tool_path: DEFAULT_PATH) self.filename = filename self.product_factor = product_factor self.format = format self.tool_path = tool_path end
Public Instance Methods
@return [RDF::Reader] a stream of the requested data
# File lib/rdf/benchmark/berlin_generator.rb, line 35 def data(&block) filepath = Pathname.new(tool_path) + "#{filename}.#{format}" generate_data! unless File.exists?(filepath) RDF::Reader.open(filepath, &block) end
Generates the data for this instance, writing it to disk.
@return [Boolean] true if successful
@note writes the output of the Berlin data generator to stdout
# File lib/rdf/benchmark/berlin_generator.rb, line 48 def generate_data! start_dir = Dir.pwd Dir.chdir tool_path system "./generate -pc #{product_factor} -fn #{filename} -fc" ensure Dir.chdir start_dir end