rdf-rdfxml 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/example.rb DELETED
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
4
-
5
- require 'rubygems'
6
- require 'rdf/rdfxml'
7
-
8
- data = <<-EOF;
9
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
10
- xmlns:ex="http://www.example.org/" xml:lang="en" xml:base="http://www.example.org/foo">
11
- <ex:Thing rdf:about="http://example.org/joe" ex:name="bar">
12
- <ex:belongsTo rdf:resource="http://tommorris.org/" />
13
- <ex:sampleText rdf:datatype="http://www.w3.org/2001/XMLSchema#string">foo</ex:sampleText>
14
- <ex:hadADodgyRelationshipWith>
15
- <rdf:Description>
16
- <ex:name>Tom</ex:name>
17
- <ex:hadADodgyRelationshipWith>
18
- <rdf:Description>
19
- <ex:name>Rob</ex:name>
20
- <ex:hadADodgyRelationshipWith>
21
- <rdf:Description>
22
- <ex:name>Mary</ex:name>
23
- </rdf:Description>
24
- </ex:hadADodgyRelationshipWith>
25
- </rdf:Description>
26
- </ex:hadADodgyRelationshipWith>
27
- </rdf:Description>
28
- </ex:hadADodgyRelationshipWith>
29
- </ex:Thing>
30
- </rdf:RDF>
31
- EOF
32
-
33
- RDF::RDFXML::Reader.new(data, :base_uri => 'http://example.org/example.xml') do |reader|
34
- reader.each_statement do |statement|
35
- statement.inspect!
36
- end
37
- end
data/rdf-rdfxml.gemspec DELETED
@@ -1,99 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{rdf-rdfxml}
8
- s.version = "0.3.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Gregg Kellogg}]
12
- s.date = %q{2011-08-08}
13
- s.description = %q{RDF::RDFXML is an RDF/XML reader and writer for the RDF.rb library suite.}
14
- s.email = %q{gregg@kellogg-assoc.com}
15
- s.extra_rdoc_files = [
16
- "AUTHORS",
17
- "CONTRIBUTORS",
18
- "History.rdoc",
19
- "README.md",
20
- "UNLICENSE"
21
- ]
22
- s.files = [
23
- ".yardopts",
24
- "AUTHORS",
25
- "CONTRIBUTORS",
26
- "History.rdoc",
27
- "README",
28
- "README.md",
29
- "Rakefile",
30
- "UNLICENSE",
31
- "VERSION",
32
- "etc/doap.nt",
33
- "etc/doap.xml",
34
- "example.rb",
35
- "lib/rdf/rdfxml.rb",
36
- "lib/rdf/rdfxml/format.rb",
37
- "lib/rdf/rdfxml/patches/array_hacks.rb",
38
- "lib/rdf/rdfxml/patches/graph_properties.rb",
39
- "lib/rdf/rdfxml/patches/literal_hacks.rb",
40
- "lib/rdf/rdfxml/patches/nokogiri_hacks.rb",
41
- "lib/rdf/rdfxml/reader.rb",
42
- "lib/rdf/rdfxml/version.rb",
43
- "lib/rdf/rdfxml/vocab.rb",
44
- "lib/rdf/rdfxml/writer.rb",
45
- "rdf-rdfxml.gemspec",
46
- "script/console",
47
- "script/parse",
48
- "script/tc",
49
- "script/yard-to-rubyforge",
50
- "spec/.gitignore",
51
- "spec/format_spec.rb",
52
- "spec/graph_spec.rb",
53
- "spec/literal_spec.rb",
54
- "spec/matchers.rb",
55
- "spec/rdf_test.rb",
56
- "spec/reader_spec.rb",
57
- "spec/spec.opts",
58
- "spec/spec_helper.rb",
59
- "spec/writer_spec.rb"
60
- ]
61
- s.homepage = %q{http://github.com/gkellogg/rdf-rdfxml}
62
- s.require_paths = [%q{lib}]
63
- s.rubygems_version = %q{1.8.6}
64
- s.summary = %q{RDF/XML reader/writer for RDF.rb.}
65
-
66
- if s.respond_to? :specification_version then
67
- s.specification_version = 3
68
-
69
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
- s.add_runtime_dependency(%q<rdf>, [">= 0.3.3"])
71
- s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.4"])
72
- s.add_development_dependency(%q<open-uri-cached>, [">= 0"])
73
- s.add_development_dependency(%q<spira>, [">= 0.0.12"])
74
- s.add_development_dependency(%q<rspec>, [">= 2.5.0"])
75
- s.add_development_dependency(%q<rdf-spec>, [">= 0.3.3"])
76
- s.add_development_dependency(%q<rdf-isomorphic>, [">= 0.3.4"])
77
- s.add_development_dependency(%q<yard>, [">= 0.6.4"])
78
- else
79
- s.add_dependency(%q<rdf>, [">= 0.3.3"])
80
- s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
81
- s.add_dependency(%q<open-uri-cached>, [">= 0"])
82
- s.add_dependency(%q<spira>, [">= 0.0.12"])
83
- s.add_dependency(%q<rspec>, [">= 2.5.0"])
84
- s.add_dependency(%q<rdf-spec>, [">= 0.3.3"])
85
- s.add_dependency(%q<rdf-isomorphic>, [">= 0.3.4"])
86
- s.add_dependency(%q<yard>, [">= 0.6.4"])
87
- end
88
- else
89
- s.add_dependency(%q<rdf>, [">= 0.3.3"])
90
- s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
91
- s.add_dependency(%q<open-uri-cached>, [">= 0"])
92
- s.add_dependency(%q<spira>, [">= 0.0.12"])
93
- s.add_dependency(%q<rspec>, [">= 2.5.0"])
94
- s.add_dependency(%q<rdf-spec>, [">= 0.3.3"])
95
- s.add_dependency(%q<rdf-isomorphic>, [">= 0.3.4"])
96
- s.add_dependency(%q<yard>, [">= 0.6.4"])
97
- end
98
- end
99
-
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- RDF = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "rdf", "lib"))
7
- libs << " -I #{RDF}" if File.directory?(RDF)
8
- libs << " -r #{File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "rdf", "rdfxml.rb")}"
9
- puts "Loading rdf-rdfxml gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/parse DELETED
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
4
- require 'rdf/rdfxml'
5
- require 'rdf/n3' rescue nil
6
- require 'getoptlong'
7
- require 'open-uri'
8
-
9
- def parse(input, base)
10
- reader_class = RDF::Reader.for($input_format.to_sym)
11
- writer_class = RDF::Writer.for($output_format.to_sym)
12
- raise "Reader not found for #{$input_format}" unless reader_class
13
- raise "Writer not found for #{$output_format}" unless writer_class
14
- puts writer_class.buffer(:standard_prefixes => true) { |writer|
15
- reader_class.new(input, :base_uri => base, :validate => true).each do |statement|
16
- writer << statement
17
- end
18
- }
19
- end
20
-
21
- $verbose = false
22
- $output_format = :ntriples
23
- $input_format = :rdfxml
24
- base_uri = "http://example.com"
25
- input = nil
26
-
27
- opts = GetoptLong.new(
28
- ["--debug", GetoptLong::NO_ARGUMENT],
29
- ["--verbose", GetoptLong::NO_ARGUMENT],
30
- ["--quiet", GetoptLong::NO_ARGUMENT],
31
- ["--format", GetoptLong::REQUIRED_ARGUMENT],
32
- ["--input-format", GetoptLong::REQUIRED_ARGUMENT],
33
- ["--execute", "-e", GetoptLong::REQUIRED_ARGUMENT],
34
- ["--uri", GetoptLong::REQUIRED_ARGUMENT]
35
- )
36
- opts.each do |opt, arg|
37
- case opt
38
- when '--verbose' then $verbose = true
39
- when '--quiet' then $quiet = true
40
- when '--debug' then ::RDF::RDFXML::debug = true
41
- when '--execute' then input = arg
42
- when '--format' then $output_format = arg
43
- when '--input-format' then $input_format = arg
44
- when '--uri' then base_uri = arg
45
- end
46
- end
47
-
48
- if ARGV.empty?
49
- s = input ? input : $stdin.read
50
- parse(StringIO.new(s), base_uri)
51
- else
52
- ARGV.each do |test_file|
53
- parse(Kernel.open(test_file), base_uri)
54
- end
55
- end
data/script/tc DELETED
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env ruby -s
2
- require 'rubygems'
3
- $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
4
- require 'rdf/rdfxml'
5
- require File.expand_path(File.join(File.dirname(__FILE__), "..", 'spec', 'rdf_helper'))
6
- require 'getoptlong'
7
-
8
- def run_tc(tc)
9
- puts "run #{tc.name}"
10
- puts tc.input if $verbose
11
- puts RDF::Writer.for($output_format.to_sym).buffer { |writer|
12
- RDF::RDFXML::Reader.new(tc.input, :base_uri => tc.about, :validate => $validate).each do |statement|
13
- writer << statement
14
- end
15
- }
16
- end
17
-
18
- $verbose = false
19
- $output_format = :ntriples
20
- $validate = false
21
- suite = "rdfxml"
22
- opts = GetoptLong.new(
23
- ["--debug", GetoptLong::NO_ARGUMENT],
24
- ["--verbose", GetoptLong::NO_ARGUMENT],
25
- ["--quiet", GetoptLong::NO_ARGUMENT],
26
- ["--suite", GetoptLong::OPTIONAL_ARGUMENT],
27
- ["--validate", GetoptLong::NO_ARGUMENT],
28
- ["--format", GetoptLong::REQUIRED_ARGUMENT]
29
- )
30
- opts.each do |opt, arg|
31
- case opt
32
- when '--verbose' then $verbose = true
33
- when '--quiet' then $quiet = true
34
- when '--debug' then ::RDF::RDFXML::debug = true
35
- when '--format' then $output_format = arg
36
- when '--suite' then suite = arg
37
- when '--validate' then $validate = true
38
- end
39
- end
40
-
41
- # Test URI and directory for different suites
42
- TEST_PARAMS = {
43
- "rdfxml" => [RDFCORE_TEST, RDFCORE_DIR],
44
- }
45
- test_cases = RdfHelper::TestCase.test_cases(*TEST_PARAMS[suite])
46
-
47
- test_cases = test_cases.detect do |tc|
48
- next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
49
- run_tc(tc)
50
- end
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env sh
2
- rsync -azv doc/yard/ gkellogg@rubyforge.org:/var/www/gforge-projects/rdf/rdfxml/
data/spec/.gitignore DELETED
@@ -1 +0,0 @@
1
- /uri-cache/
data/spec/format_spec.rb DELETED
@@ -1,28 +0,0 @@
1
- $:.unshift "."
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
3
-
4
- describe RDF::RDFXML::Format do
5
- context "discovery" do
6
- {
7
- "rdf" => RDF::Format.for(:rdf),
8
- "rdfxml" => RDF::Format.for(:rdfxml),
9
- "etc/foaf.xml" => RDF::Format.for("etc/foaf.xml"),
10
- "etc/foaf.rdf" => RDF::Format.for("etc/foaf.rdf"),
11
- "foaf.xml" => RDF::Format.for(:file_name => "foaf.xml"),
12
- "foaf.rdf" => RDF::Format.for(:file_name => "foaf.xml"),
13
- ".xml" => RDF::Format.for(:file_extension => "xml"),
14
- ".rdf" => RDF::Format.for(:file_extension => "rdf"),
15
- "application/xml" => RDF::Format.for(:content_type => "application/xml"),
16
- "application/rdf+xml" => RDF::Format.for(:content_type => "application/rdf+xml"),
17
- }.each_pair do |label, format|
18
- it "should discover '#{label}'" do
19
- format.should == RDF::RDFXML::Format
20
- end
21
- end
22
-
23
- it "should discover 'xml'" do
24
- RDF::Format.for(:xml).reader.should == RDF::RDFXML::Reader
25
- RDF::Format.for(:xml).writer.should == RDF::RDFXML::Writer
26
- end
27
- end
28
- end
data/spec/graph_spec.rb DELETED
@@ -1,59 +0,0 @@
1
- $:.unshift "."
2
- require File.join(File.dirname(__FILE__), 'spec_helper')
3
- require 'rdf/rdfxml/patches/graph_properties'
4
-
5
- class EX < RDF::Vocabulary("http://example.com/"); end
6
-
7
- describe RDF::Graph do
8
- describe "properties" do
9
- subject { RDF::Graph.new }
10
-
11
- it "should get asserted properties" do
12
- subject << [EX.a, EX.b, EX.c]
13
- subject.properties(EX.a).should be_a(Hash)
14
- subject.properties(EX.a).size.should == 1
15
- subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
16
- subject.properties(EX.a)[EX.b.to_s].should == [EX.c]
17
- end
18
-
19
- it "should get asserted properties with 2 properties" do
20
- subject << [EX.a, EX.b, EX.c]
21
- subject << [EX.a, EX.b, EX.d]
22
- subject.properties(EX.a).should be_a(Hash)
23
- subject.properties(EX.a).size.should == 1
24
- subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
25
- subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d)
26
- end
27
-
28
- it "should get asserted properties with 3 properties" do
29
- subject << [EX.a, EX.b, EX.c]
30
- subject << [EX.a, EX.b, EX.d]
31
- subject << [EX.a, EX.b, EX.e]
32
- subject.properties(EX.a).should be_a(Hash)
33
- subject.properties(EX.a).size.should == 1
34
- subject.properties(EX.a).has_key?(EX.b.to_s).should be_true
35
- subject.properties(EX.a)[EX.b.to_s].should include(EX.c, EX.d, EX.e)
36
- end
37
-
38
- it "should get asserted properties for a RDF::Node" do
39
- bn = RDF::Node.new
40
- subject << [bn, EX.b, EX.c]
41
- subject.properties(bn).should be_a(Hash)
42
- subject.properties(bn).size.should == 1
43
- subject.properties(bn).has_key?(EX.b.to_s).should be_true
44
- subject.properties(bn)[EX.b.to_s].should == [EX.c]
45
- end
46
-
47
- it "should get asserted type with single type" do
48
- subject << [EX.a, RDF.type, EX.Audio]
49
- subject.properties(EX.a)[RDF.type.to_s].should == [EX.Audio]
50
- subject.type_of(EX.a).should == [EX.Audio]
51
- end
52
-
53
- it "should get nil with no type" do
54
- subject << [EX.a, EX.b, EX.c]
55
- subject.properties(EX.a)[RDF.type.to_s].should == nil
56
- subject.type_of(EX.a).should == []
57
- end
58
- end
59
- end
data/spec/literal_spec.rb DELETED
@@ -1,244 +0,0 @@
1
- # coding: utf-8
2
- $:.unshift "."
3
- require File.join(File.dirname(__FILE__), 'spec_helper')
4
-
5
- describe RDF::Literal do
6
- require 'nokogiri' rescue nil
7
-
8
- before :each do
9
- @new = Proc.new { |*args| RDF::Literal.new(*args) }
10
- end
11
-
12
- describe "XML Literal" do
13
- describe "with no namespace" do
14
- subject { @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral) }
15
- it "should return input" do subject.to_s.should == "foo <sup>bar</sup> baz!" end
16
-
17
- it "should be equal if they have the same contents" do
18
- should == @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral)
19
- end
20
- end
21
-
22
- describe "with a namespace" do
23
- subject {
24
- @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
25
- :namespaces => {:dc => RDF::DC.to_s})
26
- }
27
-
28
- it "should add namespaces" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\">bar</dc:sup> baz!" end
29
-
30
- describe "as string prefix" do
31
- subject {
32
- @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
33
- :namespaces => {"dc" => RDF::DC.to_s})
34
- }
35
-
36
- it "should add namespaces" do subject.to_s.should == "foo <dc:sup xmlns:dc=\"http://purl.org/dc/terms/\">bar</dc:sup> baz!" end
37
- end
38
-
39
- describe "and language" do
40
- subject {
41
- @new.call("foo <dc:sup>bar</dc:sup> baz!", :datatype => RDF.XMLLiteral,
42
- :namespaces => {:dc => RDF::DC.to_s},
43
- :language => :fr)
44
- }
45
-
46
- 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
47
- end
48
-
49
- describe "and node set" do
50
- subject {
51
- root = Nokogiri::XML.parse(%(<?xml version="1.0" encoding="UTF-8"?>
52
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
53
- <html xmlns="http://www.w3.org/1999/xhtml"
54
- xmlns:dc="http://purl.org/dc/terms/"
55
- xmlns:ex="http://example.org/rdf/"
56
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
57
- xmlns:svg="http://www.w3.org/2000/svg">
58
- <head profile="http://www.w3.org/1999/xhtml/vocab http://www.w3.org/2005/10/profile">
59
- <title>Test 0100</title>
60
- </head>
61
- <body>
62
- <div about="http://www.example.org">
63
- <h2 property="ex:example" datatype="rdf:XMLLiteral"><svg:svg/></h2>
64
- </div>
65
- </body>
66
- </html>
67
- ), nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML).root
68
- content = root.css("h2").children
69
- @new.call(content, :datatype => RDF.XMLLiteral,
70
- :namespaces => {
71
- :svg => "http://www.w3.org/2000/svg",
72
- :dc => "http://purl.org/dc/terms/",
73
- })
74
- }
75
- it "should add namespace" do subject.to_s.should == "<svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:dc=\"http://purl.org/dc/terms/\"></svg:svg>" end
76
- end
77
-
78
- describe "and language with an existing language embedded" do
79
- subject {
80
- @new.call("foo <dc:sup>bar</dc:sup><dc:sub xml:lang=\"en\">baz</dc:sub>",
81
- :datatype => RDF.XMLLiteral,
82
- :namespaces => {:dc => RDF::DC.to_s},
83
- :language => :fr)
84
- }
85
-
86
- 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
87
- end
88
- end
89
-
90
- describe "with a default namespace" do
91
- subject {
92
- @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral,
93
- :namespaces => {"" => RDF::DC.to_s})
94
- }
95
-
96
- it "should add namespace" do subject.to_s.should == "foo <sup xmlns=\"http://purl.org/dc/terms/\">bar</sup> baz!" end
97
- end
98
-
99
- describe "with a default namespace (as empty string)" do
100
- subject {
101
- @new.call("foo <sup>bar</sup> baz!", :datatype => RDF.XMLLiteral,
102
- :namespaces => {"" => RDF::DC.to_s})
103
- }
104
-
105
- it "should add namespace" do subject.to_s.should == "foo <sup xmlns=\"http://purl.org/dc/terms/\">bar</sup> baz!" end
106
- end
107
-
108
- context "rdfcore tests" do
109
- context "rdfms-xml-literal-namespaces" do
110
- it "should reproduce test001" do
111
- l = @new.call("
112
- <html:h1>
113
- <b>John</b>
114
- </html:h1>
115
- ",
116
- :datatype => RDF.XMLLiteral,
117
- :namespaces => {
118
- "" => "http://www.w3.org/1999/xhtml",
119
- "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
120
- "html" => "http://NoHTML.example.org",
121
- "my" => "http://my.example.org/",
122
- })
123
-
124
- pending do
125
- 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 "
126
- end
127
- end
128
-
129
- it "should reproduce test002" do
130
- l = @new.call("
131
- Ramifications of
132
- <apply>
133
- <power/>
134
- <apply>
135
- <plus/>
136
- <ci>a</ci>
137
- <ci>b</ci>
138
- </apply>
139
- <cn>2</cn>
140
- </apply>
141
- to World Peace
142
- ",
143
- :datatype => RDF.XMLLiteral,
144
- :namespaces => {
145
- "" => "http://www.w3.org/TR/REC-mathml",
146
- })
147
-
148
- 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 "
149
- end
150
- end
151
-
152
- context "rdfms-xmllang" do
153
- it "should reproduce test001" do
154
- l = @new.call("chat", :datatype => RDF.XMLLiteral, :language => nil)
155
-
156
- l.to_s.should == "chat"
157
- end
158
- it "should reproduce test002" do
159
- l = @new.call("chat", :datatype => RDF.XMLLiteral, :language => :fr)
160
-
161
- l.to_s.should == "chat"
162
- end
163
- end
164
-
165
- context "xml-canon" do
166
- it "should reproduce test001" do
167
- l = @new.call("<br />", :datatype => RDF.XMLLiteral)
168
-
169
- l.to_s.should == "<br></br>"
170
- end
171
- end
172
- end
173
-
174
- context "rdfa tests" do
175
- it "should reproduce test 0011: XMLLiteral" do
176
- l = @new.call("E = mc<sup>2</sup>: The Most Urgent Problem of Our Time",
177
- :datatype => RDF.XMLLiteral,
178
- :namespaces => {"" => "http://www.w3.org/1999/xhtml"})
179
-
180
- l.to_s.should == "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\">2</sup>: The Most Urgent Problem of Our Time"
181
- end
182
-
183
- it "should reproduce test 0092: Tests XMLLiteral content with explicit @datatype" do
184
- l = @new.call(%(E = mc<sup>2</sup>: The Most Urgent Problem of Our Time<),
185
- :datatype => RDF.XMLLiteral,
186
- :namespaces => {"" => "http://www.w3.org/1999/xhtml"})
187
-
188
- l.to_s.should == "E = mc<sup xmlns=\"http://www.w3.org/1999/xhtml\">2</sup>: The Most Urgent Problem of Our Time"
189
- end
190
-
191
- it "should reproduce test 0100: XMLLiteral with explicit namespace" do
192
- 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>),
193
- :datatype => RDF.XMLLiteral,
194
- :namespaces => {
195
- "" => "http://www.w3.org/1999/xhtml",
196
- "svg" => "http://www.w3.org/2000/svg",
197
- })
198
-
199
- pending do
200
- 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>"
201
- end
202
- end
203
-
204
- it "should reproduce 0101: XMLLiteral with explicit namespace and xml:lang" do
205
- 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>),
206
- :datatype => RDF.XMLLiteral, :language => :fr,
207
- :namespaces => {
208
- "" => "http://www.w3.org/1999/xhtml",
209
- "svg" => "http://www.w3.org/2000/svg",
210
- })
211
-
212
- pending do
213
- 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>"
214
- end
215
- end
216
-
217
- it "should reproduce test 0102: XMLLiteral with explicit namespace and xml:lang; not overwriting existing langs" do
218
- 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>),
219
- :datatype => RDF.XMLLiteral, :language => :fr,
220
- :namespaces => {
221
- "" => "http://www.w3.org/1999/xhtml",
222
- "svg" => "http://www.w3.org/2000/svg",
223
- })
224
-
225
- pending do
226
- 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>"
227
- end
228
- end
229
-
230
- it "should reproduce test 0103: XMLLiteral with explicit namespace; not overwriting local namespaces" do
231
- 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>),
232
- :datatype => RDF.XMLLiteral,
233
- :namespaces => {
234
- "" => "http://www.w3.org/1999/xhtml",
235
- "svg" => "http://www.w3.org/2000/svg",
236
- })
237
-
238
- pending do
239
- 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>"
240
- end
241
- end
242
- end
243
- end if defined?(::Nokogiri)
244
- end