Class: RDF::Benchmark::BerlinGenerator
- Inherits:
-
Object
- Object
- RDF::Benchmark::BerlinGenerator
- Defined in:
- lib/rdf/benchmark/berlin_generator.rb
Overview
Constant Summary collapse
- DEFAULT_FILENAME =
'dataset'.freeze
- DEFAULT_FACTOR =
2_000.freeze
- DEFAULT_FORMAT =
'nt'.freeze
- DEFAULT_PATH =
'./bsbmtools'.freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#data(&block) ⇒ RDF::Reader
A stream of the requested data.
-
#generate_data! ⇒ Boolean
Generates the data for this instance, writing it to disk.
-
#initialize(filename: DEFAULT_FILENAME, product_factor: DEFAULT_FACTOR, format: DEFAULT_FORMAT, tool_path: DEFAULT_PATH) ⇒ BerlinGenerator
constructor
A new instance of BerlinGenerator.
Constructor Details
#initialize(filename: DEFAULT_FILENAME, product_factor: DEFAULT_FACTOR, format: DEFAULT_FORMAT, tool_path: DEFAULT_PATH) ⇒ BerlinGenerator
Returns a new instance of BerlinGenerator.
23 24 25 26 27 28 29 30 31 |
# 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 |
Instance Attribute Details
#filename ⇒ Object
17 18 19 |
# File 'lib/rdf/benchmark/berlin_generator.rb', line 17 def filename @filename end |
#format ⇒ Object
17 |
# File 'lib/rdf/benchmark/berlin_generator.rb', line 17 attr_accessor :filename, :product_factor, :format, :tool_path |
#product_factor ⇒ Object
17 |
# File 'lib/rdf/benchmark/berlin_generator.rb', line 17 attr_accessor :filename, :product_factor, :format, :tool_path |
#tool_path ⇒ Object
17 |
# File 'lib/rdf/benchmark/berlin_generator.rb', line 17 attr_accessor :filename, :product_factor, :format, :tool_path |
Instance Method Details
#data(&block) ⇒ RDF::Reader
Returns a stream of the requested data.
35 36 37 38 39 40 |
# 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! ⇒ Boolean
Note:
writes the output of the Berlin data generator to stdout
Generates the data for this instance, writing it to disk.
48 49 50 51 52 53 54 55 |
# 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 |