class RoadForest::Interface::RDF

Public Instance Methods

add_child(focus) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 120
def add_child(focus)
  new_graph
end
add_graph_child(graph) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 113
def add_graph_child(graph)
  start_focus(graph) do |focus|
    add_child(focus)
  end
  new_graph #XXX?
end
augment_graph(graph) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 160
def augment_graph(graph)
  services.augmenter.augment(graph)
end
copy_interface(node, route_name, params=nil) { |copier| ... } click to toggle source
# File lib/roadforest/interface/rdf.rb, line 137
def copy_interface(node, route_name, params=nil)
  params ||= {}

  url = url_for(route_name, params)
  source_interface = interface_for(route_name, params)

  access = RoadForest::Graph::CopyManager.new
  access.source_graph = source_interface.current_graph
  access.target_graph = node.access_manager.destination_graph
  copier = RoadForest::Graph::GraphFocus.new(access, url)

  yield copier if block_given?
  copier
end
current_graph() click to toggle source
# File lib/roadforest/interface/rdf.rb, line 164
def current_graph
  return response_data if response_values.has_key?(:data)
  new_graph
end
error_data(status) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 90
def error_data(status)
  case status
  when 401
    begin
      perm_list_pattern = pattern_for(:perm_list, {}, [:username])

      graph = ::RDF::Graph.new
      perm_aff = ::RDF::Node.new
      perm_pattern = ::RDF::Node.new
      graph << [perm_aff, ::RDF.type, Graph::Af.Navigate]
      graph << [perm_aff, Graph::Af.target, perm_pattern]
      graph << [perm_pattern, Graph::Af.pattern, perm_list_pattern]

    rescue KeyError
      nil
    end
  end
end
etag() click to toggle source
# File lib/roadforest/interface/rdf.rb, line 152
def etag
  @etag ||= etag_from(etag_graph)
end
etag_graph() click to toggle source
# File lib/roadforest/interface/rdf.rb, line 156
def etag_graph
  current_graph
end
fill_graph(graph) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 128
def fill_graph(graph)
end
graph_update(focus) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 109
def graph_update(focus)
  fill_graph(focus)
end
new_graph() click to toggle source
# File lib/roadforest/interface/rdf.rb, line 169
def new_graph
  self.response_data = augment_graph(start_focus do |focus|
    fill_graph(focus)
  end)
end
payload_focus(&block) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 131
def payload_focus(&block)
  payload_pair do |root, graph|
    start_focus(graph, root, &block)
  end
end
payload_pair() { |root_node, graph| ... } click to toggle source

Utility method, useful for overriding update_payload and create_payload

# File lib/roadforest/interface/rdf.rb, line 76
def payload_pair
  root_node = ::RDF::Node.new
  graph = ::RDF::Graph.new
  graph << [root_node, ::RDF.type, Graph::Path.Root]
  yield root_node, graph
  return Payload.new(root_node, graph)
end
retrieve() click to toggle source
# File lib/roadforest/interface/rdf.rb, line 124
def retrieve
  new_graph
end
update(graph) click to toggle source
# File lib/roadforest/interface/rdf.rb, line 84
def update(graph)
  start_focus(graph) do |focus|
    graph_update(focus)
  end
end