Class: BioInterchange::Phylogenetics::CDAORDFWriter

Inherits:
Writer
  • Object
show all
Defined in:
lib/biointerchange/phylogenetics/cdao_rdf_ntriples.rb

Overview

Serialized phylogenetic tree models based on BioRuby’s phylogenetic tree implementation.

Instance Method Summary collapse

Methods inherited from Writer

#add_prefix, #close, #create_triple, #set_base

Constructor Details

#initialize(ostream) ⇒ CDAORDFWriter

Creates a new instance of a CDAORDFWriter that will use the provided output stream to serialize RDF.

ostream

instance of an IO class or derivative that is used for RDF serialization



21
22
23
# File 'lib/biointerchange/phylogenetics/cdao_rdf_ntriples.rb', line 21

def initialize(ostream)
  @ostream = ostream
end

Instance Method Details

#serialize(model, uri_prefix = nil) ⇒ Object

Serialize a model as RDF.

model

a generic representation of input data that is an instance of BioInterchange::Phylogenetics::TreeSet

uri_prefix

optional URI prefix that should be used in the RDFization of individuals/class instances



29
30
31
32
33
# File 'lib/biointerchange/phylogenetics/cdao_rdf_ntriples.rb', line 29

def serialize(model, uri_prefix = nil)
  model.contents.each { |tree|
    serialize_model(model, tree, uri_prefix)
  }
end