File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class Reader < RDF::Reader
9292
9393 # LANGTAG is deprecated
9494 LANGTAG = LANG_DIR
95- RDF_VERSION = /VERSION/ . freeze
95+ RDF_VERSION = /\A \s * VERSION/ . freeze
9696
9797 ##
9898 # Reconstructs an RDF value from its serialized N-Triples
Original file line number Diff line number Diff line change 373373 tt = reader . parse_literal ( "<<(<https://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self>)>>" )
374374 expect ( tt ) . to be_nil
375375 end
376+ context 'should parse values containing VERSION' do
377+ let ( :predicate ) { "https://www.ica.org/standards/RiC/ontology#textualValue" }
378+ let ( :subject_uri ) { "https://repository2-onsitedemo.docuteam.ch/fcrepo/rest/mandant1/rr_test#id" }
379+
380+ it "successfully parses a literal containing the word 'VERSION'" do
381+ triple_line = "<#{ subject_uri } > <#{ predicate } > \" test_VERSION_test\" .\n "
382+ statements = [ ]
383+ reader = RDF ::NTriples ::Reader . new ( triple_line )
384+
385+ expect {
386+ reader . each_statement { |s | statements << s }
387+ } . not_to raise_error
388+
389+ expect ( statements . size ) . to eq ( 1 )
390+ expect ( statements . first . object . to_s ) . to eq ( "test_VERSION_test" )
391+ end
392+
393+ it "successfully parses a URI containing the word 'VERSION'" do
394+ uri_with_version = "https://example.org/VERSION_check"
395+ triple_line = "<#{ uri_with_version } > <#{ predicate } > \" plain_value\" .\n "
396+
397+ statements = [ ]
398+ reader = RDF ::NTriples ::Reader . new ( triple_line )
399+
400+ expect {
401+ reader . each_statement { |s | statements << s }
402+ } . not_to raise_error
403+
404+ expect ( statements . first . subject . to_s ) . to eq ( uri_with_version )
405+ end
406+ end
376407
377408 describe "literal encodings" do
378409 {
You can’t perform that action at this time.
0 commit comments