Module: ROF::Translators::JsonldToRof

Defined in:
lib/rof/translators/jsonld_to_rof.rb,
lib/rof/translators/jsonld_to_rof/accumulator.rb,
lib/rof/translators/jsonld_to_rof/predicate_handler.rb,
lib/rof/translators/jsonld_to_rof/statement_handler.rb,
lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb

Overview

Note:

Some predicates require explicit mapping where as others have an assumed mapping. At present all URLs for @context of JSON-LD documents must be registered.

Responsible for converting JSON LD into an ROF Hash through the ‘.call` method (using the URI maps defined by the `.register` method)

See Also:

Defined Under Namespace

Modules: PredicateHandler, PredicateObjectHandler, StatementHandler Classes: Accumulator

Constant Summary collapse

REGEXP_FOR_A_CURATE_RDF_SUBJECT =

The $1 will be the PID

See Also:

  • specs for expected behavior
%r{\Ahttps?://curate(?:[\w\.]*).nd.edu/show/([[:alnum:]]+)/?}.freeze

Class Method Summary collapse

Class Method Details

.call(jsonld, config) ⇒ Array<Hash>

Convert’s the given JSON-LD into an ROF document that can be used to batch ingest into Fedora.

Parameters:

  • jsonld (Array<Hash>, Hash)
    • a Hash of JSON-LD data or an Array of JSON-LD Hashes

  • config (Hash)

    (included to conform to the loose interface of translators)

Returns:

  • (Array<Hash>)

    An ROF document



96
97
98
99
100
# File 'lib/rof/translators/jsonld_to_rof.rb', line 96

def self.call(jsonld, config)
  Array.wrap(jsonld).map! do |element|
    Element.new(element).to_rof
  end
end