Skip to content

Commit

Permalink
Another improvement for --out-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Sep 5, 2024
1 parent 5c45360 commit b103dfc
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,23 @@ public static int sparqlIntegrate(CmdSparqlIntegrateMain cmd) throws Exception {

// If a format is given it takes precedence - otherwise try to use the filename
String outFormat = cmd.outFormat;

// Format source can be either a filename "foo.nt", a file extension "ttl" or a format string "turtle/pretty"
String formatSource = outFormat == null
? outFilename
: outFormat;

if (outFormat == null && formatSource != null) {
// Try to parse the format source as a file name or file extension
if (formatSource != null) {
// Try to derive the outFormat from the filename - if given.
FileName fn = fileNameParser.parse(formatSource);
outFormat = fn.getContentPart();
String tmpOutFormat = fn.getContentPart();

// Replace the outFormat with the result of the successful parse
if (tmpOutFormat != null) {
outFormat = tmpOutFormat;
}

rawOutEncodings.addAll(fn.getEncodingParts());
}

Expand Down

0 comments on commit b103dfc

Please sign in to comment.