roadforest 0.5 → 0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/examples/file-management.rb +70 -58
  3. data/lib/roadforest/application.rb +9 -17
  4. data/lib/roadforest/application/dispatcher.rb +76 -9
  5. data/lib/roadforest/application/parameters.rb +9 -1
  6. data/lib/roadforest/application/path-provider.rb +30 -3
  7. data/lib/roadforest/application/route-adapter.rb +96 -14
  8. data/lib/roadforest/application/services-host.rb +21 -3
  9. data/lib/roadforest/augment/affordance.rb +82 -11
  10. data/lib/roadforest/augment/augmentation.rb +24 -6
  11. data/lib/roadforest/augment/augmenter.rb +12 -3
  12. data/lib/roadforest/authorization.rb +7 -229
  13. data/lib/roadforest/authorization/auth-entity.rb +26 -0
  14. data/lib/roadforest/authorization/authentication-chain.rb +79 -0
  15. data/lib/roadforest/authorization/default-authentication-store.rb +33 -0
  16. data/lib/roadforest/authorization/grant-builder.rb +23 -0
  17. data/lib/roadforest/authorization/grants-holder.rb +58 -0
  18. data/lib/roadforest/authorization/manager.rb +85 -0
  19. data/lib/roadforest/authorization/policy.rb +19 -0
  20. data/lib/roadforest/graph/access-manager.rb +25 -2
  21. data/lib/roadforest/graph/focus-list.rb +4 -0
  22. data/lib/roadforest/graph/graph-focus.rb +30 -13
  23. data/lib/roadforest/graph/nav-affordance-builder.rb +62 -0
  24. data/lib/roadforest/graph/normalization.rb +3 -3
  25. data/lib/roadforest/graph/path-vocabulary.rb +64 -0
  26. data/lib/roadforest/graph/post-focus.rb +5 -0
  27. data/lib/roadforest/graph/vocabulary.rb +4 -1
  28. data/lib/roadforest/http/adapters/excon.rb +4 -0
  29. data/lib/roadforest/http/graph-transfer.rb +17 -1
  30. data/lib/roadforest/http/keychain.rb +121 -33
  31. data/lib/roadforest/http/user-agent.rb +5 -3
  32. data/lib/roadforest/interface/application.rb +25 -8
  33. data/lib/roadforest/interface/rdf.rb +114 -15
  34. data/lib/roadforest/interface/utility.rb +3 -0
  35. data/lib/roadforest/interface/utility/backfill.rb +63 -0
  36. data/lib/roadforest/interface/utility/grant-list.rb +45 -0
  37. data/lib/roadforest/interface/utility/grant.rb +22 -0
  38. data/lib/roadforest/interfaces.rb +1 -0
  39. data/lib/roadforest/path-matcher.rb +471 -0
  40. data/lib/roadforest/remote-host.rb +159 -35
  41. data/lib/roadforest/resource/read-only.rb +23 -4
  42. data/lib/roadforest/server.rb +32 -3
  43. data/lib/roadforest/source-rigor/graph-store.rb +0 -2
  44. data/lib/roadforest/source-rigor/rigorous-access.rb +138 -21
  45. data/lib/roadforest/templates/affordance-property-values.haml +3 -0
  46. data/lib/roadforest/templates/rdfpost-curie.haml +1 -1
  47. data/lib/roadforest/test-support/matchers.rb +41 -12
  48. data/lib/roadforest/test-support/remote-host.rb +3 -3
  49. data/lib/roadforest/type-handlers/rdfa-writer/environment-decorator.rb +1 -1
  50. data/lib/roadforest/type-handlers/rdfa-writer/render-engine.rb +40 -27
  51. data/lib/roadforest/type-handlers/rdfa.rb +10 -3
  52. data/lib/roadforest/utility/class-registry.rb +44 -4
  53. data/spec/affordance-augmenter.rb +46 -19
  54. data/spec/affordances-flow.rb +46 -30
  55. data/spec/authorization.rb +16 -4
  56. data/spec/client.rb +22 -4
  57. data/spec/focus-list.rb +24 -0
  58. data/spec/full-integration.rb +8 -3
  59. data/spec/graph-store.rb +8 -0
  60. data/spec/keychain.rb +18 -14
  61. data/spec/rdf-normalization.rb +32 -6
  62. data/spec/update-focus.rb +36 -39
  63. metadata +19 -5
