marklogic / marklogic-jena

Adapter for using MarkLogic with the Jena RDF Framework
Other
5 stars 11 forks source link

RDFDataMgr.write(out, dsg, Lang.NTRIPLES) throws RIOTException #16

Closed grechaw closed 9 years ago

grechaw commented 9 years ago

In creating an example for writing to a stream from MarkLogic, I found that we did not implement and register a code path to enable streaming via RIOT, jena's I/O subsystem.

Here's the exception:

write the entire database to System.out
Exception in thread "main" org.apache.jena.riot.RiotException: No dataset writer for N-Triples/utf-8
    at org.apache.jena.riot.RDFDataMgr.createDatasetWriter$(RDFDataMgr.java:1312)
    at org.apache.jena.riot.RDFDataMgr.write$(RDFDataMgr.java:1330)
    at org.apache.jena.riot.RDFDataMgr.write(RDFDataMgr.java:1205)
    at org.apache.jena.riot.RDFDataMgr.write(RDFDataMgr.java:1195)
    at org.apache.jena.riot.RDFDataMgr.write(RDFDataMgr.java:1141)
    at com.marklogic.jena.examples.RIOTExamples.run(RIOTExamples.java:47)
    at com.marklogic.jena.examples.RIOTExamples.main(RIOTExamples.java:52)
15:52:45.253 [Timer-0] DEBUG c.m.s.j.c.WriteCacheTimerTask - Cache stale, flushing

Which points straight to the missing implementation in RdfDataMgr

private static WriterDatasetRIOT createDatasetWriter$(RDFFormat serialization)
    {
        WriterDatasetRIOTFactory wf = RDFWriterRegistry.getWriterDatasetFactory(serialization) ;
        if ( wf == null )
            throw new RiotException("No dataset writer for "+serialization) ; 
        return wf.create(serialization) ;
    }
grechaw commented 9 years ago

This was not a bug. functionality works with proper output tyupes. this example needs quads.