Module: ROF::Translators::JsonldToRof::PredicateObjectHandler

Defined in:
lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb

Overview

We need to handle the Predicate / Object pair as one (thank you RDF blank nodes for this nuance)

Defined Under Namespace

Classes: UnknownRdfObjectTypeError

Class Method Summary collapse

Class Method Details

.call(predicate, object, accumulator, options = {}) ⇒ ROF::Translators::JsonldToRof::Accumulator

Note:

It is assumed that all blank nodes (e.g. RDF::Node) will be processed before you process any RDF::URI nodes.

Parse the RDF::Predicate, RDF::Object and the relevant data to the contents to the accumulator

Examples:

Given the following 4 RDF N-Triples (subject, predicate, object). The first and second RDF objects are RDF::Literal. The 3rd triple's object is
and RDF::Node. And the last is an RDF::URI. Each require different handlers as they have nuanced differences.
  _:b0 <http://purl.org/dc/terms/contributor> "David R.Hyde" .
  _:b0 <http://www.ndltd.org/standards/metadata/etdms/1.1/role> "Research Director" .
  <https://curate.nd.edu/show/zk51vd69n1r> <http://purl.org/dc/terms/contributor> _:b0 .
  <https://curate.nd.edu/show/zk51vd69n1r> <http://projecthydra.org/ns/relations#hasEditorGroup> <https://curate.nd.edu/show/q524jm23g92> .

Parameters:

  • predicate (RDF::Predicate)
    • the RDF predicate that we will parse and add to the appropriate spot in the accumulator

  • object (RDF::Object)
    • the RDF object that we will parse and add to the appropriate spot in the accumulator

  • accumulator (ROF::Translators::JsonldToRof::Accumulator)
    • a data accumulator that will be changed in place

Returns:

Raises:

  • (ROF::Translators::JsonldToRof::UnknownRdfObjectTypeError)

    when the RDF::Object’s subject is not a valid type



30
31
32
33
# File 'lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb', line 30

def self.call(predicate, object, accumulator, options = {})
  new(predicate, object, accumulator, options).call
  accumulator
end