@@ -19,10 +19,18 @@ describe RoadForest::Graph::GraphFocus, "with UpdateManager" do
19
19
  ::RDF::Statement.from [ context_node, Voc[:a], 7 ]
20
20
  end
21
21
 
22
+ let :simple_pattern do
23
+ ::RDF::Query::Pattern.from(simple_statement.to_hash.merge(:context => :context))
24
+ end
25
+
22
26
  let :blank_node_statement do
23
27
  ::RDF::Statement.from [ context_node, Voc[:b], blank_node ]
24
28
  end
25
29
 
30
+ let :blank_node_pattern do
31
+ ::RDF::Query::Pattern.from(blank_node_statement.to_hash.merge(:object => nil, :context => :context))
32
+ end
33
+
26
34
  let :context_statements do
27
35
  [
28
36
  simple_statement,
@@ -67,6 +75,7 @@ describe RoadForest::Graph::GraphFocus, "with UpdateManager" do
67
75
  access.source_graph = source_graph
68
76
  access.target_graph = target_graph
69
77
  access.rigor = source_rigor
78
+ access.reset
70
79
  end
71
80
  end
72
81
 
@@ -84,35 +93,29 @@ describe RoadForest::Graph::GraphFocus, "with UpdateManager" do
84
93
  it "should copy entire context when resource is written" do
85
94
  updater[Voc[:a]] = 17
86
95
 
87
- resource_graph = ::RDF::Graph.new(context_node, :data => target_graph)
96
+ target_graph.query(:object => RoadForest::Graph::Vocabulary::RF[:Impulse]).should be_empty
97
+ target_graph.query([context_node, Voc[:a], 17, :context]).should_not be_empty
98
+ target_graph.query(simple_pattern).should be_empty
88
99
 
89
- resource_graph.query(:object => RoadForest::Graph::Vocabulary::RF[:Impulse]).should be_empty
90
- resource_graph.query(simple_statement).should be_empty
91
-
92
- resource_graph.query(blank_node_statement).should_not be_empty
93
- resource_graph.query([context_node, Voc[:a], 17]).should_not be_empty
100
+ target_graph.query(blank_node_pattern).should_not be_empty
94
101
  end
95
102
 
96
103
  it "should copy entire context when blank node is written to" do
97
104
  updater[Voc[:b]][Voc[:c]] = "jagular" #they drop from trees
98
105
 
99
- resource_graph = ::RDF::Graph.new(context_node, :data => target_graph)
100
-
101
- resource_graph.query(blank_node_statement).should_not be_empty
102
- resource_graph.query(simple_statement).should_not be_empty
103
- resource_graph.query([nil, Voc[:c], "jagular", context_node]).should_not be_empty
106
+ target_graph.query(blank_node_pattern).should_not be_empty
107
+ target_graph.query(simple_pattern).should_not be_empty
108
+ target_graph.query([nil, Voc[:c], "jagular", :context]).should_not be_empty
104
109
  end
105
110
 
106
111
  it "should trigger (only one) Store query just by writing" do
107
112
  updater[Voc[:d]] = 14
108
113
  updater[Voc[:e]] = "fourteen"
109
114
 
110
- resource_graph = ::RDF::Graph.new(context_node, :data => target_graph)
111
-
112
- resource_graph.query(blank_node_statement).should_not be_empty
113
- resource_graph.query(simple_statement).should_not be_empty
114
- resource_graph.query([context_node, Voc[:d], 14]).should_not be_empty
115
- resource_graph.query([context_node, Voc[:e], "fourteen"]).should_not be_empty
115
+ target_graph.query(blank_node_pattern).should_not be_empty
116
+ target_graph.query(simple_pattern).should_not be_empty
117
+ target_graph.query([context_node, Voc[:d], 14, :context]).should_not be_empty
118
+ target_graph.query([context_node, Voc[:e], "fourteen", :context]).should_not be_empty
116
119
  end
117
120
 
118
121
  it "should return statements that have been written" do
@@ -120,38 +123,32 @@ describe RoadForest::Graph::GraphFocus, "with UpdateManager" do
120
123
  updater[Voc[:a]].should == 17
121
124
  end
122
125
 
123
- it "should not copy contexts simply because they're read from" do
124
- updater[Voc[:a]].should == 7
125
- target_graph.should be_empty
126
- end
127
-
128
126
  it "should add a list to the target graph" do
129
- list_focus = updater.add_node(Voc[:list])
130
127
  nodes = []
131
- list_focus.as_list.append_node do |node|
132
- nodes << node
133
- node[Voc[:d]] = 107
134
- end
128
+ list_focus = updater.add_list(Voc[:list]) do |list_focus|
129
+ list_focus.append_node do |node|
130
+ nodes << node
131
+ node[Voc[:d]] = 107
132
+ end
135
133
 
136
- list_focus.as_list.append_node do |node|
137
- nodes << node
138
- node[Voc[:d]] = 109
139
- end
134
+ list_focus.append_node do |node|
135
+ nodes << node
136
+ node[Voc[:d]] = 109
137
+ end
140
138
 
141
- list_focus.as_list.append_node do |node|
142
- nodes << node
143
- node[Voc[:d]] = 113
139
+ list_focus.append_node do |node|
140
+ nodes << node
141
+ node[Voc[:d]] = 113
142
+ end
144
143
  end
145
144
 
146
- resource_graph = ::RDF::Graph.new(context_node, :data => target_graph)
147
-
148
145
  list = ::RDF::List.new(list_focus.subject, target_graph)
149
146
 
150
147
  list[0].should == nodes[0].subject
151
148
  list[1].should == nodes[1].subject
152
149
  list[2].should == nodes[2].subject
153
- resource_graph.query([nodes[0].subject, Voc[:d], 107]).should_not be_empty
154
- resource_graph.query([nodes[1].subject, Voc[:d], 109]).should_not be_empty
155
- resource_graph.query([nodes[2].subject, Voc[:d], 113]).should_not be_empty
150
+ target_graph.query([nodes[0].subject, Voc[:d], 107, :context]).should_not be_empty
151
+ target_graph.query([nodes[1].subject, Voc[:d], 109, :context]).should_not be_empty
152
+ target_graph.query([nodes[2].subject, Voc[:d], 113, :context]).should_not be_empty
156
153
  end
157
154
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roadforest
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Judson Lester
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-09 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 2.2.8
75
+ version: 2.3.6
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: 2.2.8
82
+ version: 2.3.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: excon
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -135,6 +135,18 @@ executables: []
135
135
  extensions: []
136
136
  extra_rdoc_files: []
137
137
  files:
138
+ - lib/roadforest/authorization/auth-entity.rb
139
+ - lib/roadforest/authorization/authentication-chain.rb
140
+ - lib/roadforest/authorization/default-authentication-store.rb
141
+ - lib/roadforest/authorization/grant-builder.rb
142
+ - lib/roadforest/authorization/grants-holder.rb
143
+ - lib/roadforest/authorization/manager.rb
144
+ - lib/roadforest/authorization/policy.rb
145
+ - lib/roadforest/graph/nav-affordance-builder.rb
146
+ - lib/roadforest/interface/utility.rb
147
+ - lib/roadforest/interface/utility/backfill.rb
148
+ - lib/roadforest/interface/utility/grant-list.rb
149
+ - lib/roadforest/interface/utility/grant.rb
138
150
  - lib/roadforest-client.rb
139
151
  - lib/roadforest/http/message.rb
140
152
  - lib/roadforest/http/graph-response.rb
@@ -149,9 +161,11 @@ files:
149
161
  - lib/roadforest/graph/etagging.rb
150
162
  - lib/roadforest/graph/post-focus.rb
151
163
  - lib/roadforest/graph/vocabulary.rb
164
+ - lib/roadforest/graph/path-vocabulary.rb
152
165
  - lib/roadforest/graph/document.rb
153
166
  - lib/roadforest/graph/access-manager.rb
154
167
  - lib/roadforest/graph.rb
168
+ - lib/roadforest/path-matcher.rb
155
169
  - lib/roadforest/resource/role/writable.rb
156
170
  - lib/roadforest/resource/role/has-children.rb
157
171
  - lib/roadforest/resource/list.rb
@@ -276,7 +290,7 @@ rdoc_options:
276
290
  - --main
277
291
  - doc/README
278
292
  - --title
279
- - roadforest-0.5 Documentation
293
+ - roadforest-0.7 Documentation
280
294
  require_paths:
281
295
  - lib/
282
296
  required_ruby_version: !ruby/object:Gem::Requirement