<commit_before>/*! @license ©2014 <NAME> - Multimedia Lab / iMinds / Ghent University */
/** Initializes the LDF client and its fragment and query picker. */

jQuery(function ($) {
  var logger = new ldf.Logger();
  var $query = $('.query').focus(), $start = $('.execute'), $stop = $('.stop'),
      $startFragments = $('.startFragments'), $queries = $('.queries'),
      $results = $('.results'), $log = $('.log');
  var sparqlIterator;



/* * * * *
             QUERY EXECUTION AND RESULT DISPLAY
                                                  * * * * */

  // Execute the query when the button is clicked
  $start.click(function () {
    // Clear results and log, and scroll page to the results
    $('html,body').animate({ scrollTop: $start.offset().top });
    $log.empty();
    $results.empty();
    $start.hide();
    $stop.show();

    // Create a client to fetch the fragments through HTTP
    var config = { prefixes: prefixes, logger: logger };
    config.fragmentsClient = new ldf.FragmentsClient($startFragments.val(), config);

    // Create the iterator to solve the query
    try { sparqlIterator = new ldf.SparqlIterator($query.val(), config); }
    catch (error) { return stopExecution(error); }
    sparqlIterator.on('end', stopExecution);
    sparqlIterator.on('error', stopExecution);

    // Read the iterator's results, and write them depending on the query type
    switch (sparqlIterator.queryType) {
      // For SELECT queries, write a JSON array representation of the rows
      case 'SELECT':
        sparqlIterator.on('data', function (row) {
          appendText($results, $.map(row, function (value, variable) {
            return variable + ': ' + value;
          }).join('\n'), '\n\n');
        });
      break;
      // For CONSTRUCT queries, write a Turtle representation of all results
      case 'CONSTRUCT':
        var writer = new N3.Writer({ write: function (chunk, encoding, done) {
          appendText($results, chunk), done && done();
        }}, config.prefixes);
        sparqlIterator.on('data', function (triple) { writer.addTriple(triple); })<commit_msg>Add notification if there are no results.<commit_after>/*! @license ©2014 <NAME> - Multimedia Lab / iMinds / Ghent University */
/** Initializes the LDF client and its fragment and query picker. */

jQuery(function ($) {
  var logger = new ldf.Logger();
  var $query = $('.query').focus(), $start = $('.execute'), $stop = $('.stop'),
      $startFragments = $('.startFragments'), $queries = $('.queries'),
      $results = $('.results'), $log = $('.log');
  var sparqlIterator;



/* * * * *
             QUERY EXECUTION AND RESULT DISPLAY
                                                  * * * * */

  // Execute the query when the button is clicked
  $start.click(function () {
    // Clear results and log, and scroll page to the results
    $('html,body').animate({ scrollTop: $start.offset().top });
    $log.empty();
    $results.empty();
    $start.hide();
    $stop.show();

    // Create a client to fetch the fragments through HTTP
    var config = { prefixes: prefixes, logger: logger };
    config.fragmentsClient = new ldf.FragmentsClient($startFragments.val(), config);

    // Create the iterator to solve the query
    try { sparqlIterator = new ldf.SparqlIterator($query.val(), config); }
    catch (error) { return stopExecution(error); }
    sparqlIterator.on('end', stopExecution);
    sparqlIterator.on('error', stopExecution);

    // Read the iterator's results, and write them depending on the query type
    switch (sparqlIterator.queryType) {
      // For SELECT queries, write a JSON array representation of the rows
      case 'SELECT':
        var resultCount = 0;
        sparqlIterator.on('data', function (row) {
          resultCount++;
          appendText($results, $.map(row, function (value, variable) {
            return variable + ': ' + value;
          }).join('\n'), '\n\n');
        });
        sparqlIterator.on('end', function () {
          resultCount || appendText($results, '(This query has no results.)');
        });
      break;
      // For CONSTRUCT queries, write a Turtle representation of all results
      case 'CONSTRUCT':
        var writer = new N3.Writer({ write: function (chunk, encoding, done) {
          appendText($results, chunk), done && done();
        }}, config.prefixes);
        sparqlIterator.on('data', function (triple) { writer.addTriple(triple); })
{'fraction_non_alphanumeric': 0.14977477477477477, 'fraction_numerical': 0.0024774774774774773, 'mean_word_length': 2.676324503311258, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '728031', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1223, 'n_words': 383}