/**
  * Encodes the parameters to pass to the ISQL commands. URLEncode and replace % by %%, for
  * Virtuoso Rewrite Rules.
  *
  * @param jobConf the {@link eu.aliada.linkeddataserversetup.model.JobConfiguration} that contains
  *     the ISQL commands parameters.
  * @return true if the encoding has been carried out correctly.
  * @since 1.0
  */
 public boolean encodeParams(final JobConfiguration jobConf) {
   boolean encoded = false;
   try {
     // Remove leading/trailing slashes of URI Document section
     if (jobConf.getUriDocPart() != null) {
       uriDocPart = removeLeadingTralingSlashes(jobConf.getUriDocPart());
     } else {
       uriDocPart = "";
     }
     // Remove leading/trailing slashes of URI identifier section
     if (jobConf.getUriIdPart() != null) {
       uriIdPart = removeLeadingTralingSlashes(jobConf.getUriIdPart());
     }
     // Remove leading/trailing slashes of URI Ontology section
     if (jobConf.getUriDefPart() != null) {
       uriDefPart = removeLeadingTralingSlashes(jobConf.getUriDefPart());
     }
     // Encode dataset graphs
     graphsSelectEncoded = "";
     graphsEncoded = "";
     int subsetIndex = 0;
     for (final Iterator<Subset> iterSubsets = jobConf.getSubsets().iterator();
         iterSubsets.hasNext(); ) {
       final Subset subset = iterSubsets.next();
       final String graphSelectEncoded =
           URLEncoder.encode(" FROM <" + subset.getGraph() + ">", "UTF-8");
       String linksGraphSelectEncoded =
           URLEncoder.encode(" FROM <" + subset.getLinksGraph() + ">", "UTF-8");
       graphsSelectEncoded = graphsSelectEncoded + graphSelectEncoded + linksGraphSelectEncoded;
       String graphEncoded = "";
       if (subsetIndex == 0) {
         graphEncoded = "&graph" + URLEncoder.encode("=" + subset.getGraph(), "UTF-8");
       } else {
         graphEncoded = URLEncoder.encode("&graph=" + subset.getGraph(), "UTF-8");
       }
       final String linksGraphEncoded =
           URLEncoder.encode("&graph=" + subset.getLinksGraph(), "UTF-8");
       graphsEncoded = graphsEncoded + graphEncoded + linksGraphEncoded;
       subsetIndex++;
     }
     graphsSelectEncoded = graphsSelectEncoded.replace("%", "%%");
     graphsEncoded = graphsEncoded.replace("%", "%%");
     // Encode domain name
     domainNameEncoded = URLEncoder.encode(jobConf.getDomainName(), "UTF-8");
     domainNameEncoded = domainNameEncoded.replace("%", "%%");
     // Encode URI Identifier part
     uriIdPartEncoded = URLEncoder.encode(uriIdPart, "UTF-8");
     uriIdPartEncoded = uriIdPartEncoded.replace("%", "%%");
     // Encode Ontology URI
     ontologyEncoded = URLEncoder.encode(jobConf.getOntologyUri(), "UTF-8");
     ontologyEncoded = ontologyEncoded.replace("%", "%%");
     // Compose URI document part + URI Concept part
     if (jobConf.getUriDocPart() != null) {
       uriDocConcept = removeLeadingTralingSlashes(jobConf.getUriDocPart());
     }
     if (jobConf.getUriConceptPart() != null) {
       final String datasetConceptPart = removeLeadingTralingSlashes(jobConf.getUriConceptPart());
       if (datasetConceptPart.length() > 0) {
         if (uriDocConcept.length() > 0) {
           uriDocConcept = uriDocConcept + "/" + datasetConceptPart;
         } else {
           uriDocConcept = datasetConceptPart;
         }
       }
     }
     // Compose rules name suffix
     rulesNamesSuffix = jobConf.getDomainName().replace("http", "");
     rulesNamesSuffix = rulesNamesSuffix.replace(":", "");
     rulesNamesSuffix = rulesNamesSuffix.replace("/", "");
     rulesNamesSuffix = rulesNamesSuffix.replace(".", "");
     // Check that we have the parameter values
     if ((uriIdPart != null)
         && (uriDefPart != null)
         && (graphsEncoded.length() > 0)
         && (domainNameEncoded != null)
         && (ontologyEncoded != null)
         && (uriDocConcept != null)
         && (rulesNamesSuffix.length() > 0)) {
       if ((uriIdPart.length() > 0)
           && (uriDefPart.length() > 0)
           && (ontologyEncoded.length() > 0)
           && (uriDocConcept.length() > 0)
           && (domainNameEncoded.length() > 0)) {
         // Check that Identifier, Ontology and Document parts do not contain "/"
         if (!(uriIdPart.contains("/"))
             && !(uriDefPart.contains("/"))
             && !(uriDocPart.contains("/"))) {
           encoded = true;
         }
       }
     }
   } catch (UnsupportedEncodingException exception) {
     LOGGER.error(MessageCatalog._00038_ENCODING_ERROR, exception);
   }
   return encoded;
 }