Class: Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property
- Defined in:
- lib/valkyrie/persistence/fedora/persister/model_converter.rb
Overview
Class modeling properties for Fedora LDP resources These map directly to attributes on the Valkyrie resources and generate a new graph or populate an existing graph
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(subject, key, value, adapter, resource) ⇒ Property
constructor
A new instance of Property.
-
#predicate ⇒ RDF::URI
Retrieve the RDF predicate for this Valkyrie Resource attribute (being converted) This is used to generate RDF statements (triples) from Resource attributes.
-
#to_graph(graph = RDF::Graph.new) ⇒ RDF::Graph
Populate the RDF graph containing statements about the LDP container.
Constructor Details
#initialize(subject, key, value, adapter, resource) ⇒ Property
Returns a new instance of Property.
72 73 74 75 76 77 78 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 72 def initialize(subject, key, value, adapter, resource) @subject = subject @key = key @value = value @adapter = adapter @resource = resource end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
64 65 66 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 64 def adapter @adapter end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
64 65 66 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 64 def key @key end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
64 65 66 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 64 def resource @resource end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
64 65 66 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 64 def subject @subject end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
64 65 66 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 64 def value @value end |
Instance Method Details
#predicate ⇒ RDF::URI
Retrieve the RDF predicate for this Valkyrie Resource attribute (being converted) This is used to generate RDF statements (triples) from Resource attributes
93 94 95 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 93 def predicate schema.predicate_for(resource: resource, property: key) end |
#to_graph(graph = RDF::Graph.new) ⇒ RDF::Graph
Populate the RDF graph containing statements about the LDP container
83 84 85 86 87 88 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 83 def to_graph(graph = RDF::Graph.new) Array(value).each do |val| graph << RDF::Statement.new(subject, predicate, val) end graph end |