roadforest 0.1 → 0.5

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/examples/file-management.rb +12 -13
  3. data/lib/roadforest-client.rb +3 -0
  4. data/lib/roadforest-common.rb +2 -0
  5. data/lib/roadforest-server.rb +7 -0
  6. data/lib/roadforest-testing.rb +1 -0
  7. data/lib/roadforest/application.rb +9 -7
  8. data/lib/roadforest/application/dispatcher.rb +39 -63
  9. data/lib/roadforest/application/parameters.rb +1 -1
  10. data/lib/roadforest/application/path-provider.rb +2 -2
  11. data/lib/roadforest/application/route-adapter.rb +130 -18
  12. data/lib/roadforest/application/services-host.rb +0 -4
  13. data/lib/roadforest/augment/affordance.rb +78 -0
  14. data/lib/roadforest/augment/augmentation.rb +97 -0
  15. data/lib/roadforest/augment/augmenter.rb +54 -0
  16. data/lib/roadforest/augmentations.rb +1 -0
  17. data/lib/roadforest/content-handling.rb +1 -0
  18. data/lib/roadforest/content-handling/common-engines.rb +67 -0
  19. data/lib/roadforest/content-handling/engine.rb +2 -14
  20. data/lib/roadforest/content-handling/handler-wrap.rb +29 -31
  21. data/lib/roadforest/content-handling/media-type.rb +6 -0
  22. data/lib/roadforest/{rdf.rb → graph.rb} +1 -1
  23. data/lib/roadforest/{rdf → graph}/access-manager.rb +12 -74
  24. data/lib/roadforest/{rdf → graph}/document.rb +1 -1
  25. data/lib/roadforest/{rdf → graph}/etagging.rb +2 -2
  26. data/lib/roadforest/{rdf → graph}/focus-list.rb +1 -9
  27. data/lib/roadforest/{rdf → graph}/graph-copier.rb +2 -2
  28. data/lib/roadforest/{rdf → graph}/graph-focus.rb +5 -7
  29. data/lib/roadforest/{rdf → graph}/normalization.rb +1 -1
  30. data/lib/roadforest/{rdf → graph}/post-focus.rb +2 -3
  31. data/lib/roadforest/graph/vocabulary.rb +96 -0
  32. data/lib/roadforest/http/graph-transfer.rb +2 -2
  33. data/lib/roadforest/interface/application.rb +145 -0
  34. data/lib/roadforest/interface/blob.rb +38 -0
  35. data/lib/roadforest/interface/rdf.rb +77 -0
  36. data/lib/roadforest/interfaces.rb +2 -0
  37. data/lib/roadforest/remote-host.rb +17 -17
  38. data/lib/roadforest/resource.rb +4 -0
  39. data/lib/roadforest/resource/{rdf/leaf-item.rb → leaf-item.rb} +1 -1
  40. data/lib/roadforest/resource/{rdf/list.rb → list.rb} +1 -1
  41. data/lib/roadforest/resource/{rdf/parent-item.rb → parent-item.rb} +1 -1
  42. data/lib/roadforest/resource/{rdf/read-only.rb → read-only.rb} +18 -18
  43. data/lib/roadforest/resource/role/has-children.rb +1 -1
  44. data/lib/roadforest/resource/role/writable.rb +2 -2
  45. data/lib/roadforest/server.rb +1 -1
  46. data/lib/roadforest/source-rigor.rb +9 -0
  47. data/lib/roadforest/{rdf/source-rigor → source-rigor}/credence-annealer.rb +2 -2
  48. data/lib/roadforest/{rdf/source-rigor → source-rigor}/credence.rb +5 -5
  49. data/lib/roadforest/{rdf/source-rigor → source-rigor}/credence/any.rb +1 -1
  50. data/lib/roadforest/{rdf/source-rigor → source-rigor}/credence/none-if-role-absent.rb +1 -1
  51. data/lib/roadforest/{rdf/source-rigor → source-rigor}/credence/role-if-available.rb +1 -1
  52. data/lib/roadforest/source-rigor/engine.rb +45 -0
  53. data/lib/roadforest/{rdf → source-rigor}/graph-store.rb +9 -9
  54. data/lib/roadforest/{rdf/source-rigor → source-rigor}/http-investigator.rb +2 -2
  55. data/lib/roadforest/{rdf → source-rigor}/investigation.rb +2 -2
  56. data/lib/roadforest/{rdf/source-rigor → source-rigor}/investigator.rb +3 -3
  57. data/lib/roadforest/{rdf/source-rigor → source-rigor}/null-investigator.rb +3 -2
  58. data/lib/roadforest/{rdf → source-rigor}/parcel.rb +5 -5
  59. data/lib/roadforest/{rdf → source-rigor}/resource-pattern.rb +6 -6
  60. data/lib/roadforest/{rdf → source-rigor}/resource-query.rb +2 -2
  61. data/lib/roadforest/source-rigor/rigorous-access.rb +101 -0
  62. data/lib/roadforest/templates/affordance-doc.haml +23 -0
  63. data/lib/roadforest/templates/affordance-property-values.haml +13 -0
  64. data/lib/roadforest/templates/affordance-subject.haml +9 -0
  65. data/lib/roadforest/templates/affordance-uri-object.haml +2 -0
  66. data/lib/roadforest/templates/base/{property_value.haml → property-value.haml} +0 -0
  67. data/lib/roadforest/templates/base/{property_values.haml → property-values.haml} +0 -0
  68. data/lib/roadforest/templates/distiller/{property_value.haml → property-value.haml} +0 -0
  69. data/lib/roadforest/templates/distiller/{property_values.haml → property-values.haml} +0 -0
  70. data/lib/roadforest/templates/min/{property_values.haml → property-values.haml} +0 -0
  71. data/lib/roadforest/templates/rdfpost-curie.haml +6 -0
  72. data/lib/roadforest/test-support/dispatcher-facade.rb +2 -0
  73. data/lib/roadforest/test-support/matchers.rb +169 -5
  74. data/lib/roadforest/test-support/remote-host.rb +2 -2
  75. data/lib/roadforest/type-handlers/handler.rb +74 -0
  76. data/lib/roadforest/type-handlers/jsonld.rb +34 -0
  77. data/lib/roadforest/type-handlers/rdf-handler.rb +36 -0
  78. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer.rb +2 -2
  79. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer/document-environment.rb +9 -8
  80. data/lib/roadforest/type-handlers/rdfa-writer/environment-decorator.rb +312 -0
  81. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer/object-environment.rb +3 -3
  82. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer/property-environment.rb +5 -11
  83. data/lib/roadforest/type-handlers/rdfa-writer/render-engine.rb +427 -0
  84. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer/render-environment.rb +33 -26
  85. data/lib/roadforest/{content-handling/type-handlers → type-handlers}/rdfa-writer/subject-environment.rb +7 -23
  86. data/lib/roadforest/type-handlers/rdfa.rb +73 -0
  87. data/lib/roadforest/type-handlers/rdfpost.rb +301 -0
  88. data/lib/roadforest/utility/class-registry.rb +23 -5
  89. data/spec/.ctrlp-root +0 -0
  90. data/spec/affordance-augmenter.rb +75 -0
  91. data/spec/affordances-flow.rb +438 -0
  92. data/spec/authorization.rb +34 -0
  93. data/spec/client.rb +13 -12
  94. data/spec/credence-annealer.rb +5 -5
  95. data/spec/focus-list.rb +8 -8
  96. data/spec/full-integration.rb +3 -3
  97. data/spec/graph-copier.rb +4 -4
  98. data/spec/graph-store.rb +19 -31
  99. data/spec/keychain.rb +82 -0
  100. data/spec/rdf-normalization.rb +2 -2
  101. data/spec/rdf-parcel.rb +3 -3
  102. data/spec/rdfa-handler.rb +514 -0
  103. data/spec/rdfpost.rb +96 -0
  104. data/spec/source-rigor.rb +57 -0
  105. data/spec/update-focus.rb +11 -10
  106. metadata +91 -66
  107. data/lib/roadforest/blob-model.rb +0 -53
  108. data/lib/roadforest/content-handling/type-handler.rb +0 -76
  109. data/lib/roadforest/content-handling/type-handlers/jsonld.rb +0 -36
  110. data/lib/roadforest/content-handling/type-handlers/rdf-handler.rb +0 -38
  111. data/lib/roadforest/content-handling/type-handlers/rdfa-writer/render-engine.rb +0 -574
  112. data/lib/roadforest/content-handling/type-handlers/rdfa.rb +0 -175
  113. data/lib/roadforest/content-handling/type-handlers/rdfpost.rb +0 -297
  114. data/lib/roadforest/model.rb +0 -209
  115. data/lib/roadforest/models.rb +0 -2
  116. data/lib/roadforest/rdf/source-rigor.rb +0 -44
  117. data/lib/roadforest/rdf/vocabulary.rb +0 -11
  118. data/lib/roadforest/resource/http/form-parsing.rb +0 -81
  119. data/lib/roadforest/resource/rdf.rb +0 -4
  120. data/spec/form-parsing.rb +0 -1
