diff --git a/src/main/java/widoco/Constants.java b/src/main/java/widoco/Constants.java index 0f51727..26beb12 100644 --- a/src/main/java/widoco/Constants.java +++ b/src/main/java/widoco/Constants.java @@ -814,6 +814,8 @@ public static String getHeadSection(Configuration c, Properties l) { + "\"Visualize" + "\n"; } + //add commented a reference in case the evaluation is to be included + head+=""; if (!"".equals(c.getMainOntology().getCiteAs()) && c.getMainOntology().getCiteAs() != null) { head += "
" + l.getProperty(LANG_CITE_AS) + "
\n
" + c.getMainOntology().getCiteAs() + "
\n"; } diff --git a/src/main/java/widoco/CreateOOPSEvalInThread.java b/src/main/java/widoco/CreateOOPSEvalInThread.java index f8a13ee..22bfdef 100644 --- a/src/main/java/widoco/CreateOOPSEvalInThread.java +++ b/src/main/java/widoco/CreateOOPSEvalInThread.java @@ -19,6 +19,11 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,29 +84,42 @@ public void run() { br.close(); } if (content != null && !content.equals("")) { - File evalFolder = new File(c.getDocumentationURI() + File.separator + "OOPSevaluation"); - // for the css etc. - File evalResourcesFolder = new File(evalFolder.getAbsolutePath() + File.separator + "evaluation"); - if (!evalFolder.exists()) - evalFolder.mkdir(); - evalResourcesFolder.mkdir(); - // CreateResources.copyResourceFolder(TextConstants.oopsResources, - // evalResourcesFolder.getAbsolutePath()); - WidocoUtils.unZipIt(Constants.OOPS_RESOURCES, evalResourcesFolder.getAbsolutePath()); - eval = new OOPSevaluation("", content); - // eval = new OOPSevaluation(c.getMainOntology().getNamespaceURI(),""); - evaluation = eval.printEvaluation(); - // SAVE File - if (showGui) { - this.pointerToMain.switchState("savingResponse"); - } - logger.info("Saving response..."); - CreateResources.saveDocument(evalFolder.getAbsolutePath() + File.separator + "oopsEval.html", - Constants.getEvaluationText(evaluation, c), c); - if (showGui) { - pointerToMain.openBrowser( - new File(evalFolder.getAbsolutePath() + File.separator + "oopsEval.html").toURI()); - } + String pathOut = c.getDocumentationURI(); + if (!c.getMainOntology().isHashOntology()) { + pathOut += File.separator + "doc"; + } + File evalFolder = new File(pathOut + File.separator + "OOPSevaluation"); + // for the css etc. + File evalResourcesFolder = new File(evalFolder.getAbsolutePath() + File.separator + "evaluation"); + if (!evalFolder.exists()) + evalFolder.mkdir(); + evalResourcesFolder.mkdir(); + // CreateResources.copyResourceFolder(TextConstants.oopsResources, + // evalResourcesFolder.getAbsolutePath()); + WidocoUtils.unZipIt(Constants.OOPS_RESOURCES, evalResourcesFolder.getAbsolutePath()); + eval = new OOPSevaluation("", content); + // eval = new OOPSevaluation(c.getMainOntology().getNamespaceURI(),""); + evaluation = eval.printEvaluation(); + // SAVE File + if (showGui) { + this.pointerToMain.switchState("savingResponse"); + } + logger.info("Saving response..."); + CreateResources.saveDocument(evalFolder.getAbsolutePath() + File.separator + "oopsEval.html", + Constants.getEvaluationText(evaluation, c), c); + //edit html file with the right pointer to the evaluation. For all languages + for (String lang: c.getLanguagesToGenerateDoc()){ + Path path = Paths.get(pathOut+File.separator+"index-"+lang+".html"); + Charset charset = StandardCharsets.UTF_8; + String htmlContent = new String(Files.readAllBytes(path), charset); + content = htmlContent.replace("", + "
Evaluation:
\"Evaluate
"); + Files.write(path, content.getBytes(charset)); + } + if (showGui) { + pointerToMain.openBrowser( + new File(evalFolder.getAbsolutePath() + File.separator + "oopsEval.html").toURI()); + } } else { throw new Exception("OOPS server did not return an evaluation report"); } diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java index ae81abc..bb25b36 100644 --- a/src/main/java/widoco/CreateResources.java +++ b/src/main/java/widoco/CreateResources.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.ArrayList; @@ -31,14 +30,12 @@ import javax.swing.JOptionPane; import lode.LODEGeneration; import org.apache.log4j.Logger; -import org.semanticweb.owlapi.formats.N3DocumentFormat; import org.semanticweb.owlapi.formats.NTriplesDocumentFormat; import org.semanticweb.owlapi.formats.RDFJsonLDDocumentFormat; import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; import org.semanticweb.owlapi.formats.TurtleDocumentFormat; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyManager; -import static widoco.Constants.LANG_NS; import widoco.entities.Agent; import widoco.entities.Ontology;