rdf-rdfa 0.2.1 → 0.2.2

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.
@@ -0,0 +1,245 @@
1
+ # coding: utf-8
2
+ $:.unshift "."
3
+ require File.join(File.dirname(__FILE__), 'spec_helper')
4
+ require 'nokogiri'
5
+
6
+ describe RDF::Literal do
7
+ require 'nokogiri' rescue nil
8
+
9
+ before :each do
10
+ @new = Proc.new { |*args| RDF::Literal.new(*args) }
11
+ end
12
+
13
+ describe "XML Literal" do
14
+ describe "with no namespace" do
15
+ subject { @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral) }
16
+ it "should return input" do subject.to_s.should == "foo <sup>bar</sup> baz!" end
17
+
18
+ it "should be equal if they have the same contents" do
19
+ should == @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral)
20
+ end
21
+ end
22
+
23
+ describe "with a namespace" do
24
+ subject {
25
+ @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
26
+ :namespaces => {:dc => RDF::DC.to_s})
27
+ }
28
+
29
+ it "should add namespaces" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\">bar</dc:sup> baz!" end
30
+
31
+ describe "as string prefix" do
32
+ subject {
33
+ @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
34
+ :namespaces => {"dc" => RDF::DC.to_s})
35
+ }
36
+
37
+ it "should add namespaces" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\">bar</dc:sup> baz!" end
38
+ end
39
+
40
+ describe "and language" do
41
+ subject {
42
+ @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
43
+ :namespaces => {:dc => RDF::DC.to_s},
44
+ :language => :fr)
45
+ }
46
+
47
+ it "should add namespaces and language" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\" xml:lang=\"fr\">bar</dc:sup> baz!" end
48
+ end
49
+
50
+ describe "and node set" do
51
+ subject {
52
+ root = Nokogiri::XML.parse(%(<?xml version="1.0" encoding="UTF-8"?>
53
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
54
+ <html xmlns="http://www.w3.org/1999/xhtml"
55
+ xmlns:dc="http://purl.org/dc/terms/"
56
+ xmlns:ex="http://example.org/rdf/"
57
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
58
+ xmlns:svg="http://www.w3.org/2000/svg">
59
+ <head profile="http://www.w3.org/1999/xhtml/vocab http://www.w3.org/2005/10/profile">
60
+ <title>Test 0100</title>
61
+ </head>
62
+ <body>
63
+ <div about="http://www.example.org">
64
+ <h2 property="ex:example" datatype="rdf:XMLLiteral"><svg:svg/></h2>
65
+ </div>
66
+ </body>
67
+ </html>
68
+ ), nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML).root
69
+ content = root.css("h2").children
70
+ @new.call(content, :datatype => RDF.XMLLiteral,
71
+ :namespaces => {
72
+ :svg => "http://www.w3.org/2000/svg",
73
+ :dc => "http://purl.org/dc/terms/",
74
+ })
75
+ }
76
+ it "should add namespace" do subject.to_s.should == "<svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\"></svg:svg>" end
77
+ end
78
+
79
+ describe "and language with an existing language embedded" do
80
+ subject {
81
+ @new.call("foo <dc:sup>bar</dc:sup><dc:sub xml:lang=\"en\">baz</dc:sub>",
82
+ :datatype => RDF.XMLLiteral,
83
+ :namespaces => {:dc => RDF::DC.to_s},
84
+ :language => :fr)
85
+ }
86
+
87
+ it "should add namespaces and language" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\" xml:lang=\"fr\">bar</dc:sup><dc:sub xmlns:dc=\"http://purl.org/dc/terms/\" xml:lang=\"en\">baz</dc:sub>" end
88
+ end
89
+ end
90
+
91
+ describe "with a default namespace" do
92
+ subject {
93
+ @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral,
94
+ :namespaces => {:__default__ => RDF::DC.to_s})
95
+ }
96
+
97
+ it "should add namespace" do subject.to_s.should == "foo <sup xmlns=\"http://purl.org/dc/terms/\">bar</sup> baz!" end
98
+ end
99
+
100
+ describe "with a default namespace (as empty string)" do
101
+ subject {
102
+ @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral,
103
+ :namespaces => {"" => RDF::DC.to_s})
104
+ }
105
+
106
+ it "should add namespace" do subject.to_s.should == "foo <sup xmlns=\"http://purl.org/dc/terms/\">bar</sup> baz!" end
107
+ end
108
+
109
+ context "rdfcore tests" do
110
+ context "rdfms-xml-literal-namespaces" do
111
+ it "should reproduce test001" do
112
+ l = @new.call("
113
+ <html:h1>
114
+ <b>John</b>
115
+ </html:h1>
116
+ ",
117
+ :datatype => RDF.XMLLiteral,
118
+ :namespaces => {
119
+ "" => "http://www.w3.org/1999/xhtml",
120
+ "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
121
+ "html" => "http://NoHTML.example.org",
122
+ "my" => "http://my.example.org/",
123
+ })
124
+
125
+ pending("XML C14N") do
126
+ l.to_s.should == "\n <html:h1 xmlns:html=\"http://NoHTML.example.org\">\n <b xmlns=\"http://www.w3.org/1999/xhtml\">John</b>\n </html:h1>\n "
127
+ end
128
+ end
129
+
130
+ it "should reproduce test002" do
131
+ l = @new.call("
132
+ Ramifications of
133
+ <apply>
134
+ <power/>
135
+ <apply>
136
+ <plus/>
137
+ <ci>a</ci>
138
+ <ci>b</ci>
139
+ </apply>
140
+ <cn>2</cn>
141
+ </apply>
142
+ to World Peace
143
+ ",
144
+ :datatype => RDF.XMLLiteral,
145
+ :namespaces => {
146
+ "" => "http://www.w3.org/TR/REC-mathml",
147
+ })
148
+
149
+ l.to_s.should == "\n Ramifications of\n <apply xmlns=\"http://www.w3.org/TR/REC-mathml\">\n <power></power>\n <apply>\n\t<plus></plus>\n\t<ci>a</ci>\n\t<ci>b</ci>\n </apply>\n <cn>2</cn>\n </apply>\n to World Peace\n "
150
+ end
151
+ end
152
+
153
+ context "rdfms-xmllang" do
154
+ it "should reproduce test001" do
155
+ l = @new.call("chat", :datatype => RDF.XMLLiteral, :language => nil)
156
+
157
+ l.to_s.should == "chat"
158
+ end
159
+ it "should reproduce test002" do
160
+ l = @new.call("chat", :datatype => RDF.XMLLiteral, :language => :fr)
161
+
162
+ l.to_s.should == "chat"
163
+ end
164
+ end
165
+
166
+ context "xml-canon" do
167
+ it "should reproduce test001" do
168
+ l = @new.call("<br />", :datatype => RDF.XMLLiteral)
169
+
170
+ l.to_s.should == "<br></br>"
171
+ end
172
+ end
173
+ end
174
+
175
+ context "rdfa tests" do
176
+ it "should reproduce test 0011: XMLLiteral" do
177
+ l = @new.call("E = mc<sup>2</sup>: The Most Urgent Problem of Our Time",
178
+ :datatype => RDF.XMLLiteral,
179
+ :namespaces => {"" => "http://www.w3.org/1999/xhtml"})
180
+
181
+ l.to_s.should == "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\">2</sup>: The Most Urgent Problem of Our Time"
182
+ end
183
+
184
+ it "should reproduce test 0092: Tests XMLLiteral content with explicit @datatype" do
185
+ l = @new.call(%(E = mc<sup>2</sup>: The Most Urgent Problem of Our Time<),
186
+ :datatype => RDF.XMLLiteral,
187
+ :namespaces => {"" => "http://www.w3.org/1999/xhtml"})
188
+
189
+ l.to_s.should == "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\">2</sup>: The Most Urgent Problem of Our Time"
190
+ end
191
+
192
+ it "should reproduce test 0100: XMLLiteral with explicit namespace" do
193
+ l = @new.call(%(Some text here in <strong>bold</strong> and an svg rectangle: <svg:svg><svg:rect svg:width="200" svg:height="100"/></svg:svg>),
194
+ :datatype => RDF.XMLLiteral,
195
+ :namespaces => {
196
+ "" => "http://www.w3.org/1999/xhtml",
197
+ "svg" => "http://www.w3.org/2000/svg",
198
+ })
199
+
200
+ pending("XML C14N") do
201
+ l.to_s.should == "Some text here in <strong xmlns=\"http://www.w3.org/1999/xhtml\">bold</strong> and an svg rectangle: <svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"
202
+ end
203
+ end
204
+
205
+ it "should reproduce 0101: XMLLiteral with explicit namespace and xml:lang" do
206
+ l = @new.call(%(Du texte ici en <strong>gras</strong> et un rectangle en svg: <svg:svg><svg:rect svg:width="200" svg:height="100"/></svg:svg>),
207
+ :datatype => RDF.XMLLiteral, :language => :fr,
208
+ :namespaces => {
209
+ "" => "http://www.w3.org/1999/xhtml",
210
+ "svg" => "http://www.w3.org/2000/svg",
211
+ })
212
+
213
+ pending("XML C14N") do
214
+ l.to_s.should == "Du texte ici en <strong xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">gras</strong> et un rectangle en svg: <svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\" xml:lang=\"fr\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"
215
+ end
216
+ end
217
+
218
+ it "should reproduce test 0102: XMLLiteral with explicit namespace and xml:lang; not overwriting existing langs" do
219
+ l = @new.call(%(Du texte ici en <strong>gras</strong> et un rectangle en svg: <svg:svg xml:lang="hu"><svg:rect svg:width="200" svg:height="100"/></svg:svg>),
220
+ :datatype => RDF.XMLLiteral, :language => :fr,
221
+ :namespaces => {
222
+ "" => "http://www.w3.org/1999/xhtml",
223
+ "svg" => "http://www.w3.org/2000/svg",
224
+ })
225
+
226
+ pending("XML C14N") do
227
+ l.to_s.should == "Du texte ici en <strong xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">gras</strong> et un rectangle en svg: <svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\" xml:lang=\"hu\"><svg:rect svg:height=\"100\" svg:width=\"200\"></svg:rect></svg:svg>"
228
+ end
229
+ end
230
+
231
+ it "should reproduce test 0103: XMLLiteral with explicit namespace; not overwriting local namespaces" do
232
+ l = @new.call(%(Some text here in <strong>bold</strong> and an svg rectangle: <svg xmlns="http://www.w3.org/2000/svg"><rect width="200" height="100"/></svg>),
233
+ :datatype => RDF.XMLLiteral,
234
+ :namespaces => {
235
+ "" => "http://www.w3.org/1999/xhtml",
236
+ "svg" => "http://www.w3.org/2000/svg",
237
+ })
238
+
239
+ pending("XML C14N") do
240
+ l.to_s.should == "Some text here in <strong xmlns=\"http://www.w3.org/1999/xhtml\">bold</strong> and an svg rectangle: <svg xmlns=\"http://www.w3.org/2000/svg\"><rect height=\"100\" width=\"200\"></rect></svg>"
241
+ end
242
+ end
243
+ end
244
+ end if defined?(::Nokogiri)
245
+ end
data/spec/matchers.rb CHANGED
@@ -77,7 +77,7 @@ module Matchers
77
77
 
