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
163 164 165 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 163 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
181 182 183 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 181 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
170 171 172 173 174 175 176 177 |
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 170 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 |