コード例 #1
0
        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");
            }
        }
コード例 #2
0
 public ResponseWriterHelper(HttpResponseBase response, XmlSparqlWriter sparqlWriter, string sparqlContentType, TurtleRdfWriter rdfWriter, string rdfContentType)
 {
     _response          = response;
     _sparqlWriter      = sparqlWriter;
     _sparqlContentType = sparqlContentType;
     _rdfWriter         = rdfWriter;
     _rdfContentType    = rdfContentType;
     _start             = true;
 }
コード例 #3
0
 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");
     }
 }