Class: Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, key, value, adapter, resource) ⇒ Property



47
48
49
50
51
52
53
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 47

def initialize(subject, key, value, adapter, resource)
  @subject = subject
  @key = key
  @value = value
  @adapter = adapter
  @resource = resource
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



44
45
46
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 44

def adapter
  @adapter
end

#keyObject (readonly)

Returns the value of attribute key.



44
45
46
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 44

def key
  @key
end

#resourceObject (readonly)

Returns the value of attribute resource.



44
45
46
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 44

def resource
  @resource
end

#subjectObject (readonly)

Returns the value of attribute subject.



44
45
46
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 44

def subject
  @subject
end

#valueObject (readonly)

Returns the value of attribute value.



44
45
46
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 44

def value
  @value
end

Instance Method Details

#predicateObject



62
63
64
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 62

def predicate
  schema.predicate_for(resource: resource, property: key)
end

#to_graph(graph = RDF::Graph.new) ⇒ Object



55
56
57
58
59
60
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 55

def to_graph(graph = RDF::Graph.new)
  Array(value).each do |val|
    graph << RDF::Statement.new(subject, predicate, val)
  end
  graph
end