Skip to content

Commit d78986c

Browse files
author
Thomas Johnson
authored
Merge pull request #361 from ruby-rdf/vocab-to_uri
Don't attempt to build URIs from Class names
2 parents 409854f + 8e14063 commit d78986c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/rdf/vocabulary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def imported_from
273273
#
274274
# @return [RDF::URI]
275275
def to_uri
276-
RDF::URI.intern(to_s)
276+
RDF::URI.intern(@@uris[self].to_s)
277277
end
278278

279279
# For IRI compatibility

spec/vocabulary_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,14 @@
357357
end
358358
end
359359

360+
context 'without a uri' do
361+
let!(:vocab) { @vocab ||= RDF::Vocabulary.from_graph(graph) }
362+
363+
it "gives a null relative uri" do
364+
expect(vocab.to_uri).to eq RDF::URI.new(nil)
365+
end
366+
end
367+
360368
context "with existing Vocabulary" do
361369
let!(:nt) {%{
362370
<http://example/Klass> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .

0 commit comments

Comments
 (0)