Class: Valkyrie::Persistence::Fedora::Persister::OrmConverter::GraphToAttributes::MemberID

Inherits:
ValueMapper
  • Object
show all
Defined in:
lib/valkyrie/persistence/fedora/persister/orm_converter.rb

Instance Attribute Summary

Attributes inherited from ValueMapper

#calling_mapper, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ValueMapper

for, #initialize, register

Constructor Details

This class inherits a constructor from Valkyrie::ValueMapper

Class Method Details

.handles?(value) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 95

def self.handles?(value)
  value.statement.predicate == ::RDF::Vocab::IANA.first
end

Instance Method Details

#headObject



108
109
110
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 108

def head
  scope.query([value.statement.subject, RDF::Vocab::IANA.first]).to_a.first.object
end

#resultObject



99
100
101
102
103
104
105
106
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 99

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

#tailObject



112
113
114
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 112

def tail
  scope.query([value.statement.subject, RDF::Vocab::IANA.last]).to_a.first.object
end