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
298 299 300 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 298 def self.handles?(value) value.is_a?(Property) && (value.value.is_a?(Hash) || value.value.is_a?(Valkyrie::Resource)) && value.value[:internal_resource] end |
Instance Method Details
#nested_graph ⇒ RDF::Graph
Generate the “child” graph from the value in the ModelConverter::Property
311 312 313 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 311 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
304 305 306 307 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 304 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 |