class ActiveFedora::LdpResourceService

Attributes

connection[R]

Public Class Methods

new(conn) click to toggle source
# File lib/active_fedora/ldp_resource_service.rb, line 5
def initialize(conn)
  @connection = conn
end

Public Instance Methods

build(klass, id) click to toggle source
# File lib/active_fedora/ldp_resource_service.rb, line 9
def build(klass, id)
  if id
    LdpResource.new(connection, to_uri(klass, id))
  else
    parent_uri = ActiveFedora.fedora.host + ActiveFedora.fedora.base_path
    LdpResource.new(connection, nil, nil, parent_uri)
  end
end
build_resource_under_path(graph, parent_uri) click to toggle source
# File lib/active_fedora/ldp_resource_service.rb, line 18
def build_resource_under_path(graph, parent_uri)
  parent_uri ||= ActiveFedora.fedora.host + ActiveFedora.fedora.base_path
  LdpResource.new(connection, nil, graph, parent_uri)
end
update(change_set, klass, id) click to toggle source
# File lib/active_fedora/ldp_resource_service.rb, line 23
def update(change_set, klass, id)
  SparqlInsert.new(change_set.changes).execute(to_uri(klass, id))
end

Private Instance Methods

to_uri(klass, id) click to toggle source
# File lib/active_fedora/ldp_resource_service.rb, line 29
def to_uri(klass, id)
  klass.id_to_uri(id)
end