Class: BEL::BELRDF::NanopubConverter

Inherits:
Object
  • Object
show all
Includes:
RDFConverter
Defined in:
lib/bel/translator/plugins/rdf2/nanopub_converter.rb

Instance Method Summary collapse

Methods included from RDFConverter

#s

Constructor Details

#initialize(statement_converter) ⇒ NanopubConverter

Returns a new instance of NanopubConverter.



9
10
11
# File 'lib/bel/translator/plugins/rdf2/nanopub_converter.rb', line 9

def initialize(statement_converter)
  @statement_converter = statement_converter
end

Instance Method Details

#convert(nanopub) ⇒ RDF::Graph

Convert a Nanopub::Nanopub to RDF::Graph of RDF statements.

Parameters:

Returns:

  • (RDF::Graph)

    graph of RDF statements representing the nanopub



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bel/translator/plugins/rdf2/nanopub_converter.rb', line 17

def convert(nanopub)
  resource         = generate_nanopub_uri
  graph            = RDF::Graph.new
  graph           << s(resource, RDF.type, BELV2_0.Nanopub)

  bel_statement(nanopub.bel_statement, resource, graph)
  citation(nanopub.citation, resource, graph)
  support(nanopub.support, resource, graph)
  experiment_context(nanopub.experiment_context, resource, graph)
  references(nanopub.references, resource, graph)
  (nanopub., resource, graph)

  graph
end