Class: Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes::MemberID
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes::MemberID
- Defined in:
- lib/valkyrie/persistence/fedora/persister/orm_converter.rb
Overview
Class for mapping resource member IDs in an RDF linked list
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not the Property statement references an RDF linked list.
Instance Method Summary collapse
-
#head ⇒ RDF::URI
Retrieve the URI for the first element in the linked list.
-
#result ⇒ CompositeApplicator
Constructs a CompositeApplicator object for each element in the RDF linked list Involves mapping to Property objects using an OrderedList.
-
#tail ⇒ RDF::URI
Retrieve the URI for the last element in the linked list.
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 Property statement references an RDF linked list
164 165 166 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 164 def self.handles?(value) value.statement.predicate == ::RDF::Vocab::IANA.first end |
Instance Method Details
#head ⇒ RDF::URI
Retrieve the URI for the first element in the linked list
182 183 184 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 182 def head scope.query([value.statement.subject, RDF::Vocab::IANA.first]).to_a.first.object end |
#result ⇒ CompositeApplicator
Constructs a CompositeApplicator object for each element in the RDF linked list Involves mapping to Property objects using an OrderedList
171 172 173 174 175 176 177 178 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 171 def result value.statement.predicate = PermissiveSchema.member_ids values = OrderedList.new(scope, head, tail, adapter).to_a.map(&:proxy_for) values = values.map do |val| calling_mapper.for(Property.new(statement: RDF::Statement.new(value.statement.subject, value.statement.predicate, val), scope: value.scope, adapter: value.adapter)).result end CompositeApplicator.new(values) end |
#tail ⇒ RDF::URI
Retrieve the URI for the last element in the linked list
188 189 190 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 188 def tail scope.query([value.statement.subject, RDF::Vocab::IANA.last]).to_a.first.object end |