module ActiveFedora::FedoraAttributes

def create_date

def create_date
  super.first
end

def id

def id
  if uri.kind_of?(::RDF::URI) && uri.value.blank?
    nil
  elsif uri.present?
    self.class.uri_to_id(URI.parse(uri))
  end
end

def id=(id)

def id=(id)
  raise "ID has already been set to #{self.id}" if self.id
  @ldp_source = build_ldp_resource(id.to_s)
end

def modified_date

def modified_date
  super.first
end

def pid

TODO: Remove after we no longer support #pid.
def pid
  Deprecation.warn FedoraAttributes, "#{self.class}#pid is deprecated and will be removed in active-fedora 10.0. Use #{self.class}#id instead."
  id
end

def rdf_label

the instance, calling rdf_label returns the value of that configured property
You can set the URI to use for the rdf_label on ClassMethods.rdf_label, then on
def rdf_label
  resource.rdf_label
end

def resource

set_value, get_value, and property accessors are delegated to this object.

other nodes.
the datastream and is the central point for its relationship to
The resource is the RdfResource object that stores the graph for
#
def resource
  @resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, @ldp_source.graph)
end

def set_value(*args)

Override ActiveTriples method for setting properties
def set_value(*args)
  raise ReadOnlyRecord if readonly?
  resource.set_value(*args)
end

def uri

def uri
  # TODO could we return a RDF::URI instead?
  uri = @ldp_source.try(:subject_uri)
  uri.value == '' ? uri : uri.to_s
end