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
42 43 44 45 46 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_handler.rb', line 42 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.
58 59 60 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_handler.rb', line 58 def self.register(url, &block) registry << UrlHandler.new(url, &block) end |