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

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

Overview

Casts the value of the RDF literal into an Applicator for URIs referencing Valkyrie Resources

Returns:

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

Determines whether or not a Property statement is URI referring internally to a Valkyrie Resource

Parameters:

Returns:

  • (Boolean)


429
430
431
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 429

def self.handles?(value)
  value.statement.object.is_a?(RDF::URI) && value.statement.object.to_s.start_with?(value.adapter.connection_prefix)
end

Instance Method Details

#resultApplicator

Casts the value of the URI into an Applicator for Valkyrie::Resource objects

Returns:



435
436
437
438
# File 'lib/valkyrie/persistence/fedora/persister/orm_converter.rb', line 435

def result
  value.statement.object = value.adapter.uri_to_id(value.statement.object)
  calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result
end