Class: Tripleloop::RDFWriter
- Inherits:
-
Object
- Object
- Tripleloop::RDFWriter
- Defined in:
- lib/tripleloop/rdf_writer.rb
Instance Method Summary collapse
-
#initialize(data, opts = {}) ⇒ RDFWriter
constructor
A new instance of RDFWriter.
- #statements ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(data, opts = {}) ⇒ RDFWriter
Returns a new instance of RDFWriter.
2 3 4 5 |
# File 'lib/tripleloop/rdf_writer.rb', line 2 def initialize(data, opts={}) @data = data @options = opts end |
Instance Method Details
#statements ⇒ Object
7 8 9 10 11 12 |
# File 'lib/tripleloop/rdf_writer.rb', line 7 def statements @statements ||= Hash[@data.map { |extractor_name, statements| [extractor_name, statements.map { |s| as_statement(s) }] }] end |
#write ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tripleloop/rdf_writer.rb', line 14 def write FileUtils.mkdir_p(datasets_path) statements.each do |extractor, extracted_statements| build_writer(extractor, extracted_statements) do |writer| extracted_statements.each do |statement| writer << statement end end end end |