示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SourcesStore"/> class.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <param name="config">The configuration</param>
        public SourcesStore(IDbConnection connection, IWikibusConfiguration config)
        {
            this.config = config;
            var processor = new W3CR2RMLProcessor(connection);

            processor.GenerateTriples(new WikibusR2RML(config), this);
        }
        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");
            }
        }