Class: BELRDF::GraphTranslator
- Inherits:
-
Object
- Object
- BELRDF::GraphTranslator
- Includes:
- BEL::Translator
- Defined in:
- lib/bel/translator/plugins/rdf/graph_translator.rb
Instance Method Summary collapse
-
#initialize(format, write_schema = true) ⇒ GraphTranslator
constructor
A new instance of GraphTranslator.
- #read(data, options = {}) ⇒ Object
- #write(objects, io = StringIO.new, options = {}) ⇒ Object
Constructor Details
#initialize(format, write_schema = true) ⇒ GraphTranslator
Returns a new instance of GraphTranslator.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bel/translator/plugins/rdf/graph_translator.rb', line 14 def initialize(format, write_schema = true) @format = format write_schema = true if write_schema.nil? @rdf_schema = if write_schema BELRDF::RDFS_SCHEMA else [] end end |
Instance Method Details
#read(data, options = {}) ⇒ Object
26 27 28 |
# File 'lib/bel/translator/plugins/rdf/graph_translator.rb', line 26 def read(data, = {}) Reader::BufferedNanopubYielder.new(data, @format) end |
#write(objects, io = StringIO.new, options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bel/translator/plugins/rdf/graph_translator.rb', line 30 def write(objects, io = StringIO.new, = {}) write_rdf_to_io(@format, objects, io, ) case io when StringIO io.string else io end end |