78
78
  @results = @query.execute(model)
79
79
  #puts "Redland query results: #{@results.inspect}"
80
- if @expected_results
80
+ if @expected_results && @results
81
81
  @results.is_boolean? && @results.get_boolean?
82
82
  else
83
83
  @results.nil? || @results.is_boolean? && !@results.get_boolean?
data/spec/rdfa_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rdf/rdfxml'
2
+ require 'open-uri'
2
3
  autoload :YAML, "yaml"
3
4
  autoload :CGI, 'cgi'
4
5
 
@@ -39,7 +40,7 @@ module RdfaHelper
39
40
  pred = statement.predicate.to_s.split(/[\#\/]/).last
40
41
  obj = statement.object.is_a?(RDF::Literal) ? statement.object.value : statement.object.to_s
41
42
 
42
- puts "#{pred}: #{obj}" if $DEBUG
43
+ puts "#{pred}: #{obj}" if ::RDF::RDFa::debug?
43
44
 
44
45
  unless self.about
45
46
  self.about = statement.subject
@@ -109,6 +110,12 @@ module RdfaHelper
109
110
  %(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">\n) +
110
111
  %(<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0"\n)
111
112
  head + "#{namespaces}>\n#{body.gsub(TCPATHRE, tcpath)}\n</html>"
113
+ when "xhtml11"
114
+ head = "" +
115
+ %(<?xml version="1.0" encoding="UTF-8"?>\n) +
116
+ %(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">\n) +
117
+ %(<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1"\n)
118
+ head + "#{namespaces}>\n#{body.gsub(TCPATHRE, tcpath)}\n</html>"
112
119
  when "html4"
113
120
  head ="" +
114
121
  %(<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n) +
@@ -128,18 +135,22 @@ module RdfaHelper
128
135
  f = self.name + ".sparql"
129
136
  body = File.read(File.join(RDFA_DIR, "tests", f)).gsub(TCPATHRE, tcpath)
130
137
 
131
- suite == "xhtml" ? body : body.gsub(HTMLRE, '\1.html')
138
+ suite =~ /xhtml/ ? body : body.gsub(HTMLRE, '\1.html')
132
139
  end
133
140
 
134
141
  def triples
135
142
  f = self.name + ".nt"
136
143
  body = File.read(File.join(RDFA_NT_DIR, f)).gsub(TCPATHRE, tcpath)
137
- suite == "xhtml" ? body : body.gsub(HTMLRE, '\1.html')
144
+ suite =~ /xhtml/ ? body : body.gsub(HTMLRE, '\1.html')
138
145
  end
139
146
 
140
147
  def inputDocument; self.name + ".txt"; end
141
148
  def outputDocument; self.name + ".sparql"; end
142
149
 
150
+ def version
151
+ suite == "xhtml11" ? :rdfa_1_1 : :rdfa_1_0
152
+ end
153
+
143
154
  # Run test case, yields input for parser to create triples
144
155
  def run_test
145
156
  rdfa_string = input
@@ -213,3 +224,33 @@ module RdfaHelper
213
224
  end
214
225
  end
215
226
  end
227
+
228
+ module RDF
229
+ class Graph
230
+ def self.load(url, options = {}, &block)
231
+ url = case url.to_s
232
+ when %r(http://rdfa.digitalbazaar.com/test-suite/test-cases/\w+)
233
+ file = url.to_s.sub(%r(http://rdfa.digitalbazaar.com/test-suite/test-cases/\w+),
234
+ File.join(File.expand_path(File.dirname(__FILE__)), 'rdfa-test-suite', 'tests'))
235
+ file
236
+ when "http://www.w3.org/1999/xhtml/vocab"
237
+ file = File.join(File.expand_path(File.dirname(__FILE__)), 'rdfa-test-suite', 'profile', "xhv")
238
+ file
239
+ when "http://www.w3.org/2005/10/profile"
240
+ file = File.join(File.expand_path(File.dirname(__FILE__)), 'rdfa-test-suite', 'profile', "xhv")
241
+ else
242
+ url
243
+ end
244
+
245
+ self.new(url, options) do |graph|
246
+ graph.load! unless graph.unnamed?
247
+ if block_given?
248
+ case block.arity
249
+ when 1 then block.call(graph)
250
+ else graph.instance_eval(&block)
251
+ end
252
+ end
253
+ end
254
+ end
255
+ end
256
+ end
@@ -1,3 +1,4 @@
1
+ $:.unshift "."
1
2
  require File.join(File.dirname(__FILE__), 'spec_helper')
2
3
  require 'rdfa_helper'
3
4
 
@@ -17,49 +18,6 @@ describe RDF::RDFa::Format do
17
18
  end
18
19
 
19
20
  describe "RDF::RDFa::Reader" do
20
- before(:all) do
21
- # Don't load external profiles when testing
22
- {
23
- "basic" => {
24
- :base_uri => "http://www.w3.org/2007/08/pyRdfa/profiles/basic",
25
- :format => :rdfa,
26
- :file => File.join(File.dirname(__FILE__), "..", "etc", "basic.html"),
27
- },
28
- "foaf" => {
29
- :base_uri => "http://www.w3.org/2007/08/pyRdfa/profiles/foaf",
30
- :format => :rdfa,
31
- :file => File.join(File.dirname(__FILE__), "..", "etc", "foaf.html"),
32
- },
33
- "xhv" => {
34
- :base_uri => "http://www.w3.org/1999/xhtml/vocab",
35
- :format => :rdfa,
36
- :file => File.join(File.dirname(__FILE__), "..", "etc", "xhv.html"),
37
- },
38
- "profile" => {
39
- :base_uri => "http://www.w3.org/2005/10/profile",
40
- :format => :rdfa,
41
- :value => "PROFILE",
42
- },
43
- "hcard" => {
44
- :base_uri => "http://microformats.org/profiles/hcard",
45
- :format => :rdfa,
46
- :value => "HCARD",
47
- },
48
- }.each_pair do |name, opts|
49
- if opts[:file]
50
- graph = RDF::Graph.new
51
- RDF::Reader.for(opts[:format]).new(File.read(opts[:file]),
52
- :base_uri => opts[:base_uri]).each do |statement|
53
- graph << statement
54
- end
55
- opts[:value] = graph
56
- end
57
- RDF::Graph.stub!(:load).with(opts[:base_uri],
58
- :base_uri => opts[:base_uri],
59
- :format => opts[:format]).and_return(opts[:value])
60
- end
61
- end
62
-
63
21
  context "discovery" do
64
22
  {
65
23
  "html" => RDF::Reader.for(:rdfa),
@@ -78,7 +36,7 @@ describe "RDF::RDFa::Reader" do
78
36
  before(:each) do
79
37
  @sampledoc = <<-EOF;
80
38
  <?xml version="1.0" encoding="UTF-8"?>
81
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
39
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
82
40
  <html xmlns="http://www.w3.org/1999/xhtml"
83
41
  xmlns:dc="http://purl.org/dc/elements/1.1/">
84
42
  <head>
@@ -120,11 +78,11 @@ EOF
120
78
  end
121
79
  end
122
80
 
123
- context "paring a simple doc" do
81
+ context "parsing a simple doc" do
124
82
  before :each do
125
83
  sampledoc = <<-EOF;
126
84
  <?xml version="1.0" encoding="UTF-8"?>
127
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
85
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
128
86
  <html xmlns="http://www.w3.org/1999/xhtml"
129
87
  xmlns:dc="http://purl.org/dc/elements/1.1/">
130
88
  <head>
@@ -161,7 +119,7 @@ EOF
161
119
  before :each do
162
120
  sampledoc = <<-EOF;
163
121
  <?xml version="1.0" encoding="UTF-8"?>
164
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
122
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
165
123
  <html xmlns="http://www.w3.org/1999/xhtml"
166
124
  xmlns:dc="http://purl.org/dc/elements/1.1/">
167
125
  <body>
@@ -195,16 +153,17 @@ EOF
195
153
  before :each do
196
154
  sampledoc = <<-EOF
197
155
  <?xml version="1.0" encoding="UTF-8"?>
198
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
156
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
199
157
  <html xmlns="http://www.w3.org/1999/xhtml"
200
- xmlns:dc="http://purl.org/dc/elements/1.1/">
158
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
159
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
201
160
  <head>
202
161
  <title>Test 0011</title>
203
162
  </head>
204
163
  <body>
205
164
  <div about="">
206
165
  Author: <span property="dc:creator">Albert Einstein</span>
207
- <h2 property="dc:title">E = mc<sup>2</sup>: The Most Urgent Problem of Our Time</h2>
166
+ <h2 property="dc:title" datatype="rdf:XMLLiteral">E = mc<sup>2</sup>: The Most Urgent Problem of Our Time</h2>
208
167
  </div>
209
168
  </body>
210
169
  </html>
@@ -238,8 +197,8 @@ EOF
238
197
  before :each do
239
198
  sampledoc = <<-EOF
240
199
  <?xml version="1.0" encoding="UTF-8"?>
241
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
242
- <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0"
200
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
201
+ <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1"
243
202
  xmlns:foaf="http://xmlns.com/foaf/0.1/">
244
203
  <head>
245
204
  <title>Test 0017</title>
@@ -290,8 +249,8 @@ EOF
290
249
  before :each do
291
250
  sampledoc = <<-EOF
292
251
  <?xml version="1.0" encoding="UTF-8"?>
293
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
294
- <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0"
252
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
253
+ <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1"
295
254
  xmlns:foaf="http://xmlns.com/foaf/0.1/">
296
255
  <head>
297
256
  <title>Test 0049</title>
@@ -332,8 +291,8 @@ EOF
332
291
  before :each do
333
292
  sampledoc = <<-EOF
334
293
  <?xml version="1.0" encoding="UTF-8"?>
335
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
336
- <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0"
294
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
295
+ <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1"
337
296
  xmlns:dc="http://purl.org/dc/elements/1.1/">
338
297
  <head>
339
298
  <base href="http://www.example.org/"></base>
@@ -364,13 +323,13 @@ EOF
364
323
  before :each do
365
324
  sampledoc = <<-EOF
366
325
  <?xml version="1.0" encoding="UTF-8"?>
367
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
368
- <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0">
326
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
327
+ <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1">
369
328
  <head>
370
329
  <title>Test</title>
371
330
  <base href="http://example.org/"/>
372
331
  </head>
373
- <body profile="http://www.w3.org/2007/08/pyRdfa/profiles/basic">
332
+ <body profile="http://rdfa.digitalbazaar.com/test-suite/test-cases/tests/../profiles/basic">
374
333
  <div about="#me">
375
334
  <p>
376
335
  <span property="foaf:name">Ivan Herman</span>
@@ -405,13 +364,13 @@ EOF
405
364
  before :each do
406
365
  sampledoc = <<-EOF
407
366
  <?xml version="1.0" encoding="UTF-8"?>
408
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
409
- <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0">
367
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
368
+ <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1">
410
369
  <head>
411
370
  <title>Test</title>
412
371
  <base href="http://example.org/"/>
413
372
  </head>
414
- <body profile="http://www.w3.org/2007/08/pyRdfa/profiles/foaf">
373
+ <body profile="http://rdfa.digitalbazaar.com/test-suite/test-cases/tests/../profiles/foaf">
415
374
  <div about="#me">
416
375
  <p>
417
376
  <span property="name">Ivan Herman</span>
@@ -447,7 +406,7 @@ EOF
447
406
  end
448
407
 
449
408
  # W3C Test suite from http://www.w3.org/2006/07/SWD/RDFa/testsuite/
450
- %w(xhtml).each do |suite| # html4 html5
409
+ %w(xhtml xhtml11).each do |suite| # html4 html5
451
410
  describe "w3c #{suite} testcases" do
452
411
  describe "that are approved" do
453
412
  test_cases(suite).each do |t|
@@ -461,8 +420,14 @@ EOF
461
420
  t.debug = []
462
421
  parse(rdfa_string,
463
422
  :base_uri => t.informationResourceInput,
464
- :strict => true,
465
- :debug => t.debug)
423
+ :debug => t.debug,
424
+ :version => t.version)
425
+ end
426
+ rescue Spec::Expectations::ExpectationNotMetError => e
427
+ if t.input =~ /XMLLiteral/
428
+ pending("XMLLiteral canonicalization not implemented yet")
429
+ else
430
+ raise
466
431
  end
467
432
  rescue SparqlException => e
468
433
  pending(e.message) { raise }
@@ -481,8 +446,8 @@ EOF
481
446
  t.debug = []
482
447
  parse(rdfa_string,
483
448
  :base_uri => t.informationResourceInput,
484
- :strict => true,
485
- :debug => t.debug)
449
+ :debug => t.debug,
450
+ :version => t.version)
486
451
  end
487
452
  rescue SparqlException => e
488
453
  pending(e.message) { raise }