Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 5473887c authored by Thinh Dong's avatar Thinh Dong
Browse files

EDOAL to SPARQL renderer

parent 04af20ee
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,9 @@ import fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor; ...@@ -35,6 +35,9 @@ import fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor;
import fr.inrialpes.exmo.align.impl.ObjectAlignment; import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment; import fr.inrialpes.exmo.align.impl.URIAlignment;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
...@@ -76,7 +79,7 @@ import fr.inrialpes.exmo.align.parser.AlignmentParser; ...@@ -76,7 +79,7 @@ import fr.inrialpes.exmo.align.parser.AlignmentParser;
$Id$ $Id$
</pre> </pre>
@author Jrme Euzenat @author J�r�me Euzenat
*/ */
public class ParserPrinter { public class ParserPrinter {
...@@ -90,6 +93,7 @@ public class ParserPrinter { ...@@ -90,6 +93,7 @@ public class ParserPrinter {
Alignment result = null; Alignment result = null;
String initName = null; String initName = null;
String filename = null; String filename = null;
String dirName = null;
PrintWriter writer = null; PrintWriter writer = null;
AlignmentVisitor renderer = null; AlignmentVisitor renderer = null;
LongOpt[] longopts = new LongOpt[10]; LongOpt[] longopts = new LongOpt[10];
...@@ -110,8 +114,9 @@ public class ParserPrinter { ...@@ -110,8 +114,9 @@ public class ParserPrinter {
longopts[6] = new LongOpt("threshold", LongOpt.REQUIRED_ARGUMENT, null, 't'); longopts[6] = new LongOpt("threshold", LongOpt.REQUIRED_ARGUMENT, null, 't');
longopts[7] = new LongOpt("cutmethod", LongOpt.REQUIRED_ARGUMENT, null, 'T'); longopts[7] = new LongOpt("cutmethod", LongOpt.REQUIRED_ARGUMENT, null, 'T');
longopts[8] = new LongOpt("embedded", LongOpt.NO_ARGUMENT, null, 'e'); longopts[8] = new LongOpt("embedded", LongOpt.NO_ARGUMENT, null, 'e');
longopts[9] = new LongOpt("dirName", LongOpt.REQUIRED_ARGUMENT, null, 'c');
Getopt g = new Getopt("", args, "ehio:t:T:d::r:p:", longopts); Getopt g = new Getopt("", args, "ehio:t:T:d::r:p:c:", longopts);
int c; int c;
String arg; String arg;
...@@ -130,6 +135,9 @@ public class ParserPrinter { ...@@ -130,6 +135,9 @@ public class ParserPrinter {
/* Write warnings to stdout rather than stderr */ /* Write warnings to stdout rather than stderr */
filename = g.getOptarg(); filename = g.getOptarg();
break; break;
case 'c':
dirName = g.getOptarg();
break;
case 'r': case 'r':
/* Use the given class for rendernig */ /* Use the given class for rendernig */
rendererClass = g.getOptarg(); rendererClass = g.getOptarg();
...@@ -194,10 +202,16 @@ public class ParserPrinter { ...@@ -194,10 +202,16 @@ public class ParserPrinter {
if (filename == null) { if (filename == null) {
//writer = (PrintStream) System.out; //writer = (PrintStream) System.out;
stream = System.out; stream = System.out;
} else { }
else {
//writer = new PrintStream(new FileOutputStream(filename)); //writer = new PrintStream(new FileOutputStream(filename));
stream = new FileOutputStream(filename); stream = new FileOutputStream(filename);
} }
if (dirName != null) {
File f = new File(dirName);
f.mkdir();
System.setProperty("user.dir", dirName);
}
writer = new PrintWriter ( writer = new PrintWriter (
new BufferedWriter( new BufferedWriter(
new OutputStreamWriter( stream, "UTF-8" )), true); new OutputStreamWriter( stream, "UTF-8" )), true);
...@@ -237,7 +251,7 @@ public class ParserPrinter { ...@@ -237,7 +251,7 @@ public class ParserPrinter {
} finally { } finally {
writer.flush(); writer.flush();
writer.close(); writer.close();
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
...@@ -256,6 +270,7 @@ public class ParserPrinter { ...@@ -256,6 +270,7 @@ public class ParserPrinter {
System.out.println("\t--threshold=threshold -t threshold\t\tTrim the alugnment with regard to threshold"); System.out.println("\t--threshold=threshold -t threshold\t\tTrim the alugnment with regard to threshold");
System.out.println("\t--cutmethod=hard|perc|prop|best|span -T hard|perc|prop|best|span\t\tMethod to use for triming"); System.out.println("\t--cutmethod=hard|perc|prop|best|span -T hard|perc|prop|best|span\t\tMethod to use for triming");
System.out.println("\t--output=filename -o filename\tOutput the alignment in filename"); System.out.println("\t--output=filename -o filename\tOutput the alignment in filename");
System.out.println("\t--outputDir=dirName -c dirName\tOutput the queris in directory");
System.out.println("\t--help -h\t\t\tPrint this message"); System.out.println("\t--help -h\t\t\tPrint this message");
System.err.print("\n"+ParserPrinter.class.getPackage().getImplementationTitle()+" "+ParserPrinter.class.getPackage().getImplementationVersion()); System.err.print("\n"+ParserPrinter.class.getPackage().getImplementationTitle()+" "+ParserPrinter.class.getPackage().getImplementationVersion());
System.err.println(" ($Id$)\n"); System.err.println(" ($Id$)\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment