Class: Valkyrie::Persistence::Fedora::Persister::ModelConverter::NestedInternalValkyrieID

Inherits:
MappedFedoraValue show all
Defined in:
lib/valkyrie/persistence/fedora/persister/model_converter.rb

Overview

Class mapping Property objects for Valkyrie IDs using typed RDF literals This generates a custom datatype URI for Valkyrie IDs

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 the value is a Property for Valkyrie ID with a hash URI for the RDF graph

Parameters:

  • value (Object)

Returns:

  • (Boolean)


355
356
357
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 355

def self.handles?(value)
  value.is_a?(Property) && value.value.is_a?(Valkyrie::ID) && value.subject.to_s.include?("#")
end

Instance Method Details

#resultValkyrie::Persistence::Fedora::Persister::ModelConverter::Property

Converts the RDF literal into the Property For example, a Valkyrie::ID with the value “db67d786-d187-46b8-a44f-a494f0c65ec2”

will first be mapped to RDF::Literal "db67d786-d187-46b8-a44f-a494f0c65ec2"^^<http://example.com/predicate/valkyrie_id>


363
364
365
366
367
368
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 363

def result
  map_value(converted_value: RDF::Literal.new(
    value.value,
    datatype: PermissiveSchema.valkyrie_id
  ))
end