Class: Valkyrie::Persistence::Fedora::Persister::ModelConverter::NestedProperty
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Fedora::Persister::ModelConverter::NestedProperty
- Defined in:
- lib/valkyrie/persistence/fedora/persister/model_converter.rb
Overview
Class mapping Valkyrie attribute values which have already been
mapped to Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property objects
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not the Valkyrie attribute value can be ordered.
Instance Method Summary collapse
-
#nested_graph ⇒ RDF::Graph
Generate the “child” graph from the value in the ModelConverter::Property.
-
#result ⇒ GraphProperty
Generate a new parent graph containing the child graph generated from the ModelConverter::Property objects.
-
#subject_uri ⇒ RDF::Graph
Generate a new RDF hash URI for the “child” graph for the ModelConverter::Property.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Determines whether or not the Valkyrie attribute value can be ordered
290 291 292 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 290 def self.handles?(value) value.is_a?(Property) && value.value.is_a?(Hash) && value.value[:internal_resource] end |
Instance Method Details
#nested_graph ⇒ RDF::Graph
Generate the “child” graph from the value in the ModelConverter::Property
303 304 305 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 303 def nested_graph @nested_graph ||= ModelConverter.new(resource: Valkyrie::Types::Anything[value.value], adapter: value.adapter, subject_uri: subject_uri).convert.graph end |
#result ⇒ GraphProperty
Generate a new parent graph containing the child graph generated from the ModelConverter::Property objects
296 297 298 299 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 296 def result nested_graph << RDF::Statement.new(value.subject, value.predicate, subject_uri) GraphProperty.new(value.subject, value.key, nested_graph, value.adapter, value.resource) end |
#subject_uri ⇒ RDF::Graph
Generate a new RDF hash URI for the “child” graph for the ModelConverter::Property
310 311 312 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 310 def subject_uri @subject_uri ||= ::RDF::URI(RDF::Node.new.to_s.gsub("_:", "#")) end |