use of org.apache.jena.riot.system.StreamRDF in project jena by apache.
the class NTriplesWriter method write.
@Override
public void write(OutputStream out, Graph graph, PrefixMap prefixMap, String baseURI, Context context) {
Iterator<Triple> iter = graph.find(null, null, null);
if (charSpace == UTF8)
write(out, iter);
else {
StreamRDF s = new WriterStreamRDFPlain(IO.wrapASCII(out), ASCII);
write$(s, iter);
}
}
use of org.apache.jena.riot.system.StreamRDF in project jena by apache.
the class NTriplesWriter method write.
public static void write(OutputStream out, Iterator<Triple> iter, CharSpace charSpace) {
StreamRDF s = StreamRDFLib.writer(out, charSpace);
write$(s, iter);
}
use of org.apache.jena.riot.system.StreamRDF in project jena by apache.
the class TurtleWriterFlat method output.
@Override
protected void output(IndentedWriter out, Graph graph, PrefixMap prefixMap, String baseURI, Context context) {
StreamRDF dest = new WriterStreamRDFFlat(out);
dest.start();
dest.base(baseURI);
StreamOps.sendGraphToStream(graph, dest, prefixMap);
dest.finish();
}
use of org.apache.jena.riot.system.StreamRDF in project jena by apache.
the class TriGWriterBlocks method output.
@Override
protected void output(IndentedWriter iOut, DatasetGraph dsg, PrefixMap prefixMap, String baseURI, Context context) {
StreamRDF dest = new WriterStreamRDFBlocks(iOut);
dest.start();
dest.base(baseURI);
StreamOps.sendDatasetToStream(dsg, dest, prefixMap);
dest.finish();
}
use of org.apache.jena.riot.system.StreamRDF in project jena by apache.
the class REST_Quads_RW method doPutPostTxn.
private void doPutPostTxn(HttpAction action, boolean clearFirst) {
UploadDetails details = null;
action.beginWrite();
try {
DatasetGraph dsg = action.getActiveDSG();
if (clearFirst)
dsg.clear();
StreamRDF dest = StreamRDFLib.dataset(dsg);
details = Upload.incomingData(action, dest);
action.commit();
ServletOps.success(action);
} catch (RiotException ex) {
// Parse error
action.abort();
ServletOps.errorBadRequest(ex.getMessage());
} catch (ActionErrorException ex) {
action.abort();
throw ex;
} catch (Exception ex) {
// Something else went wrong. Backout.
action.abort();
ServletOps.errorOccurred(ex.getMessage());
} finally {
action.endWrite();
}
ServletOps.uploadResponse(action, details);
}
Aggregations