Skip to content

Commit

Permalink
Merge pull request #371 from dgarijo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dgarijo authored Jan 12, 2020
2 parents bf1c138 + 120aeb4 commit 23bced8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
2 changes: 2 additions & 0 deletions src/main/java/widoco/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ public static String getHeadSection(Configuration c, Properties l) {
+ "<a href=\"webvowl/index.html#\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Visualize_with-WebVowl-blue.svg\" alt=\"Visualize with WebVowl\" /></a>"
+ "</dd>\n";
}
//add commented a reference in case the evaluation is to be included
head+="<!-- <dt>Evaluation:</dt><dd><a href=\"OOPSEvaluation/OOPSeval.html#\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Evaluate_with-OOPS! (OntOlogy Pitfall Scanner!)-blue.svg\" alt=\"Evaluate with OOPS!\" /></a></dd> -->";
if (!"".equals(c.getMainOntology().getCiteAs()) && c.getMainOntology().getCiteAs() != null) {
head += "<dt>" + l.getProperty(LANG_CITE_AS) + "</dt>\n<dd>" + c.getMainOntology().getCiteAs() + "</dd>\n";
}
Expand Down
64 changes: 41 additions & 23 deletions src/main/java/widoco/CreateOOPSEvalInThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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("<!-- <dt>Evaluation:</dt><dd><a href=\"OOPSEvaluation/OOPSeval.html#\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Evaluate_with-OOPS! (OntOlogy Pitfall Scanner!)-blue.svg\" alt=\"Evaluate with OOPS!\" /></a></dd> -->",
"<dt>Evaluation:</dt><dd><a href=\"OOPSEvaluation/OOPSeval.html#\" target=\"_blank\"><img src=\"https://img.shields.io/badge/Evaluate_with-OOPS! (OntOlogy Pitfall Scanner!)-blue.svg\" alt=\"Evaluate with OOPS!\" /></a></dd>");
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");
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/widoco/CreateResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 23bced8

Please sign in to comment.