Class: ActiveFedora::LdpResource
- Inherits:
-
Ldp::Resource::RdfSource
- Object
- Ldp::Resource::RdfSource
- ActiveFedora::LdpResource
- Defined in:
- lib/active_fedora/ldp_resource.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_empty_graph ⇒ Object
-
#build_graph(original_graph) ⇒ RDF::Graph
A graph striped of any inlined resources present in the original.
- #graph_class ⇒ Object
-
#marshal_dump ⇒ Object
Don’t dump @client, it has a proc and thus can’t be serialized.
- #marshal_load(data) ⇒ Object
Class Method Details
.graph_class ⇒ Object
7 8 9 |
# File 'lib/active_fedora/ldp_resource.rb', line 7 def self.graph_class ActiveTriples::Resource end |
Instance Method Details
#build_empty_graph ⇒ Object
3 4 5 |
# File 'lib/active_fedora/ldp_resource.rb', line 3 def build_empty_graph graph_class.new(subject_uri) end |
#build_graph(original_graph) ⇒ RDF::Graph
Returns A graph striped of any inlined resources present in the original.
18 19 20 21 22 23 24 |
# File 'lib/active_fedora/ldp_resource.rb', line 18 def build_graph(original_graph) inlined_resources = get.graph.query(predicate: Ldp.contains).map { |x| x.object } # ActiveFedora always wants to copy the resources to a new graph because it # forces a cast to FedoraRdfResource graph_without_inlined_resources(original_graph, inlined_resources) end |
#graph_class ⇒ Object
11 12 13 |
# File 'lib/active_fedora/ldp_resource.rb', line 11 def graph_class self.class.graph_class end |
#marshal_dump ⇒ Object
Don’t dump @client, it has a proc and thus can’t be serialized.
27 28 29 |
# File 'lib/active_fedora/ldp_resource.rb', line 27 def marshal_dump ivars = (instance_variables - [:@client]).map { |name| [name, instance_variable_get(name)] } end |
#marshal_load(data) ⇒ Object
31 32 33 34 |
# File 'lib/active_fedora/ldp_resource.rb', line 31 def marshal_load(data) ivars = data ivars.each { |name, val| instance_variable_set(name, val) } end |