/**
   * Create the dataset defult HTML page.
   *
   * @param jobConf the {@link eu.aliada.linkeddataserversetup.model.JobConfiguration} that contains
   *     information to create the dataset HTML page.
   * @param db The DDBB connection.
   * @return
   * @since 2.0
   */
  public void createDatasetDefaultPage(
      final JobConfiguration jobConf, final DBConnectionManager dbConn) {
    // Create the folder where the page resides, if it does not exist
    final String pageFolder = jobConf.getVirtHttpServRoot() + File.separator + rulesNamesSuffix;
    final String pageURL = "http://" + jobConf.getDomainName();
    final File fFolder = new File(pageFolder);
    if (!fFolder.exists()) {
      fFolder.mkdir();
    }
    // Update the dataset web page root in the DB
    dbConn.updateDatasetWebPageRoot(jobConf.getDatasetId(), pageFolder);

    final String pagePath = pageFolder + File.separator + DATASET_INDEX_PAGE;
    // Remove the page if it already exists
    final File fPage = new File(pagePath);
    if (fPage.exists()) {
      fPage.delete();
    }

    // Copy image and CSS files to web server folder
    copyFilesToWebServerPath(jobConf, pageFolder, pageURL);
    final String orgLogoPath = jobConf.getOrgImageURL();
    final String styleSheetPath = jobConf.getCssFileURL();
    // Get the number of triples of the dataset
    final int numTriples =
        calculateDatasetNumTriples(
            jobConf.getSparqlEndpointUri(),
            jobConf.getSparqlLogin(),
            jobConf.getSparqlPassword(),
            jobConf.getSubsets());
    // Now, create a new one
    try {
      final FileWriter fstream = new FileWriter(pagePath);
      final BufferedWriter out = new BufferedWriter(fstream);
      String line =
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
      out.write(line);
      out.newLine();
      line = "<html>";
      out.write(line);
      out.newLine();
      line = "<head>";
      out.write(line);
      out.newLine();
      line = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";
      out.write(line);
      out.newLine();
      line = "<title>" + jobConf.getDatasetDesc().toUpperCase() + "</title>";
      out.write(line);
      out.newLine();
      line = "<link rel=\"stylesheet\" href=\"" + styleSheetPath + "\" type=\"text/css\">";
      out.write(line);
      out.newLine();
      line = "</head>";
      out.write(line);
      out.newLine();
      line = "<body>";
      out.write(line);
      out.newLine();
      line = "<img src=\"" + orgLogoPath + "\">";
      out.write(line);
      out.newLine();
      line = "<h1>" + jobConf.getDatasetDesc() + "</h1>";
      out.write(line);
      out.newLine();
      line = "<table><colgroup><col width=\"25%\"><col width=\"75%\"></colgroup>";
      out.write(line);
      out.newLine();
      // Description
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\">%s</td></tr>",
              "description", jobConf.getDatasetLongDesc());
      out.write(line);
      out.newLine();
      // Publisher
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\">%s</td></tr>",
              "publisher", jobConf.getOrgName().toUpperCase());
      out.write(line);
      out.newLine();
      // Source URL
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\"><a href=\"%s\" target=\"_blank\">%s</a></td></tr>",
              "source", jobConf.getDatasetSourceURL(), jobConf.getDatasetSourceURL());
      out.write(line);
      out.newLine();
      // Created
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\">%s</td></tr>",
              "created", getStringNow());
      out.write(line);
      out.newLine();
      // Contributor
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\">%s</td></tr>",
              "contributor", jobConf.getDatasetAuthor());
      out.write(line);
      out.newLine();
      // License URL
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\"><a href=\"%s\" target=\"_blank\">%s</a></td></tr>",
              "license", jobConf.getLicenseURL(), jobConf.getLicenseURL());
      out.write(line);
      out.newLine();
      // SPARQL endpoint URL
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\"><a href=\"%s\" target=\"_blank\">%s</a></td></tr>",
              "SPARQL endpoint",
              jobConf.getPublicSparqlEndpointUri(),
              jobConf.getPublicSparqlEndpointUri());
      out.write(line);
      out.newLine();
      // Vocabulary URL
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\"><a href=\"%s\" target=\"_blank\">%s</a></td></tr>",
              "vocabulary", jobConf.getOntologyUri(), jobConf.getOntologyUri());
      out.write(line);
      out.newLine();
      // Number of triples
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\">%s</td></tr>",
              "number of triples", numTriples);
      out.write(line);
      out.newLine();
      // List resources of dataset
      final String datasetUri = "http://" + jobConf.getDomainName() + "/" + uriDocConcept;
      line =
          String.format(
              "<tr><td class=\"label\">%s</td><td class=\"input\"><a href=\"%s\" target=\"_blank\">%s</a></td></tr>",
              "list of resources", datasetUri, datasetUri);
      out.write(line);
      out.newLine();
      // List subsets
      line = String.format("<tr><td class=\"label\">%s</td><td class=\"input\"><ul>", "subsets");
      out.write(line);
      out.newLine();
      for (final Iterator<Subset> iterSubsets = jobConf.getSubsets().iterator();
          iterSubsets.hasNext(); ) {
        final Subset subset = iterSubsets.next();
        String uriDocConceptSubset = "";
        if (subset.getUriConceptPart() != null) {
          uriDocConceptSubset = removeLeadingTralingSlashes(subset.getUriConceptPart());
        }
        if (uriDocConceptSubset.length() > 0) {
          // List resources of subset
          final String subsetUri = datasetUri + "/" + uriDocConceptSubset;
          line =
              String.format(
                  "<li>%s: <a href=\"%s\" target=\"_blank\">%s</a></li>",
                  subset.getDescription(), subsetUri, subsetUri);
          out.write(line);
          out.newLine();
        }
      }
      line = "</ul></td></tr>";
      out.write(line);
      out.newLine();
      line = "</table>";
      out.write(line);
      out.newLine();

      line = "</body>";
      out.write(line);
      out.newLine();
      line = "</html>";
      out.write(line);
      out.newLine();
      out.close();
    } catch (IOException exception) {
      LOGGER.error(MessageCatalog._00034_FILE_CREATION_FAILURE, exception, pagePath);
    }
  }