Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdf/ntriples/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Reader < RDF::Reader

# LANGTAG is deprecated
LANGTAG = LANG_DIR
RDF_VERSION = /VERSION/.freeze
RDF_VERSION = /\A\s*VERSION/.freeze

##
# Reconstructs an RDF value from its serialized N-Triples
Expand Down
31 changes: 31 additions & 0 deletions spec/ntriples_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,37 @@
tt = reader.parse_literal("<<(<https://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self>)>>")
expect(tt).to be_nil
end
context 'should parse values containing VERSION' do
let(:predicate) { "https://www.ica.org/standards/RiC/ontology#textualValue" }
let(:subject_uri) { "https://repository2-onsitedemo.docuteam.ch/fcrepo/rest/mandant1/rr_test#id" }

it "successfully parses a literal containing the word 'VERSION'" do
triple_line = "<#{subject_uri}> <#{predicate}> \"test_VERSION_test\" .\n"
statements = []
reader = RDF::NTriples::Reader.new(triple_line)

expect {
reader.each_statement { |s| statements << s }
}.not_to raise_error

expect(statements.size).to eq(1)
expect(statements.first.object.to_s).to eq("test_VERSION_test")
end

it "successfully parses a URI containing the word 'VERSION'" do
uri_with_version = "https://example.org/VERSION_check"
triple_line = "<#{uri_with_version}> <#{predicate}> \"plain_value\" .\n"

statements = []
reader = RDF::NTriples::Reader.new(triple_line)

expect {
reader.each_statement { |s| statements << s }
}.not_to raise_error

expect(statements.first.subject.to_s).to eq(uri_with_version)
end
end

describe "literal encodings" do
{
Expand Down
Loading