@@ -0,0 +1,34 @@
1
+ require 'roadforest/authorization'
2
+
3
+ describe RoadForest::Authorization do
4
+ subject :manager do
5
+ RoadForest::Authorization::Manager.new.tap do |manager|
6
+ manager.authenticator.add_account("user","secret","")
7
+ end
8
+ end
9
+
10
+ describe "default setup" do
11
+ let :requires_admin do
12
+ manager.build_grants do |grants|
13
+ grants.add(:admin)
14
+ end
15
+ end
16
+
17
+ it "should refuse an unauthenticated user" do
18
+ manager.authorization(nil, requires_admin).should == :refused
19
+ end
20
+
21
+ it "should grant an authenticated user" do
22
+ manager.authorization("Basic #{Base64.encode64("user:secret")}", requires_admin).should == :granted
23
+ end
24
+
25
+ it "should refuse a garbage authentication header" do
26
+ manager.authorization("some garbage here", requires_admin).should == :refused
27
+ end
28
+
29
+ it "should construct a valid challenge header" do
30
+ manager.challenge(:realm => "This test here").should == 'Basic realm="This test here"'
31
+
32
+ end
33
+ end
34
+ end
data/spec/client.rb CHANGED
@@ -1,6 +1,4 @@
1
- require 'roadforest/server'
2
- require 'roadforest/test-support'
3
-
1
+ require 'roadforest-client'
4
2
  require 'examples/file-management'
5
3
 
6
4
  describe RoadForest::RemoteHost do
@@ -28,7 +26,7 @@ describe RoadForest::RemoteHost do
28
26
  let :base_server do
29
27
  RoadForest::TestSupport::RemoteHost.new(FileManagementExample::Application.new("http://localhost:8778", services)).tap do |server|
30
28
  server.add_credentials("user", "secret")
31
- #server.trace = true
29
+ # server.trace = true
32
30
  end
33
31
  end
34
32
 
@@ -118,7 +116,6 @@ describe RoadForest::RemoteHost do
118
116
  describe "putting data to server" do
119
117
  before :each do
120
118
  server.putting do |graph|
121
- require 'rdf/turtle'
122
119
  items = graph.all(:skos, "hasTopConcept")
123
120
 
124
121
  unresolved = items.find do |nav_item|
@@ -159,11 +156,12 @@ describe RoadForest::RemoteHost do
159
156
  @correct.should == 0
160
157
  end
161
158
 
162
- it "should extract data from server responses" do
163
- server.should match_query do
164
- pattern(:subject, [:lc, "path"], nil)
165
- pattern(:subject, [:lc, "file"], nil)
166
- end
159
+ it "should extract data from server responses", :pending => "RemoteHost understanding RDF::Query" do
160
+ lc = FileManagementExample::Vocabulary::LC
161
+ server.should match_query {
162
+ pattern([:subject, lc.path, nil])
163
+ pattern([:subject, lc.file, nil])
164
+ }
167
165
  end
168
166
 
169
167
  it "should have transmitted data" do
