Module: ROF::Translators::JsonldToRof::PredicateHandler
- Defined in:
- lib/rof/translators/jsonld_to_rof/predicate_handler.rb
Overview
Responsible for dealing with registered predicates and how those are handled.
The two primary entry points are .call and .register
Defined Under Namespace
Classes: UnhandledPredicateError
Class Method Summary collapse
-
.call(predicate, object, accumulator, blank_node = false) ⇒ ROF::Translators::JsonldToRof::Accumulator
Parse the RDF predicate and RDF object and add it’s contents to the accumulator.
-
.register(url) {|| ... } ⇒ Object
Register a map of an RDF Predicate URL to it’s spot in the ROF Hash.
Class Method Details
.call(predicate, object, accumulator, blank_node = false) ⇒ 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 and RDF object and add it’s contents to the accumulator
39 40 41 42 43 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_handler.rb', line 39 def self.call(predicate, object, accumulator, blank_node = false) handler = registry.handler_for(predicate) handler.handle(object, accumulator, blank_node) accumulator end |
.register(url) {|| ... } ⇒ Object
Register a map of an RDF Predicate URL to it’s spot in the ROF Hash.
53 54 55 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_handler.rb', line 53 def self.register(url, &block) registry << UrlHandler.new(url, &block) end |