Sha256: 854d905d2bfc5f038dcef6afba972cd66f99290ddee8188a78f7e008c181ba48

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

module ActiveFedora
  class LdpResource < Ldp::Resource::RdfSource
    def build_empty_graph
      graph_class.new(subject_uri)
    end

    def self.graph_class
      ActiveTriples::Resource
    end

    def graph_class
      self.class.graph_class
    end

    ##
    # @param [RDF::Graph] original_graph The graph returned by the LDP server
    # @return [RDF::Graph] A graph striped of any inlined resources present in the original
    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

    # Don't dump @client, it has a proc and thus can't be serialized.
    def marshal_dump
      ivars = (instance_variables - [:@client]).map { |name| [name, instance_variable_get(name)] }
    end

    def marshal_load(data)
      ivars = data
      ivars.each { |name, val| instance_variable_set(name, val) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active-fedora-9.5.0 lib/active_fedora/ldp_resource.rb
active-fedora-9.4.3 lib/active_fedora/ldp_resource.rb
active-fedora-9.4.2 lib/active_fedora/ldp_resource.rb
active-fedora-9.4.1 lib/active_fedora/ldp_resource.rb
active-fedora-9.4.0 lib/active_fedora/ldp_resource.rb
active-fedora-9.3.0 lib/active_fedora/ldp_resource.rb