Class: ActiveFedora::Rdf::ObjectResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/active_fedora/rdf/object_resource.rb

Overview

A class of RdfResources to act as the primary/root resource associated with a Datastream and ActiveFedora::Base object.

Instance Attribute Summary collapse

Attributes inherited from Resource

#parent

Attributes included from Properties

#config

Instance Method Summary collapse

Methods inherited from Resource

#attributes=, #base_uri, #destroy, #destroy_child, #fetch, #fields, #final_parent, from_uri, #get_term, #get_values, #graph, #initialize, #mark_for_destruction, #marked_for_destruction?, #new_record?, #node?, #rdf_label, #rdf_subject, #reload, #set_subject!, #set_value, #solrize, #to_term, #type, #type=, type_registry, #writable?

Methods included from Configurable

#base_uri, #configure, #rdf_label, #rdf_type, #repository, #transform_type, #type

Methods included from Properties

#config_for_term_or_uri, #fields, #map_predicates, #property

Constructor Details

This class inherits a constructor from ActiveFedora::Rdf::Resource

Instance Attribute Details

#datastreamObject

Returns the value of attribute datastream.



9
10
11
# File 'lib/active_fedora/rdf/object_resource.rb', line 9

def datastream
  @datastream
end

Instance Method Details

#persist!Object



11
12
13
14
# File 'lib/active_fedora/rdf/object_resource.rb', line 11

def persist!
  return false unless datastream and datastream.respond_to? :digital_object
  @persisted ||= datastream.digital_object.save
end

#persisted?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/active_fedora/rdf/object_resource.rb', line 16

def persisted?
  @persisted ||= (not datastream.new?)
end