Class: RoadForest::Graph::PostFocus

Inherits:
GraphFocus show all
Defined in:
lib/roadforest/graph/post-focus.rb

Constant Summary

Constants included from Normalization

Normalization::Vocabs

Instance Attribute Summary collapse

Attributes inherited from GraphFocus

#access_manager, #subject

Instance Method Summary collapse

Methods inherited from GraphFocus

#<<, #add, #add_list, #add_node, #all, #as_list, #create_node, #delete, #empty_list, #find_or_add, #first, #forward_properties, #get, #inspect, #normalize_triple, #relevant_prefixes, #reset, #rev, #rev_all, #rev_first, #reverse_properties, #root_url, #root_url=, #set, #set_node, #to_context, #unwrap_value, #wrap_node

Methods included from Normalization

#expand_curie, #expand_curie_pair, #interned_uri, #literal, #normalize_context, #normalize_property, #normalize_resource, #normalize_statement, #normalize_term, #normalize_tuple, #normalize_uri, #relevant_prefixes_for_graph, #root_url, #uri, #vocabularies_in_graph

Constructor Details

#initialize(access_manager, subject = nil) ⇒ PostFocus

Returns a new instance of PostFocus.



8
9
10
11
# File 'lib/roadforest/graph/post-focus.rb', line 8

def initialize(access_manager, subject = nil)
  super
  @graphs = {}
end

Instance Attribute Details

#graphsObject

Returns the value of attribute graphs.



6
7
8
# File 'lib/roadforest/graph/post-focus.rb', line 6

def graphs
  @graphs
end

Instance Method Details

#dupObject



13
14
15
16
17
# File 'lib/roadforest/graph/post-focus.rb', line 13

def dup
  other = super
  other.graphs = graphs
  other
end

#post_to {|focus| ... } ⇒ Object

Yields:

  • (focus)


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/roadforest/graph/post-focus.rb', line 19

def post_to
  graph = ::RDF::Graph.new
  access = WriteManager.new
  access.source_graph = graph
  focus = GraphFocus.new(access, subject)

  graphs[subject] = graph

  yield focus if block_given?
  return focus
end