@@ -180,9 +178,10 @@ describe RoadForest::RemoteHost do
180
178
 
181
179
  describe "using JSON-LD" do
182
180
  let :server do
181
+ require 'roadforest/type-handlers/jsonld'
183
182
  base_server.tap do |server|
184
183
  server.graph_transfer.type_handling = RoadForest::ContentHandling::Engine.new.tap do |engine|
185
- engine.add RoadForest::MediaType::Handlers::JSONLD.new, "application/ld+json"
184
+ engine.add RoadForest::TypeHandlers::JSONLD.new, "application/ld+json"
186
185
  end
187
186
  end
188
187
  end
@@ -196,9 +195,11 @@ describe RoadForest::RemoteHost do
196
195
 
197
196
  describe "using RDFa" do
198
197
  let :server do
198
+ require 'roadforest/type-handlers/rdfa'
199
199
  base_server.tap do |server|
200
200
  server.graph_transfer.type_handling = RoadForest::ContentHandling::Engine.new.tap do |engine|
201
- engine.add RoadForest::MediaType::Handlers::RDFa.new, "text/html;q=1;rdfa=1"
201
+ rdfa = RoadForest::TypeHandlers::RDFa.new
202
+ engine.add rdfa, "text/html;q=1;rdfa=1"
202
203
  end
203
204
  end
204
205
  end
@@ -1,14 +1,14 @@
1
- require 'roadforest/rdf/source-rigor/credence-annealer'
2
- require 'roadforest/rdf/graph-store'
1
+ require 'roadforest/source-rigor/credence-annealer'
2
+ require 'roadforest/source-rigor/graph-store'
3
3
  require 'timeout'
4
4
 
5
- describe RoadForest::RDF::SourceRigor::CredenceAnnealer do
5
+ describe RoadForest::SourceRigor::CredenceAnnealer do
6
6
  let :graph do
7
- RoadForest::RDF::GraphStore.new
7
+ RoadForest::SourceRigor::GraphStore.new
8
8
  end
9
9
 
10
10
  subject :annealer do
11
- RoadForest::RDF::SourceRigor::CredenceAnnealer.new(graph)
11
+ RoadForest::SourceRigor::CredenceAnnealer.new(graph)
12
12
  end
13
13
 
14
14
  it "should run it's block at least once" do
data/spec/focus-list.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  require 'rdf'
2
- require 'roadforest/rdf/focus-list'
3
- require 'roadforest/rdf/graph-focus'
2
+ require 'roadforest/graph/focus-list'
3
+ require 'roadforest/graph/graph-focus'
4
4
 
5
- describe RoadForest::RDF::FocusList do
5
+ describe RoadForest::Graph::FocusList do
6
6
  let :graph do
7
7
  RDF::Graph.new
8
8
  end
9
9
 
10
10
  let :access do
11
- RoadForest::RDF::WriteManager.new.tap do |access|
11
+ RoadForest::Graph::WriteManager.new.tap do |access|
12
12
  access.source_graph = graph
13
13
  end
14
14
  end
15
15
 
16
16
  let :focus do
17
- RoadForest::RDF::GraphFocus.new(access, "urn:root")
17
+ RoadForest::Graph::GraphFocus.new(access, "urn:root")
18
18
  end
19
19
 
20
20
  let :list do
@@ -24,9 +24,9 @@ describe RoadForest::RDF::FocusList do
24
24
  it "should add an item to graph" do
25
25
  list.append_node("#test")
26
26
 
27
- graph.should match_query do |query|
28
- query.pattern(:subject => "urn:root#test")
29
- end
27
+ graph.should match_query { |query|
28
+ query.pattern(:object => RDF::URI.new("urn:root#test"))
29
+ }
30
30
  end
31
31
 
32
32
  it "should add several items to the graph" do
@@ -19,7 +19,7 @@ describe "RoadForest integration", :integration => true do
19
19
  rescue Errno::ECONNREFUSED
20
20
  #That's what we're hoping for
21
21
  ensure
22
- #test_conn.close
22
+ test_conn.close rescue nil
23
23
  end
24
24
 
25
25
  @setup_time_limit = 3
@@ -27,9 +27,9 @@ describe "RoadForest integration", :integration => true do
27
27
  @server_logs = "integration-tests.log"
28
28
 
29
29
  @server_pid = fork do
30
- require 'roadforest/server'
31
30
  require 'examples/file-management'
32
31
  require 'logger'
