|
|
|
@ -25,10 +25,12 @@ impl<R: Read> Iterator for NTriplesIterator<R> { |
|
|
|
|
type Item = Result<Triple>; |
|
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Result<Triple>> { |
|
|
|
|
match self.reader.read_line(&mut self.buffer) { |
|
|
|
|
Ok(line_count) => if line_count == 0 { |
|
|
|
|
None |
|
|
|
|
} else { |
|
|
|
|
if let Err(error) = self.reader.read_line(&mut self.buffer) { |
|
|
|
|
return Some(Err(error.into())); |
|
|
|
|
} |
|
|
|
|
if self.buffer.is_empty() { |
|
|
|
|
return None; //End of file
|
|
|
|
|
} |
|
|
|
|
let result = grammar::triple(&self.buffer, &mut self.bnodes_map); |
|
|
|
|
self.buffer.clear(); |
|
|
|
|
match result { |
|
|
|
@ -36,9 +38,6 @@ impl<R: Read> Iterator for NTriplesIterator<R> { |
|
|
|
|
Ok(None) => self.next(), |
|
|
|
|
Err(error) => Some(Err(error.into())), |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
Err(error) => Some(Err(error.into())), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|