public void DumpNative() { try { var mapping = StorageWrapper.Mapping; using (var connection = new SqlConnection(StorageWrapper.ConnectionString)) using (var processor = new W3CR2RMLProcessor(connection)) using (var turtleWriter = new TurtleRdfWriter(Response.OutputStream)) { Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Buffer = false; Response.BufferOutput = false; Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Type", "application/octet-stream"); Response.AppendHeader("Content-Disposition", "attachment; filename=Dump.ttl"); Response.Flush(); processor.GenerateTriples(mapping, turtleWriter); } } catch (Exception) { Response.StatusCode = 500; Response.Write("Dump creation failed"); } }
public ResponseWriterHelper(HttpResponseBase response, XmlSparqlWriter sparqlWriter, string sparqlContentType, TurtleRdfWriter rdfWriter, string rdfContentType) { _response = response; _sparqlWriter = sparqlWriter; _sparqlContentType = sparqlContentType; _rdfWriter = rdfWriter; _rdfContentType = rdfContentType; _start = true; }
private void Query_Internal(string query) { try { using (var turtleWriter = new TurtleRdfWriter(Response.OutputStream)) using (var xmlWriter = new XmlSparqlWriter(Response.OutputStream)) { var responseWriterHelper = new ResponseWriterHelper(Response, xmlWriter, "application/xml", turtleWriter, "application/turtle"); StorageWrapper.Storage.Query(responseWriterHelper, responseWriterHelper, query); } } catch (Exception ex) { Response.StatusCode = 400; Response.Write("Query failed"); } }