0

During reading a large turtle file with the following code using Jena, I got the error org.apache.jena.riot.RiotException: [line: NUM, col: NUM] illegal escape sequence value and the code stopped.

Model model = ModelFactory.createDefaultModel();
try {
    InputStream in = FileManager.get().open("FILE.ttl");
    model.read(in, null, "TTL");
} catch (Exception e) {
    e.printStackTrace();
}

I can resolve the error by replacing the line with the correct one. But I would like to skip and ignore the line, if it has a problem. Is it possible?

Benben
  • 1,355
  • 5
  • 18
  • 31
  • 2
    Turtle isn't line based, so skipping a line isn't really an option, in general. Eg, if `:foo` is one line and `:p :bar .` is the next, you couldn't skip either one without doing something about the other. – Joshua Taylor Aug 15 '16 at 01:22
  • 1
    The best option is probably to preprocess the file and turn the not-actually-Turtle file into a Turtle file. – Joshua Taylor Aug 15 '16 at 01:23

0 Answers0