Hi all,
I am trying to parse a N-Quads file by using the following code:
static int line = 0;
public static void main(String[] args) {
Sink<Quad> sink = new Sink<Quad>() {
@Override
public void send(final Quad quad) {
log.info("line=" + line + ", quad=" + quad);
line++;
}
@Override
public void close() {
}
@Override
public void flush() {
}
};
FileInputStream fis = null;
LangRIOT parser = null;
try {
fis = new FileInputStream("/absolute/path/to/nquads-chunk");
parser = RiotReader.createParserNQuads(fis, sink);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
parser.parse();
}
the file nquads-chun is available from:
http://commondatastorage.googleapis.com/nquads/nquads-chunk
When I run the parser, I get:
Exception in thread "main" org.openjena.riot.RiotException: [line:
574, col: 62] Bad input stream
at
org.openjena.riot.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:110)
at org.openjena.riot.lang.LangEngine.raiseException(LangEngine.java:157)
at org.openjena.riot.lang.LangEngine.nextToken(LangEngine.java:104)
at org.openjena.riot.lang.LangNQuads.parseOne(LangNQuads.java:62)
at org.openjena.riot.lang.LangNQuads.parseOne(LangNQuads.java:22)
at org.openjena.riot.lang.LangNTuple.runParser(LangNTuple.java:58)
at org.openjena.riot.lang.LangBase.parse(LangBase.java:42)
where line 574 seems to be:
<http://my.opera.com/carlOS%20X/xml/foaf#me>
<http://xmlns.com/foaf/0.1/knows>
<http://my.opera.com/allegro_noise/xml/foaf#me>
<http://my.opera.com/carlOS%20X/xml/foaf> .
which seems to respect the NQuads syntax correctly? any idea?
Kind Regards,
Laurent