class RDF::Benchmark::BerlinGenerator

@see wifo5-03.informatik.uni-mannheim.de/bizer/berlinsparqlbenchmark/spec/BenchmarkRules/index.html#datagenerator

Constants

DEFAULT_FACTOR
DEFAULT_FILENAME
DEFAULT_FORMAT
DEFAULT_PATH

Attributes

filename[RW]

@!attribute [rw] filename @!attribute [rw] product_factor @!attribute [rw] format @!attribute [rw] tool_path

format[RW]

@!attribute [rw] filename @!attribute [rw] product_factor @!attribute [rw] format @!attribute [rw] tool_path

product_factor[RW]

@!attribute [rw] filename @!attribute [rw] product_factor @!attribute [rw] format @!attribute [rw] tool_path

tool_path[RW]

@!attribute [rw] filename @!attribute [rw] product_factor @!attribute [rw] format @!attribute [rw] tool_path

Public Class Methods

new(filename: DEFAULT_FILENAME, product_factor: DEFAULT_FACTOR, format: DEFAULT_FORMAT, tool_path: DEFAULT_PATH) click to toggle source

@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

data(&block) click to toggle source

@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
generate_data!() click to toggle source

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