Class: Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes
- Defined in:
- lib/valkyrie/persistence/fedora/persister/orm_converter.rb
Overview
Class for deriving an attribute Hash from a Fedora LDP resource graph
Defined Under Namespace
Classes: Applicator, BooleanValue, CompositeApplicator, CreatedAtValue, DateTimeValue, DenylistedValue, DifferentSubject, FedoraValue, FloatValue, IntegerValue, InternalModelValue, InternalURI, LiteralValue, MemberID, NestedValue, NonStringSingleApplicator, NullApplicator, OrderedProperty, Property, SingleApplicator, TimeValue, UpdatedAtValue, ValkyrieIDValue
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
-
#attributes ⇒ Hash
Access the attributes populated by RDF graph statements.
-
#convert ⇒ Hash
Generates FedoraValue objects for each statement in the Fedora LDP resource graph Using these objects, it then generates a Hash of Valkyrie Resource attributes.
-
#initialize(graph:, adapter:) ⇒ GraphToAttributes
constructor
A new instance of GraphToAttributes.
Constructor Details
#initialize(graph:, adapter:) ⇒ GraphToAttributes
Returns a new instance of GraphToAttributes.
70 71 72 73 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 70 def initialize(graph:, adapter:) @graph = graph @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
66 67 68 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 66 def adapter @adapter end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
66 67 68 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 66 def graph @graph end |
Instance Method Details
#attributes ⇒ Hash
Access the attributes populated by RDF graph statements
87 88 89 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 87 def attributes @attributes ||= {} end |
#convert ⇒ Hash
Generates FedoraValue objects for each statement in the Fedora LDP resource graph
Using these objects, it then generates a Hash of Valkyrie Resource attributes
78 79 80 81 82 83 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 78 def convert graph.each do |statement| FedoraValue.for(Property.new(statement: statement, scope: graph, adapter: adapter)).result.apply_to(attributes) end attributes end |