32
+
33
33
  RoadForest.serve(
34
34
  FileManagementExample::Application.new("http://localhost:#{@server_port}"),
35
35
  FileManagementExample::ServicesHost.new.tap do |host|
@@ -48,7 +48,7 @@ describe "RoadForest integration", :integration => true do
48
48
  end
49
49
  end
50
50
 
51
- require 'roadforest/remote-host'
51
+ require 'roadforest-client'
52
52
 
53
53
  %w{EXIT TERM}.each do |signal|
54
54
  trap(signal) do
data/spec/graph-copier.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'roadforest/test-support/matchers'
2
- require 'roadforest/rdf/graph-copier'
2
+ require 'roadforest/graph/graph-copier'
3
3
 
4
- describe RoadForest::RDF::GraphFocus, "with a CopyManager" do
4
+ describe RoadForest::Graph::GraphFocus, "with a CopyManager" do
5
5
  class TestVoc < ::RDF::Vocabulary("http://test.com/");end
6
6
 
7
7
  let :start_subject do
@@ -33,14 +33,14 @@ describe RoadForest::RDF::GraphFocus, "with a CopyManager" do
33
33
  end
34
34
 
35
35
  let :access do
36
- RoadForest::RDF::CopyManager.new.tap do |access|
36
+ RoadForest::Graph::CopyManager.new.tap do |access|
37
37
  access.source_graph = source_graph
38
38
  access.target_graph = target_graph
39
39
  end
40
40
  end
41
41
 
42
42
  let :copier do
43
- RoadForest::RDF::GraphFocus.new(access, start_subject)
43
+ RoadForest::Graph::GraphFocus.new(access, start_subject)
44
44
  end
45
45
 
46
46
  #copier needs URL accessor
data/spec/graph-store.rb CHANGED
@@ -1,31 +1,22 @@
1
1
  require 'rdf'
2
2
  require 'rdf/rdfa'
3
- require 'roadforest/rdf/document'
4
- require 'roadforest/rdf/graph-store'
5
- require 'roadforest/rdf/graph-focus'
6
- require 'roadforest/rdf/source-rigor'
7
-
8
- describe RoadForest::RDF do
9
- let :source_rigor do
10
- RoadForest::RDF::SourceRigor.new.tap do |skept|
11
- skept.policy_list(:may_subject)
12
- skept.investigator_list(:null)
13
- end
14
- end
3
+ require 'roadforest/graph/document'
4
+ require 'roadforest/source-rigor/graph-store'
5
+ require 'roadforest/graph/graph-focus'
15
6
 
7
+ describe RoadForest::Graph do
16
8
  let :graph_store do
17
- RoadForest::RDF::GraphStore.new
9
+ RoadForest::SourceRigor::GraphStore.new
18
10
  end
19
11
 
20
12
  #merging graphs
21
13
 
22
- describe RoadForest::RDF::GraphStore do
14
+ describe RoadForest::SourceRigor::GraphStore do
23
15
  let :root_body do
24
- store = RoadForest::RDF::GraphStore.new
25
- access = RoadForest::RDF::WriteManager.new
16
+ store = RoadForest::SourceRigor::GraphStore.new
17
+ access = RoadForest::Graph::WriteManager.new
26
18
  access.source_graph = store
27
- access.rigor = source_rigor
28
- step = RoadForest::RDF::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
19
+ step = RoadForest::Graph::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
29
20
 
30
21
  step[[:foaf, :givenname]] = "Lester"
31
22
  step[[:dc, :date]] = Time.now
@@ -36,11 +27,10 @@ describe RoadForest::RDF do
36
27
  end
37
28
 
38
29
  let :second_body do
39
- store = RoadForest::RDF::GraphStore.new
40
- access = RoadForest::RDF::WriteManager.new
30
+ store = RoadForest::SourceRigor::GraphStore.new
31
+ access = RoadForest::Graph::WriteManager.new
41
32
  access.source_graph = store
42
- access.rigor = source_rigor
43
- step = RoadForest::RDF::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
33
+ step = RoadForest::Graph::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
44
34
 
45
35
  step[[:foaf, :givenname]] = "Foster"
46
36
  step[[:dc, :date]] = Time.now
@@ -49,24 +39,23 @@ describe RoadForest::RDF do
49
39
  end
50
40
 
51
41
  let :first_doc do
52
- RoadForest::RDF::Document.new.tap do |doc|
42
+ RoadForest::Graph::Document.new.tap do |doc|
53
43
  doc.source = "http://lrdesign.com/test-rdf"
54
44
  doc.body_string = root_body
55
45
  end
56
46
  end
57
47
 
58
48
  let :second_doc do
59
- RoadForest::RDF::Document.new.tap do |doc|
49
+ RoadForest::Graph::Document.new.tap do |doc|
60
50
  doc.source = "http://lrdesign.com/test-rdf"
61
51
  doc.body_string = second_body
62
52
  end
63
53
  end
64
54
 
65
55
  let :step do
66
- access = RoadForest::RDF::WriteManager.new
56
+ access = RoadForest::Graph::WriteManager.new
67
57
  access.source_graph = graph_store
68
- access.rigor = source_rigor
69
- RoadForest::RDF::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
58
+ RoadForest::Graph::GraphFocus.new(access, "http://lrdesign.com/test-rdf")
70
59
  end
71
60
 
72
61
  before :each do
@@ -86,7 +75,7 @@ describe RoadForest::RDF do
86
75
  end
87
76
  end
88
77
 
89
- describe RoadForest::RDF::GraphFocus do
78
+ describe RoadForest::Graph::GraphFocus do
90
79
  let :main_subject do
91
80
  RDF::URI.new("http://test.com/main")
92
81
  end
@@ -112,14 +101,13 @@ describe RoadForest::RDF do
112
101
  end
113
102
 
114
103
  let :access do
115
- RoadForest::RDF::WriteManager.new.tap do |access|
116
- access.rigor = source_rigor
104
+ RoadForest::Graph::WriteManager.new.tap do |access|
117
105
  access.source_graph = graph_store
118
106
  end
119
107
  end
120
108
 
121
109
  let :step do
122
- RoadForest::RDF::GraphFocus.new(access, main_subject)
110
+ RoadForest::Graph::GraphFocus.new(access, main_subject)
123
111
  end
124
112
 
125
113
  it "should enumerate forward properties" do
data/spec/keychain.rb ADDED
@@ -0,0 +1,82 @@
1
+ require 'roadforest/http/keychain'
2
+
3
+ describe RoadForest::HTTP::Keychain do
4
+ let :expected_header do
5
+ "Basic dXNlcjpzZWNyZXRl"
6
+ end
7
+
8
+ let :username do
9
+ "user"
10
+ end
11
+
12
+ let :password do
13
+ "secrete"
14
+ end
15
+
16
+ describe "Basic scheme regex" do
17
+ let :regex do
18
+ RoadForest::HTTP::Keychain::BASIC_SCHEME
19
+ end
20
+
21
+ it "should match with single-quote realm" do
22
+ match = regex.match "Basic realm='test'"
23
+ match[:realm].should == "test"
24
+ end
25
+
26
+ it "should not match without realm" do
27
+ match = regex.match 'Basic'
28
+ match.should be_nil
29
+ end
30
+
31
+ it "should match with double-quote realm" do
32
+ match = regex.match 'Basic realm="test"'
33
+ match[:realm].should == "test"
34
+ end
35
+
36
+ it "should not match with mismatched-quote realm" do
37
+ match = regex.match "Basic realm=\"test'"
38
+ match.should be_nil
39
+ end
40
+ end
41
+
42
+ describe "#preemptive_response" do
43
+ subject :keychain do
44
+ RoadForest::HTTP::Keychain.new.tap do |chain|
45
+ chain.add("http://example.com/test/", username, password)
46
+ end
47
+ end
48
+
49
+ it "should return matching creds" do
50
+ creds = keychain.preemptive_response("http://example.com/test/under/here/")
51
+ creds.should == expected_header
52
+ end
53
+
54
+ it "should not return creds from outside protection" do
55
+ creds = keychain.preemptive_response("http://example.com/")
56
+ creds.should be_nil
57
+ end
58
+ end
59
+
60
+ describe "#challenge_response" do
61
+ subject :keychain do
62
+ RoadForest::HTTP::Keychain.new.tap do |chain|
63
+ chain.add("http://example.com/test/", username, password, "test")
64
+ end
65
+ end
66
+
67
+ it "should return matching creds" do
68
+ creds = keychain.challenge_response("http://example.com/", "Basic realm='test'")
69
+ creds.should == expected_header
70
+ end
71
+
72
+ it "should not return covering creds" do
73
+ creds = keychain.challenge_response("http://example.com/test/under/here/", "Basic realm='other'")
74
+ creds.should be_nil
75
+ end
76
+
77
+ it "should not return non-matching creds" do
78
+ creds = keychain.challenge_response("http://example.com/", "Basic realm='other'")
79
+ creds.should be_nil
80
+ end
81
+ end
82
+ end
@@ -1,6 +1,6 @@
1
- require 'roadforest/rdf/normalization'
1
+ require 'roadforest/graph/normalization'
2
2
 
3
- describe RoadForest::RDF::Normalization do
3
+ describe RoadForest::Graph::Normalization do
4
4
  include described_class
5
5
 
6
6
  it "should match http://test.com and http://test.com/" do
data/spec/rdf-parcel.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'roadforest/test-support/matchers'
2
- require 'roadforest/rdf/parcel'
2
+ require 'roadforest/source-rigor/parcel'
3
3
 
4
- describe RoadForest::RDF::Parcel do
4
+ describe RoadForest::SourceRigor::Parcel do
5
5
  let :literal do
6
6
  42
7
7
  end
@@ -59,7 +59,7 @@ describe RoadForest::RDF::Parcel do
59
59
  end
60
60
 
61
61
  let :parceller do
62
- RoadForest::RDF::Parcel.new.tap do |parceller|
62
+ RoadForest::SourceRigor::Parcel.new.tap do |parceller|
63
63
  parceller.graph = source_graph
64
64
  end
65
65
  end
@@ -0,0 +1,514 @@
1
+ require 'rdf/xsd'
2
+ #require 'rdf/spec/writer'
3
+ require 'rdf/turtle'
4
+ require 'rdf'
5
+
6
+ require 'roadforest/type-handlers/rdfa-writer'
7
+ require 'roadforest/type-handlers/rdfa-writer/render-engine'
8
+ require 'cgi'
9
+
10
+ class EX < RDF::Vocabulary("http://example.com/"); end
11
+
12
+ describe RoadForest::TypeHandlers::RDFaWriter, :vcr => {} do
13
+ # Heuristically detect the input stream
14
+ def detect_format(stream)
15
+ # Got to look into the file to see
16
+ if stream.is_a?(IO) || stream.is_a?(StringIO)
17
+ stream.rewind
18
+ string = stream.read(1000)
19
+ stream.rewind
20
+ else
21
+ string = stream.to_s
22
+ end
23
+ case string
24
+ when /<html/i then RDF::RDFa::Reader
25
+ when /@prefix/i then RDF::Turtle::Reader
26
+ else RDF::NTriples::Reader
27
+ end
28
+ end
29
+
30
+ def parse(input, options = {})
31
+ reader_class = RDF::Reader.for(options[:format]) if options[:format]
32
+ reader_class ||= options.fetch(:reader, RDF::Reader.for(detect_format(input)))
33
+
34
+ graph = RDF::Repository.new
35
+ reader_class.new(input, options).each do |statement|
36
+ graph << statement
37
+ end
38
+ graph
39
+ end
40
+
41
+ before(:all) do
42
+ @valise = Valise.define do
43
+ ro up_to("spec") + "../lib/roadforest"
44
+ end
45
+
46
+ @tilt_cache = ::Tilt::Cache.new
47
+ end
48
+
49
+ # Serialize @graph to a string and compare against regexps
50
+ def serialize(options = {})
51
+ options = {:debug => debug, :standard_prefixes => true}.merge(options)
52
+ base_uri =
53
+ if options[:base_uri]
54
+ RDF::URI(options[:base_uri])
55
+ else
56
+ nil
57
+ end
58
+
59
+ templates = RoadForest::TypeHandlers::RDFaWriter::TemplateHandler.new
60
+ templates.valise = @valise
61
+ templates.template_cache = @tilt_cache
62
+ templates.style_name = options[:haml]
63
+ templates.haml_options = options[:haml_options]
64
+
65
+ engine = RoadForest::TypeHandlers::RDFaWriter::RenderEngine.new(@graph, options[:debug]) do |engine|
66
+ #engine.decoration_set.names.clear
67
+ engine.template_handler = templates
68
+ engine.base_uri = base_uri
69
+ engine.lang = options[:lang]
70
+ engine.standard_prefixes = options[:standard_prefixes]
71
+ engine.top_classes = options[:top_classes] || [RDF::RDFS.Class]
72
+ engine.predicate_order = options[:predicate_order] || [RDF.type, RDF::RDFS.label, RDF::DC.title]
73
+ engine.heading_predicates = options[:heading_predicates] || [RDF::RDFS.label, RDF::DC.title]
74
+ end
75
+
76
+ engine.prefixes.merge! options[:prefixes] unless options[:prefixes].nil?
77
+
78
+ # Generate document
79
+ result = engine.render_document
80
+
81
+ puts CGI.escapeHTML(result) if $verbose
82
+ result
83
+ end
84
+
85
+ shared_context "RDFa rendering" do
86
+ let :graph do
87
+ parse(turtle, :format => :ttl)
88
+ end
89
+
90
+ let :serialize_options do
91
+ {:haml_options => {:ugly => false}}
92
+ end
93
+
94
+ subject :html do
95
+ @graph = graph
96
+ serialize(serialize_options)
97
+ end
98
+ end
99
+
100
+ before(:each) do
101
+ @graph = RDF::Repository.new
102
+ end
103
+
104
+ let :debug do
105
+ []
106
+ end
107
+
108
+ #include RDF_Writer
109
+
110
+ describe "#buffer" do
111
+ context "prefix definitions" do
112
+ subject do
113
+ @graph << [EX.a, RDF::DC.title, "foo"]
114
+ serialize(:prefixes => {:dc => "http://purl.org/dc/terms/"})
115
+ end
116
+
117
+ it { should have_xpath("/html/@prefix", %r(dc: http://purl.org/dc/terms/), @debug)}
118
+ it { should have_xpath("/html/@prefix", %r(ex: http://example.com/), @debug)}
119
+ it { should have_xpath("/html/@prefix", %r(ex:), @debug)}
120
+ end
121
+
122
+ context "plain literal" do
123
+ subject do
124
+ @graph << [EX.a, EX.b, "foo"]
125
+ serialize(:haml_options => {:ugly => false})
126
+ end
127
+
128
+ it { should have_xpath( "/html/body/div/@resource" , "ex:a" ) }
129
+ it { should have_xpath( "//div[@class='property']/span[@property]/@property" , "ex:b" ) }
130
+ it { should have_xpath( "//div[@class='property']/span[@property]/text()" , "foo" ) }
131
+ end
132
+
133
+ context "dc:title" do
134
+ subject do
135
+ @graph << [EX.a, RDF::DC.title, "foo"]
136
+ serialize(:prefixes => {:dc => RDF::DC.to_s})
137
+ end
138
+
139
+ it { should have_xpath( "/html/head/title/text()" , "foo" ) }
140
+ it { should have_xpath( "/html/body/div/@resource" , "ex:a" ) }
141
+ it { should have_xpath( "/html/body/div/h1/@property" , "dc:title" ) }
142
+ it { should have_xpath( "/html/body/div/h1/text()" , "foo" ) }
143
+ end
144
+
145
+ context "typed resources" do
146
+ context "typed resource" do
147
+ subject do
148
+ @graph << [EX.a, RDF.type, EX.Type]
149
+ serialize(:haml_options => {:ugly => false})
150
+ end
151
+
152
+ it { should have_xpath( "/html/body/div/@resource" , "ex:a" ) }
153
+ it { should have_xpath( "/html/body/div/@typeof" , "ex:Type" ) }
154
+ end
155
+
156
+ context "resource with two types" do
157
+ subject do
158
+ @graph << [EX.a, RDF.type, EX.t1]
159
+ @graph << [EX.a, RDF.type, EX.t2]
160
+ serialize(:haml_options => {:ugly => false})
161
+ end
162
+
163
+ it { should have_xpath( "/html/body/div/@resource" , "ex:a" ) }
164
+ it { should have_xpath( "/html/body/div/@typeof" , "ex:t1 ex:t2" ) }
165
+ end
166
+ end
167
+
168
+ context "languaged tagged literals" do
169
+ context "literal with language and no default language" do
170
+ subject do
171
+ @graph << [EX.a, RDF::DC.title, RDF::Literal("foo", :language => :en)]
172
+ serialize(:prefixes => {:dc => "http://purl.org/dc/terms/"})
173
+ end
174
+
175
+ it { should have_xpath( "/html/body/div/h1/@property" , "dc:title" ) }
176
+ it { should have_xpath( "/html/body/div/h1/@lang" , "en" ) }
177
+ end
178
+
179
+ context "literal with language and same default language" do
180
+ subject do
181
+ @graph << [EX.a, RDF::DC.title, RDF::Literal("foo", :language => :en)]
182
+ serialize(:lang => :en)
183
+ end
184
+
185
+ it { should have_xpath( "/html/@lang" , "en" ) }
186
+ it { should have_xpath( "/html/body/div/h1/@lang" , false ) }
187
+ end
188
+
189
+ context "literal with language and different default language" do
190
+ subject do
191
+ @graph << [EX.a, RDF::DC.title, RDF::Literal("foo", :language => :en)]
192
+ serialize(:lang => :de)
193
+ end
194
+
195
+ it { should have_xpath( "/html/@lang" , "de" ) }
196
+ it { should have_xpath( "/html/body/div/h1/@lang" , "en" ) }
197
+ end
198
+
199
+ context "property and rel serialize to different elements" do
200
+ subject do
201
+ @graph << [EX.a, RDF.value, "foo"]
202
+ @graph << [EX.a, RDF.value, EX.b]
203
+ serialize
204
+ end
205
+
206
+ it { should have_xpath( "/html/body/div/div/ul/li[@property='rdf:value']/text()" , "foo" ) }
207
+ it { should have_xpath( "/html/body/div/div/ul/li/a[@property='rdf:value']/@href" , EX.b.to_s ) }
208
+ end
209
+ end
210
+
211
+ context "typed literals" do
212
+ describe "xsd:date" do
213
+ subject do
214
+ @graph << [EX.a, EX.b, RDF::Literal::Date.new("2011-03-18")]
215
+ serialize(:haml_options => {:ugly => false})
216
+ end
217
+
218
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
219
+ it { should have_xpath( "//span[@property]/@datatype" , "xsd:date" ) }
220
+ it { should have_xpath( "//span[@property]/@content" , "2011-03-18" ) }
221
+ it { should have_xpath( "//span[@property]/text()" , "Friday, 18 March 2011") }
222
+ end
223
+
224
+ context "xsd:time" do
225
+ subject do
226
+ @graph << [EX.a, EX.b, RDF::Literal::Time.new("12:34:56")]
227
+ serialize(:haml_options => {:ugly => false})
228
+ end
229
+
230
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
231
+ it { should have_xpath( "//span[@property]/@datatype" , "xsd:time" ) }
232
+ it { should have_xpath( "//span[@property]/@content" , "12:34:56" ) }
233
+ it { should have_xpath( "//span[@property]/text()" , /12:34:56/ ) }
234
+ end
235
+
236
+ context "xsd:dateTime" do
237
+ subject do
238
+ @graph << [EX.a, EX.b, RDF::Literal::DateTime.new("2011-03-18T12:34:56")]
239
+ serialize(:haml_options => {:ugly => false})
240
+ end
241
+
242
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
243
+ it { should have_xpath( "//span[@property]/@datatype" , "xsd:dateTime" ) }
244
+ it { should have_xpath( "//span[@property]/@content" , "2011-03-18T12:34:56" ) }
245
+ it { should have_xpath( "//span[@property]/text()" , /12:34:56 \w+ on Friday, 18 March 2011/) }
246
+ end
247
+
248
+ context "rdf:XMLLiteral" do
249
+ subject do
250
+ @graph << [EX.a, EX.b, RDF::Literal::XML.new("E = mc<sup>2</sup>: The Most Urgent Problem of Our Time")]
251
+ serialize(:haml_options => {:ugly => false})
252
+ end
253
+
254
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
255
+ it { should have_xpath( "//span[@property]/@datatype" , "rdf:XMLLiteral" ) }
256
+ it { should have_xpath( "//span[@property]", %r(<span [^>]+>E = mc<sup>2</sup>: The Most Urgent Problem of Our Time<\/span>)) }
257
+ end
258
+
259
+ context "xsd:string" do
260
+ subject do
261
+ @graph << [EX.a, EX.b, RDF::Literal.new("Albert Einstein", :datatype => RDF::XSD.string)]
262
+ serialize(:haml_options => {:ugly => false})
263
+ end
264
+
265
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
266
+ it { should have_xpath( "//span[@property]/@datatype" , false ) } # xsd:string implied in RDF 1.1
267
+ it { should have_xpath( "//span[@property]/text()" , "Albert Einstein" ) }
268
+ end
269
+
270
+ context "unknown" do
271
+ subject do
272
+ @graph << [EX.a, EX.b, RDF::Literal.new("Albert Einstein", :datatype => EX.unknown)]
273
+ serialize(:haml_options => {:ugly => false})
274
+ end
275
+
276
+ it { should have_xpath( "//span[@property]/@property" , "ex:b" ) }
277
+ it { should have_xpath( "//span[@property]/@datatype" , "ex:unknown" ) }
278
+ it { should have_xpath( "//span[@property]/text()" , "Albert Einstein" ) }
279
+ end
280
+ end
281
+
282
+ context "multi-valued literals" do
283
+ subject do
284
+ @graph << [EX.a, EX.b, "c"]
285
+ @graph << [EX.a, EX.b, "d"]
286
+ serialize(:haml_options => {:ugly => false})
287
+ end
288
+
289
+ it { should have_xpath( "//ul/li[1][@property='ex:b']/text()" , "c" ) }
290
+ it { should have_xpath( "//ul/li[2][@property='ex:b']/text()" , "d" ) }
291
+ end
292
+
293
+ context "resource objects" do
294
+ subject do
295
+ @graph << [EX.a, EX.b, EX.c]
296
+ serialize(:haml_options => {:ugly => false})
297
+ end
298
+
299
+ it { should have_xpath( "//div/@resource" , "ex:a" ) }
300
+ it { should have_xpath( "//a/@property" , "ex:b" ) }
301
+ it { should have_xpath( "//a/@href" , EX.c.to_s ) }
302
+ end
303
+
304
+ context "multi-valued resource objects" do
305
+ subject do
306
+ @graph << [EX.a, EX.b, EX.c]
307
+ @graph << [EX.a, EX.b, EX.d]
308
+ serialize(:haml_options => {:ugly => false})
309
+ end
310
+
311
+ it { should have_xpath( "//div/@resource" , "ex:a" ) }
312
+ it { should have_xpath( "//ul/li[1]/a[@property='ex:b']/@href" , EX.c.to_s ) }
313
+ it { should have_xpath( "//ul/li[2]/a[@property='ex:b']/@href" , EX.d.to_s ) }
314
+ end
315
+
316
+ context "booleans" do
317
+ let :turtle do
318
+ %q{
319
+ @prefix lc: <http://lrdesign.com/vocabularies/logical-construct#> .
320
+ <http://localhost:8778/needs/one> <lc:resolved> true .
321
+ }
322
+ end
323
+
324
+ include_context "RDFa rendering"
325
+
326
+ let :serialize_options do
327
+ { :base_uri => RDF::URI.new("http://localhost:8778/needs/one") }
328
+ end
329
+
330
+ it { should have_xpath( "//div/div[@class='property']/span[@datatype='xsd:boolean']/text()", "true") }
331
+ end
332
+
333
+ context "lists" do
334
+ context "empty list" do
335
+ let :turtle do
336
+ %q(
337
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
338
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
339
+
340
+ <> rdf:value () .
341
+ )
342
+ end
343
+
344
+ include_context "RDFa rendering"
345
+
346
+ it { should have_xpath( "//div/span[@inlist]/@rel" , 'rdf:value' ) }
347
+ it { should have_xpath( "//div/span[@inlist]/text()" , false ) }
348
+ end
349
+
350
+
351
+ context "literal" do
352
+ let :turtle do
353
+ %q(
354
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
355
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
356
+
357
+ <> rdf:value ("Foo") .
358
+ )
359
+ end
360
+
361
+ include_context "RDFa rendering"
362
+
363
+ it { should have_xpath( "//div/span[@inlist]/@property" , 'rdf:value' ) }
364
+ it { should have_xpath( "//div/span[@inlist]/text()" , 'Foo' ) }
365
+ end
366
+
367
+
368
+ context "IRI" do
369
+ let :turtle do
370
+ %q(
371
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
372
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
373
+
374
+ <> rdf:value (<foo>) .
375
+ )
376
+ end
377
+
378
+ include_context "RDFa rendering"
379
+
380
+ it { should have_xpath( "//div/a[@inlist]/@property" , 'rdf:value' ) }
381
+ it { should have_xpath( "//div/a[@inlist]/@href" , 'foo' ) }
382
+ end
383
+
384
+ context "implicit list with hetrogenious membership" do
385
+ let :turtle do
386
+ %q(
387
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
388
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
389
+
390
+ <> rdf:value ("Foo" <foo>) .
391
+ )
392
+ end
393
+
394
+ include_context "RDFa rendering"
395
+
396
+ it { should have_xpath( "//ul/li[1][@inlist]/@property" , 'rdf:value' ) }
397
+ it { should have_xpath( "//ul/li[1][@inlist]/text()" , 'Foo' ) }
398
+ it { should have_xpath( "//ul/li[2]/a[@inlist]/@property" , 'rdf:value' ) }
399
+ it { should have_xpath( "//ul/li[2]/a[@inlist]/@href" , 'foo' ) }
400
+ end
401
+
402
+ context "property with list and literal" do
403
+ let :turtle do
404
+ %q(
405
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
406
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
407
+
408
+ <> rdf:value ("Foo" "Bar"), "Baz" .
409
+ )
410
+ end
411
+
412
+ include_context "RDFa rendering"
413
+
414
+ it { should have_xpath( "//div[@class='property']/span[@property='rdf:value']/text()" , "Baz" ) }
415
+ it { should have_xpath( "//div[@class='property']/ul/li[1][@inlist][@property='rdf:value']/text()" , 'Foo' ) }
416
+ it { should have_xpath( "//div[@class='property']/ul/li[2][@inlist][@property='rdf:value']/text()" , 'Bar' ) }
417
+ end
418
+
419
+ context "multiple rel items" do
420
+ let :turtle do
421
+ %q(
422
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
423
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
424
+
425
+ <> rdf:value (<foo> <bar>) .
426
+ )
427
+ end
428
+
429
+ include_context "RDFa rendering"
430
+
431
+ it { should have_xpath( "//div[@class='property']/ul/li[1]/a[@inlist][@property='rdf:value']/@href" , 'foo' ) }
432
+ it { should have_xpath( "//div[@class='property']/ul/li[2]/a[@inlist][@property='rdf:value']/@href" , 'bar' ) }
433
+ end
434
+
435
+ context "multiple collections", :pending => true do
436
+ let :turtle do
437
+ %q(
438
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
439
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
440
+
441
+ <foo> rdf:value ("Foo"), ("Bar") .
442
+ )
443
+ end
444
+
445
+ include_context "RDFa rendering"
446
+
447
+ it { should have_xpath( "//div[@class='property']/ul/li[1][@inlist][@property='rdf:value']/text()" , 'Foo' ) }
448
+ it { should have_xpath( "//div[@class='property']/ul/li[2][@inlist][@property='rdf:value']/text()" , 'Bar' ) }
449
+ end
450
+
451
+ context "issue 14" do
452
+ let :turtle do
453
+ %q(
454
+ @base <http://example/> .
455
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
456
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
457
+
458
+ <> rdf:value (<needs/one> <needs/two> <needs/three>) .
459
+ <needs/one> rdfs:label "one" .
460
+ <needs/three> rdfs:label "three" .
461
+ <needs/two> rdfs:label "two" .
462
+ )
463
+ end
464
+
465
+ include_context "RDFa rendering"
466
+
467
+ it { should have_xpath( "//div[@class='property']/ul/li[1][@inlist][@rel='rdf:value']/h1[@property='rdfs:label']/text()" , 'one' ) }
468
+ it { should have_xpath( "//div[@class='property']/ul/li[2][@inlist][@rel='rdf:value']/h1[@property='rdfs:label']/text()" , 'two' ) }
469
+ it { should have_xpath( "//div[@class='property']/ul/li[3][@inlist][@rel='rdf:value']/h1[@property='rdfs:label']/text()" , 'three' ) }
470
+ end
471
+ end
472
+
473
+ context "included resource definitions" do
474
+ subject do
475
+ @graph << [EX.a, EX.b, EX.c]
476
+ @graph << [EX.c, EX.d, EX.e]
477
+ serialize(:haml_options => {:ugly => false})
478
+ end
479
+
480
+ it { should have_xpath( "/html/body/div/@resource" , "ex:a" ) }
481
+ it { should have_xpath( "//div[@resource='ex:a']/div[@class='property']/div[@rel]/@rel" , "ex:b" ) }
482
+ it { should have_xpath( "//div[@rel]/@resource" , "ex:c" ) }
483
+ it { should have_xpath( "//div[@rel]/div[@class='property']/a/@href" , EX.e.to_s ) }
484
+ it { should have_xpath( "//div[@rel]/div[@class='property']/a/@property" , "ex:d" ) }
485
+ end
486
+
487
+ unless ENV['CI'] # Not for continuous integration
488
+ # W3C Test suite from http://www.w3.org/2006/07/SWD/RDFa/testsuite/
489
+ describe "w3c xhtml testcases" do
490
+ require 'suite_helper'
491
+
492
+ # Generate with each template set
493
+ %w{base min distiller}.each do |name, template|
494
+ context "Using #{name} template" do
495
+ Fixtures::TestCase.for_specific("html5", "rdfa1.1", Fixtures::TestCase::Test.required) do |t|
496
+ next if %w(0198 0225 0284 0295 0319 0329).include?(t.num)
497
+ specify "test #{t.num}: #{t.description}" do
498
+ input = t.input("html5", "rdfa1.1")
499
+ @graph = RDF::Repository.load(t.input("html5", "rdfa1.1"))
500
+ result = serialize(:haml => name, :haml_options => {:ugly => true})
501
+ graph2 = parse(result, :format => :rdfa)
502
+ # Need to put this in to avoid problems with added markup
503
+ statements = graph2.query(:object => RDF::URI("http://rdf.kellogg-assoc.com/css/distiller.css")).to_a
504
+ statements.each {|st| graph2.delete(st)}
505
+ #puts graph2.dump(:ttl)
506
+ graph2.should be_equivalent_graph(@graph, :trace => debug.unshift(result.force_encoding("utf-8")).join("\n"))
507
+ end
508
+ end
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end