<commit_before>module Opendata::Agents::Nodes::Sparql
  class ViewController < ApplicationController
    include Cms::NodeFilter::View

    public
      def index
        return render if params[:query].blank?

        file_format = params[:format]
        result = Opendata::Sparql.select(params[:query], file_format)

        if file_format == "HTML"
          html_page = result[:data]
          html_page = html_page.gsub(/<table class="sparql">/, "<table class='sparql' border='1'>")

          @cur_node.layout_id = nil
          headers["Content-Type"] = "text/html; charset='Shift_JIS'"
          send_data html_page, type: result[:type], disposition: :inline
        else
          send_data result[:data], type: result[:type], filename: "sparql.#{result[:ext]}",
            disposition: :attachment
        end

      end

      def query
        render
      end

  end
end
<commit_msg>add: process used in no data condition<commit_after>module Opendata::Agents::Nodes::Sparql
  class ViewController < ApplicationController
    include Cms::NodeFilter::View

    public
      def index
        return render if params[:query].blank?

        file_format = params[:format]
        result = Opendata::Sparql.select(params[:query], file_format)

        if file_format == "HTML"
          html_page = result[:data]
          if html_page.include?("<td>")
            html_page = html_page.gsub(/<table class="sparql">/, "<table class='sparql' border='1'>")
          else
            html_page = "<h1>No Data</h1>"
          end

          @cur_node.layout_id = nil
          headers["Content-Type"] = "text/html; charset='Shift_JIS'"
          send_data html_page, type: result[:type], disposition: :inline
        else
          send_data result[:data], type: result[:type], filename: "sparql.#{result[:ext]}",
            disposition: :attachment
        end

      end

      def query
        render
      end

  end
end

{'fraction_non_alphanumeric': 0.12144702842377261, 'fraction_numerical': 0.0020671834625322996, 'mean_word_length': 2.5009041591320074, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6271288', 'n_tokens_mistral': 572, 'n_tokens_neox': 556, 'n_words': 129}