Ejemplo n.º 1
0
        private void GenerateHtml(Dictionary <string, object> templateVariables)
        {
            try
            {
                var templateEngine = new Liquid.LiquidViewEngine();
                var assemblyPath   = Assembly.GetExecutingAssembly().Location;
                var templatePath   = Path.Combine(Path.GetDirectoryName(assemblyPath), "templates");
                templateEngine.Initialize(templatePath, _quinceStore,
                                          selectors: new List <ITemplateSelector>
                {
                    new RdfTypeTemplateSelector(new Uri("http://rdfs.org/ns/void#Dataset"), "dataset.liquid")
                });

                foreach (var resourcePath in _htmlResourceFileMapper.GetMappedPaths(_targetDirectory))
                {
                    RemoveDirectory(resourcePath);
                }

                var generator = _fileGeneratorFactory.MakeHtmlFileGenerator(_uriService, _htmlResourceFileMapper, templateEngine, _progressLog, HtmlFileGenerationReportInterval, templateVariables);

                _quinceStore.EnumerateSubjects(generator);
                _quinceStore.EnumerateObjects(generator);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Error running HTML file generation");
                throw new WorkerException(ex, "Error running HTML file generation. File generation may be incomplete.");
            }
        }
Ejemplo n.º 2
0
 private void GenerateVoidMetadata(Dictionary <string, object> templateVariables)
 {
     try
     {
         var templateEngine = new Liquid.LiquidViewEngine();
         var assemblyPath   = Assembly.GetExecutingAssembly().Location;
         var templatePath   = Path.Combine(Path.GetDirectoryName(assemblyPath), "templates");
         templateEngine.Initialize(templatePath, _quinceStore, "void.liquid");
         var voidGenerator = new VoidFileGenerator(templateEngine, _quinceStore, _repositoryUri, _progressLog, templateVariables);
         var htmlPath      = Path.Combine(_targetDirectory, "page", "index.html");
         var nquadsPath    = Path.Combine(_targetDirectory, "data", "void.nq");
         voidGenerator.GenerateVoidHtml(htmlPath);
         voidGenerator.GenerateVoidNQuads(nquadsPath);
     }
     catch (Exception ex)
     {
         Log.Error(ex, "Error running metadata file generation");
         throw new WorkerException(ex, "Error running metadata file generation. File generation may be incomplete.");
     }
 }