Class: Valkyrie::Persistence::Fedora::ListNode::Resource

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

Overview

Class for providing a set of triples modeling linked list nodes

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, graph: RDF::Graph.new) ⇒ Resource

Returns a new instance of Resource.



138
139
140
141
# File 'lib/valkyrie/persistence/fedora/list_node.rb', line 138

def initialize(uri, graph: RDF::Graph.new)
  @uri = uri
  @graph = graph
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



137
138
139
# File 'lib/valkyrie/persistence/fedora/list_node.rb', line 137

def graph
  @graph
end

#uriObject (readonly)

Returns the value of attribute uri.



137
138
139
# File 'lib/valkyrie/persistence/fedora/list_node.rb', line 137

def uri
  @uri
end

Class Method Details

.property(property, predicate:) ⇒ Object



121
122
123
124
125
126
127
128
129
130
# File 'lib/valkyrie/persistence/fedora/list_node.rb', line 121

def self.property(property, predicate:)
  define_method property do
    graph.query([uri, predicate, nil]).objects.first
  end

  define_method "#{property}=" do |val|
    return if val.nil?
    graph << [uri, predicate, val]
  end
end