class ActiveFedora::ChangeSet

def changes

def changes
  @changes ||= changed_attributes.each_with_object({}) do |key, result|
    if object.respond_to?(:association) && object.association(key.to_sym).present?
      predicate = object.association(key.to_sym).reflection.predicate
      result[predicate] = graph.query(predicate: predicate)
    elsif object.class.properties.keys.include?(key)
      predicate = graph.reflections.reflect_on_property(key).predicate
      result[predicate] = graph.query(predicate: predicate)
    elsif object.local_attributes.include?(key)
      raise "Unable to find a graph predicate corresponding to the attribute: \"#{key}\""
    end
  end
end