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
-
.call(predicate, object, accumulator, options = {}) ⇒ ROF::Translators::JsonldToRof::Accumulator
Parse the RDF::Predicate, RDF::Object and the relevant data to the contents to the accumulator.
- .klass_for(object) ⇒ Object private
- .new(predicate, object, accumulator, options) ⇒ #call private
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
28 29 30 31 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb', line 28 def self.call(predicate, object, accumulator, = {}) new(predicate, object, accumulator, ).call accumulator end |
.klass_for(object) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb', line 47 def self.klass_for(object) case object when RDF::URI UriPredicateObjectHandler when RDF::Node NodePredicateObjectHandler when RDF::Literal LiteralPredicateObjectHandler else raise UnknownRdfObjectTypeError, "Unable to determine object handler for #{object.inspect}" end end |
.new(predicate, object, accumulator, options) ⇒ #call
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/rof/translators/jsonld_to_rof/predicate_object_handler.rb', line 39 def self.new(predicate, object, accumulator, ) klass_for(object).new(predicate, object, accumulator, ) end |