Skip to content

Commit 8e43c14

Browse files
committed
Don't depend on build-in vocabularies.
1 parent 00ec808 commit 8e43c14

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

example-files/jcoyne.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class Foo < RDF::Vocabulary('http://example.com#')
1717
leaf1 = RDF::Node.new
1818
leaf2 = RDF::Node.new
1919

20-
g.insert([leaf1, RDF::DC.title, 'Hi' ])
21-
g.insert([leaf2, RDF::DC.title, 'There'])
20+
g.insert([leaf1, RDF::URI("http://purl.org/dc/terms/title"), 'Hi' ])
21+
g.insert([leaf2, RDF::URI("http://purl.org/dc/terms/title"), 'There'])
2222
g.insert([list1, RDF.first, leaf1 ])
2323
g.insert([list1, RDF.rest, list2 ])
2424
g.insert([list2, RDF.first, leaf2 ])

spec/jruby_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
describe RDF::RDFXML::Writer, skip: ("Nokogiri not loaded" unless have_nokogiri) do
2323
context "resource without type" do
2424
subject do
25-
@graph = RDF::Repository.new << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
25+
@graph = RDF::Repository.new << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
2626
serialize(:max_depth => 1, :attributes => :untyped)
2727
end
2828

spec/writer_spec.rb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
1818
context "typed resources" do
1919
context "resource without type" do
2020
subject do
21-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
21+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
2222
serialize(attributes: :untyped)
2323
end
2424

@@ -35,7 +35,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
3535
context "resource with type" do
3636
subject do
3737
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
38-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
38+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
3939
serialize(attributes: :untyped)
4040
end
4141

@@ -54,7 +54,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
5454
subject do
5555
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
5656
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.XtraRelease]
57-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
57+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
5858
serialize(attributes: :untyped)
5959
end
6060

@@ -73,7 +73,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
7373
subject do
7474
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
7575
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.XtraRelease]
76-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
76+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
7777
serialize(attributes: :none)
7878
end
7979

@@ -94,7 +94,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
9494
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
9595
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.XtraRelease]
9696
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.XXtraRelease]
97-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
97+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
9898
serialize(attributes: :typed)
9999
end
100100

@@ -114,7 +114,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
114114
context "with illegal content" do
115115
context "in attribute", skip: !defined?(::Nokogiri) do
116116
subject do
117-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo & bar"]
117+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo & bar"]
118118
serialize(attributes: :untyped)
119119
end
120120

@@ -130,7 +130,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
130130
end
131131
context "in element" do
132132
subject do
133-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo & bar"]
133+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo & bar"]
134134
serialize(attributes: :none)
135135
end
136136

@@ -149,9 +149,9 @@ class FOO < RDF::Vocabulary("http://foo/"); end
149149
context "with children" do
150150
before(:each) {
151151
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
152-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
152+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
153153
@graph << [RDF::URI.new("http://release/contributor"), RDF.type, FOO.Contributor]
154-
@graph << [RDF::URI.new("http://release/contributor"), RDF::DC.title, "bar"]
154+
@graph << [RDF::URI.new("http://release/contributor"), RDF::URI("http://purl.org/dc/terms/title"), "bar"]
155155
@graph << [RDF::URI.new("http://release/"), FOO.releaseContributor, RDF::URI.new("http://release/contributor")]
156156
}
157157
subject {serialize(attributes: :untyped)}
@@ -347,7 +347,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
347347
context "with untyped literals" do
348348
context ":attributes == :none" do
349349
subject do
350-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
350+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
351351
serialize(attributes: :none)
352352
end
353353

@@ -364,7 +364,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
364364
[:untyped, :typed].each do |opt|
365365
context ":attributes == #{opt}" do
366366
subject do
367-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
367+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
368368
serialize(attributes: opt)
369369
end
370370

@@ -381,7 +381,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
381381

382382
context "untyped without lang if attribute lang set" do
383383
subject do
384-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "de")]
384+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "de")]
385385
serialize(attributes: :untyped, :lang => "de")
386386
end
387387

