44import java .nio .file .Path ;
55
66import fr .inria .corese .command .utils .coreseCoreWrapper .CoreseRdfGraph ;
7+ import fr .inria .corese .command .utils .coreseCoreWrapper .CoreseResultFormat ;
78import fr .inria .corese .core .kgram .core .Mappings ;
8- import fr .inria .corese .core .print .ResultFormat ;
99import fr .inria .corese .core .sparql .api .ResultFormatDef ;
1010import picocli .CommandLine .Model .CommandSpec ;
1111
@@ -64,7 +64,7 @@ public AbstractExporter(CommandSpec spec, boolean verbose, Path output) throws I
6464 * @param graph Graph to export.
6565 */
6666 protected void exportToFile (Path path , ResultFormatDef .format coreseFormat , String formatName , CoreseRdfGraph graph ) {
67- ResultFormat resultFormater = ResultFormat . create (graph . getGraph () );
67+ CoreseResultFormat resultFormater = new CoreseResultFormat (graph );
6868 exportToFile (path , coreseFormat , formatName , resultFormater );
6969 }
7070
@@ -76,7 +76,7 @@ protected void exportToFile(Path path, ResultFormatDef.format coreseFormat, Stri
7676 * @param graph Graph to export.
7777 */
7878 protected void exportToStdout (ResultFormatDef .format coreseFormat , String formatName , CoreseRdfGraph graph ) {
79- ResultFormat resultFormater = ResultFormat . create (graph . getGraph () );
79+ CoreseResultFormat resultFormater = new CoreseResultFormat (graph );
8080 exportToStdout (coreseFormat , formatName , resultFormater );
8181 }
8282
@@ -89,7 +89,7 @@ protected void exportToStdout(ResultFormatDef.format coreseFormat, String format
8989 * @param mappings Mappings to export.
9090 */
9191 protected void exportToFile (Path path , ResultFormatDef .format coreseFormat , String formatName , Mappings mappings ) {
92- ResultFormat resultFormater = ResultFormat . create (mappings );
92+ CoreseResultFormat resultFormater = new CoreseResultFormat (mappings );
9393 exportToFile (path , coreseFormat , formatName , resultFormater );
9494 }
9595
@@ -101,7 +101,7 @@ protected void exportToFile(Path path, ResultFormatDef.format coreseFormat, Stri
101101 * @param mappings Mappings to export.
102102 */
103103 protected void exportToStdout (ResultFormatDef .format coreseFormat , String formatName , Mappings mappings ) {
104- ResultFormat resultFormater = ResultFormat . create (mappings );
104+ CoreseResultFormat resultFormater = new CoreseResultFormat (mappings );
105105 exportToStdout (coreseFormat , formatName , resultFormater );
106106 }
107107
@@ -118,16 +118,12 @@ protected void exportToStdout(ResultFormatDef.format coreseFormat, String format
118118 * @param ResultFormat Result formater.
119119 */
120120 private void exportToFile (Path path ,
121- ResultFormatDef .format coreseFormat , String formatName , ResultFormat resultFormater ) {
121+ ResultFormatDef .format coreseFormat , String formatName , CoreseResultFormat resultFormater ) {
122122
123123 resultFormater .setSelectFormat (coreseFormat );
124124 resultFormater .setConstructFormat (coreseFormat );
125125
126- try {
127- resultFormater .write (path .toString ());
128- } catch (Exception e ) {
129- throw new IllegalArgumentException ("Failed to open export file: " + path .toString (), e );
130- }
126+ resultFormater .write (path .toString ());
131127
132128 if (this .verbose ) {
133129 this .spec .commandLine ().getErr ()
@@ -143,7 +139,7 @@ private void exportToFile(Path path,
143139 * @param formatName Name of the format.
144140 * @param ResultFormat Result formater.
145141 */
146- private void exportToStdout (ResultFormatDef .format coreseFormat , String formatName , ResultFormat resultFormater ) {
142+ private void exportToStdout (ResultFormatDef .format coreseFormat , String formatName , CoreseResultFormat resultFormater ) {
147143
148144 // Configure the result formater
149145 resultFormater .setSelectFormat (coreseFormat );
0 commit comments