diff --git a/README.md b/README.md
index 90213eb..f99b989 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,8 @@ java -jar ar2dtool.jar -i PathToInputRdfFile -o FileToOutputFile -t OutputFileTy
- [-d] optional flag for debugging.
+- [-tmp]: option flag to specify the temp folder.
+
AR2DTool Java API
===============
@@ -87,6 +89,12 @@ These are the list parameters that can be defined:
Two sample configuration files are available in the /samples folder. One creates and ER diagram of the ontology. The other one depicts the taxonomy of the classes.
+## Contribution
+### To compile and generate the JAR (LINUX)
+1. `cd mavenProject`
+2. `mvn compile; mvn install`
+3. The jar will generated in `mavenProject/target`
+
Acknowledgements
===============
diff --git a/mavenProject/pom.xml b/mavenProject/pom.xml
index a6c3d82..faedfe5 100644
--- a/mavenProject/pom.xml
+++ b/mavenProject/pom.xml
@@ -4,7 +4,7 @@
es.upm.oeg
ar2dtool
- 0.2.0
+ 1.3.0
jar
ar2dtool
diff --git a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/Main.java b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/Main.java
index a9fc48e..22352c6 100644
--- a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/Main.java
+++ b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/Main.java
@@ -15,6 +15,7 @@
import java.util.logging.Level;
+import es.upm.oeg.ar2dtool.exceptions.ConfigKeyNotFound;
import es.upm.oeg.ar2dtool.exceptions.ConfigFileNotFoundException;
import es.upm.oeg.ar2dtool.exceptions.NullTripleMember;
import es.upm.oeg.ar2dtool.exceptions.RDFInputNotValid;
@@ -44,6 +45,7 @@ public class Main {
private static boolean GENERATE_GV = false;
private static boolean GENERATE_GML = false;
private static boolean COMPILE_GV = false;
+ private static String temp_dir = "";
public static void main(String[] args) {
parseArgs(args);
@@ -58,6 +60,8 @@ public static void main(String[] args) {
if(DEBUG)
{
logLevelToSee =Level.INFO;
+ //logLevelToSee =Level.ALL;
+ dbg("now in debug \n\n\n",Level.INFO);
}
else
{
@@ -65,12 +69,15 @@ public static void main(String[] args) {
}
log.getWriter().setVisibleLogLevel(logLevelToSee);
-
log("pathToInputFile:" + pathToInputFile);
log("pathToOuputFile:" + pathToOuputFile);
log("outputFileType:" + outputFileType);
log("pathToConfFile:" + pathToConfFile);
+
+
+
+
@@ -80,6 +87,16 @@ public static void main(String[] args) {
//load config info
r2d.loadConfigValues(pathToConfFile);
+ if(temp_dir!=""){
+ log("Setting the temp dir to: "+temp_dir);
+ try{
+ r2d.getConf().setKeys("pathToTempDir",temp_dir);
+ }
+ catch(ConfigKeyNotFound e){
+ log("Exception in setting the temp dir");
+ e.printStackTrace();
+ }
+ }
//print config values
log(r2d.getConf().toString());
@@ -104,19 +121,20 @@ public static void main(String[] args) {
//get the DOTGenerator with the resultant info
DOTGenerator dg = r2d.getDOTGenerator();
-
+ log("Got Dot Generator");
//apply transformations
dg.applyTransformations();
-
+ log("Applied Transformations");
//save the DOT source to file
dg.saveSourceToFile(pathToOuputFile+".dot");
-
+ log("Saved the .dot file");
log("Generated! Path="+pathToOuputFile+".dot");
if(COMPILE_GV)
{
+ log("Getting the DOT Source");
//get source DOT code
String src = dg.generateDOTSource();
@@ -139,7 +157,7 @@ public static void main(String[] args) {
{
//get the GraphMLGenerator with the resultant info
GraphMLGenerator gg = r2d.getGraphMLGenerator();
-
+ log("Getting GML");
//apply transformations
gg.applyTransformations();
@@ -147,6 +165,7 @@ public static void main(String[] args) {
//save the GraphML source to file
gg.saveSourceToFile(pathToOuputFile+".graphml");
+ log("the Graphml is generated");
}
@@ -224,10 +243,16 @@ private static void parseArgs(String[] args) {
i++;
maxNumberOfTriples = Integer.valueOf(args[i]);
}
- else
- {
- dbg(syntaxErrorMsg,Level.WARNING);
- return;
+ else{
+ if(args[i].equals("-tmp")){
+ i++;
+ temp_dir = args[i];
+ }
+ else
+ {
+ dbg(syntaxErrorMsg,Level.WARNING);
+ return;
+ }
}
}
}
@@ -242,6 +267,7 @@ private static void parseArgs(String[] args) {
private static void log(String msg) {
log.getWriter().log(msg);
+ log.getWriter().log(msg,Level.INFO);
}
private static void dbg(String msg, Level logLevel){
diff --git a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/RDF2Diagram.java b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/RDF2Diagram.java
index 8496f89..6f7a233 100644
--- a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/RDF2Diagram.java
+++ b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/RDF2Diagram.java
@@ -369,7 +369,7 @@ private boolean includeStatement(Statement st)
*/
public boolean exceedsNumberOfTriples(int mnt)
{
- return model.listStatements().toList().size() > mnt;
+ return model.listStatements().toList().size() > mnt && mnt!=-1;
}
public ConfigValues getConf() {
diff --git a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/DOTGenerator.java b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/DOTGenerator.java
index 8434f8b..0fcc0b2 100644
--- a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/DOTGenerator.java
+++ b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/DOTGenerator.java
@@ -319,9 +319,15 @@ public int generateDOTDiagram(String dotSource, String outPath, String type)
// String repesentationType= "sfdp";
// String repesentationType= "twopi";
// String repesentationType= "circo";
-
+ log("Will try writing to file: "+outPath);
File out = new File(outPath); // Linux
- return gv.writeGraphToFile( gv.getGraph(gv.getDotSource(), type, repesentationType), out );
+ log("ask for Dot Source");
+ String dotSource1 = gv.getDotSource();
+ log("Ask for Graph from String");
+ //return gv.writeGraphToFile( gv.getGraph(gv.getDotSource(), type, repesentationType), out );
+ byte[] gvGraph = gv.getGraph(dotSource1, type, repesentationType);
+ log("Got the graph");
+ return gv.writeGraphToFile(gvGraph, out);
}
private void generateSyntObjPropertiesTriples() throws NullTripleMember
@@ -548,6 +554,7 @@ public void setModel(OntModel model) {
private void log(String msg)
{
log.getWriter().log(msg);
+ log.getWriter().log(msg, Level.INFO);
}
diff --git a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/GraphViz.java b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/GraphViz.java
index dc9188e..51ee841 100644
--- a/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/GraphViz.java
+++ b/mavenProject/src/main/java/es/upm/oeg/ar2dtool/utils/dot/GraphViz.java
@@ -219,6 +219,7 @@ public byte[] getGraph(String dot_source, String type, String representationType
byte[] img_stream = null;
try {
+ logger.getWriter().log("write dot source to file: "+dot_source, Level.INFO);
dot = writeDotSourceToFile(dot_source);
if (dot != null)
{
@@ -326,6 +327,7 @@ private File writeDotSourceToFile(String str) throws java.io.IOException
{
File temp;
try {
+ logger.getWriter().log("TEMP DIR: "+GraphViz.TEMP_DIR, Level.INFO);
temp = File.createTempFile("graph_", ".dot.tmp", new File(GraphViz.TEMP_DIR));
FileWriter fout = new FileWriter(temp);
fout.write(str);