File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -230,7 +230,9 @@ def read_triple
230230 if validate? && !read_eos
231231 log_error ( "Expected end of statement (found: #{ current_line . inspect } )" , lineno : lineno , exception : RDF ::ReaderError )
232232 end
233- return [ subject , predicate , object ]
233+ spo = [ subject , predicate , object ]
234+ # Only return valid triples if validating
235+ return spo if !validate? || spo . all? ( &:valid? )
234236 end
235237 rescue RDF ::ReaderError => e
236238 @line = line # this allows #read_value to work
Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ def each_statement(&block)
444444 begin
445445 loop do
446446 st = read_statement
447- block . call ( st )
447+ block . call ( st ) unless st . nil?
448448 end
449449 rescue EOFError
450450 rewind rescue nil
@@ -481,7 +481,7 @@ def each_triple(&block)
481481 begin
482482 loop do
483483 triple = read_triple
484- block . call ( *triple )
484+ block . call ( *triple ) unless triple . nil?
485485 end
486486 rescue EOFError
487487 rewind rescue nil
You can’t perform that action at this time.
0 commit comments