Class: RoadForest::Utility::Backfill
- Inherits:
-
Interface::RDF
- Object
- Webmachine::Application
- Application
- Interface::RDF
- RoadForest::Utility::Backfill
- Defined in:
- lib/roadforest/interface/utility/backfill.rb
Instance Attribute Summary
Attributes inherited from Application
Class Method Summary collapse
-
.domains ⇒ Object
A backfill domain is an opaque selector for backfills and their client resources to coordinate with.
- .fragment_for(name, type) ⇒ Object
-
.types ⇒ Object
Backfill types are used to select within a resource which backfill is being rendered - the defaults are :update and :create to correspond with PUT and POST methods and af:Update and af:Create.
Instance Method Summary collapse
Methods inherited from Interface::RDF
#add_child, #add_graph_child, #augment_graph, #copy_interface, #current_graph, #error_data, #etag, #etag_graph, #fill_graph, #graph_update, #payload_focus, #payload_pair, #retrieve, #update
Methods included from Graph::Helpers::Focus
Methods included from Graph::Etagging
#blank_mapped, #etag_from, #sorted_quads
Methods inherited from Application
#canonical_host, #default_content_engine, #dispatcher, #initialize
Constructor Details
This class inherits a constructor from RoadForest::Application
Class Method Details
.domains ⇒ Object
A backfill domain is an opaque selector for backfills and their client resources to coordinate with. Use them to partition backfills by the stability of interface, or to group like resources or whatever. Backfill domain names will never be exposed outside of the server.
10 11 12 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 10 def self.domains [:general] end |
.fragment_for(name, type) ⇒ Object
33 34 35 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 33 def self.fragment_for(name, type) "##{name}-#{type}" end |
.types ⇒ Object
Backfill types are used to select within a resource which backfill is being rendered - the defaults are :update and :create to correspond with PUT and POST methods and af:Update and af:Create.
21 22 23 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 21 def self.types [:update, :create] end |
Instance Method Details
#domains ⇒ Object
14 15 16 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 14 def domains self.class.domains end |
#new_graph ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 37 def new_graph graph = ::RDF::Graph.new path_provider.each_name_and_route do |name, route| interface_class = route.interface_class next if interface_class.nil? next unless interface_class.respond_to? :backfill_payload domains.each do |domain| types.each do |type| payload_graph = interface_class.backfill_payload(domain, type, root_for(name, domain, type)) next if payload_graph.nil? payload_graph.each_statement do |stmt| graph << stmt end end end end graph end |
#root_for(name, domain, type) ⇒ Object
29 30 31 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 29 def root_for(name, domain, type) my_url + self.class.fragment_for(name, type) end |
#types ⇒ Object
25 26 27 |
# File 'lib/roadforest/interface/utility/backfill.rb', line 25 def types self.class.types end |