class ROF::Translators::JsonldToRof::Element

A single top-level element of a JSON-LD document

Attributes

accumulator[R]
element[R]

Public Class Methods

new(element) click to toggle source
# File lib/rof/translators/jsonld_to_rof.rb, line 104
def initialize(element)
  @element = element
end

Public Instance Methods

to_rof() click to toggle source
# File lib/rof/translators/jsonld_to_rof.rb, line 108
def to_rof
  @accumulator = Accumulator.new(base_rof)
  JSON::LD::API.toRdf(element) do |statement|
    StatementHandler.call(statement, accumulator)
  end
  @accumulator.to_rof
end

Private Instance Methods

base_rof() click to toggle source
# File lib/rof/translators/jsonld_to_rof.rb, line 120
def base_rof
  { "type" => "fobject", "metadata" => { "@context" => ROF::RdfContext }, "rels-ext" => { "@context" => ROF::RelsExtRefContext } }
end