Hi all,

It seems that BIO does not work with some payload. I am trying to
serialize/deserialize (with BIO) the node values of a quad which is
parsed by a NQuads parser but I get:

Exception in thread "main" org.openjena.riot.RiotException: [line: 2,
col: 15] Too many items in a line.  Expected 1
        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.exceptionDirect(LangEngine.java:150)
        at org.openjena.riot.lang.LangEngine.exception(LangEngine.java:143)
        at 
com.hp.hpl.jena.sparql.engine.binding.BindingInputStream.access$400(BindingInputStream.java:70)
        at 
com.hp.hpl.jena.sparql.engine.binding.BindingInputStream$IteratorTuples.moveToNext(BindingInputStream.java:180)
        at 
com.hp.hpl.jena.sparql.engine.binding.BindingInputStream$IteratorTuples.moveToNext(BindingInputStream.java:139)
        at 
org.openjena.atlas.iterator.IteratorSlotted.hasNext(IteratorSlotted.java:55)
        at 
org.openjena.atlas.iterator.IteratorSlotted.next(IteratorSlotted.java:64)
        at 
com.hp.hpl.jena.sparql.engine.binding.BindingInputStream.next(BindingInputStream.java:129)

The quadruple is correctly parsed but the deserialization fails.
Hereunder is a test case:

        final List<Quad> quadruples = new ArrayList<Quad>();

        Sink<Quad> sink = new Sink<Quad>() {
            @Override
            public void send(final Quad quad) {
                quadruples.add(quad);
            }

            @Override
            public void close() {
            }

            @Override
            public void flush() {
            }
        };

        FileInputStream fis = null;

        LangRIOT parser = null;
        try {
            fis = new FileInputStream("/path/to/nquads-test1");
            parser = RiotReader.createParserNQuads(fis, sink);
            parser.parse();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        Quad q = quadruples.get(0);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        Binding b = BindingFactory.create();
        // b.add(Var.alloc("g"), q.getGraph());
        // b.add(Var.alloc("s"), q.getSubject());
        // b.add(Var.alloc("p"), q.getPredicate());
        b.add(Var.alloc("o"), q.getObject());

        BindingOutputStream bos = new BindingOutputStream(baos);
        bos.write(b);
        bos.close();

        BindingInputStream bis =
                new BindingInputStream(new ByteArrayInputStream(
                        baos.toByteArray()));

        System.out.println(bis.next());


The file nquads-test1 is available from:

http://commondatastorage.googleapis.com/nquads/nquads-test1

It seems that BIO does not like the object value of the quadruple
which is contained by nquads-test1. However this value seems correct.

Any idea?

Kind Regards,
Laurent

Reply via email to