@@ -398,7 +398,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
398398
context "with language" do
399399
context "property for title" do
400400
subject do
401-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "en-us")]
401+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "en-us")]
402402
serialize(attributes: :untyped, :lang => "de")
403403
end
404404

@@ -418,7 +418,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
418418

419419
context "attribute if lang is default" do
420420
subject do
421-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "de")]
421+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "de")]
422422
serialize(attributes: :untyped, :lang => "de")
423423
end
424424

@@ -435,7 +435,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
435435

436436
context "untyped as property if lang set and no default" do
437437
subject do
438-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "de")]
438+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "de")]
439439
serialize(attributes: :untyped)
440440
end
441441

@@ -454,7 +454,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
454454

455455
context "untyped as property if lang set and not default" do
456456
subject do
457-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "de")]
457+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "de")]
458458
serialize(attributes: :untyped, :lang => "en-us")
459459
end
460460

@@ -473,8 +473,8 @@ class FOO < RDF::Vocabulary("http://foo/"); end
473473

474474
context "multiple untyped attributes values through properties" do
475475
subject do
476-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "de")]
477-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :language => "en-us")]
476+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "de")]
477+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :language => "en-us")]
478478
serialize(attributes: :untyped, :lang => "en-us")
479479
end
480480

@@ -493,7 +493,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
493493

494494
context "typed node as element if :untyped" do
495495
subject do
496-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
496+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
497497
serialize(attributes: :untyped)
498498
end
499499

@@ -509,7 +509,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
509509

510510
context "typed node as attribute if :typed" do
511511
subject do
512-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
512+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
513513
serialize(attributes: :typed)
514514
end
515515

@@ -525,8 +525,8 @@ class FOO < RDF::Vocabulary("http://foo/"); end
525525

526526
context "multiple typed values through properties" do
527527
subject do
528-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
529-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, RDF::Literal.new("bar", :datatype => RDF::XSD.string)]
528+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo", :datatype => RDF::XSD.string)]
529+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("bar", :datatype => RDF::XSD.string)]
530530
serialize(attributes: :untyped)
531531
end
532532

@@ -545,7 +545,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
545545
context "with namespace" do
546546
before(:each) do
547547
@graph << [RDF::URI.new("http://release/"), RDF.type, FOO.Release]
548-
@graph << [RDF::URI.new("http://release/"), RDF::DC.title, "foo"]
548+
@graph << [RDF::URI.new("http://release/"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
549549
@graph << [RDF::URI.new("http://release/"), FOO.pred, FOO.obj]
550550
end
551551

@@ -606,7 +606,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
606606
context "with bnodes" do
607607
context "no nodeID attribute unless node is referenced as an object" do
608608
subject do
609-
@graph << [RDF::Node.new("a"), RDF::DC.title, "foo"]
609+
@graph << [RDF::Node.new("a"), RDF::URI("http://purl.org/dc/terms/title"), "foo"]
610610
serialize(attributes: :untyped, base_uri: "http://release/")
611611
end
612612

@@ -623,7 +623,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
623623
context "nodeID attribute if node is referenced as an object" do
624624
subject do
625625
bn = RDF::Node.new("a")
626-
@graph << [bn, RDF::DC.title, "foo"]
626+
@graph << [bn, RDF::URI("http://purl.org/dc/terms/title"), "foo"]
627627
@graph << [bn, RDF::OWL.sameAs, bn]
628628
serialize(attributes: :untyped, base_uri: "http://release/")
629629
end
@@ -689,7 +689,7 @@ class FOO < RDF::Vocabulary("http://foo/"); end
689689

690690
describe "illegal RDF values" do
691691
it "raises error with literal as subject" do
692-
@graph << [RDF::Literal.new("literal"), RDF::DC.title, RDF::Literal.new("foo")]
692+
@graph << [RDF::Literal.new("literal"), RDF::URI("http://purl.org/dc/terms/title"), RDF::Literal.new("foo")]
693693
expect { serialize(:validate => true) }.to raise_error(RDF::WriterError)
694694
end
695695
it "raises error with node as predicate" do

0 commit comments

Comments
 (0)