Skip to content

Commit

Permalink
refactor: Update canonicalize.java to use default RDFC10SHA256 algorithm
Browse files Browse the repository at this point in the history
This commit updates the canonicalize.java file to use the default RDFC10SHA256 algorithm for converting input files. The previous code allowed for specifying different algorithms, but it was unnecessary complexity. By using the default algorithm, we simplify the code and improve maintainability.
  • Loading branch information
remiceres committed Jul 5, 2024
1 parent d9c015b commit fb480e8
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class canonicalize implements Callable<Integer> {
private Path output;

@Option(names = { "-r", "-a", "-ca", "-of",
"--canonical-algo" }, required = true, description = "Canonicalization algorithm to which the input file should be converted. Possible values:\u001b[34m ${COMPLETION-CANDIDATES}\u001b[0m.")
"--canonical-algo" }, required = true, description = "Canonicalization algorithm to which the input file should be converted. Possible values:\u001b[34m ${COMPLETION-CANDIDATES}\u001b[0m.", defaultValue = "RDFC10SHA256")
private EnumCanonicAlgo canonicalAlgo;

@Option(names = { "-v",
Expand All @@ -65,7 +65,6 @@ public class canonicalize implements Callable<Integer> {

private Graph graph = Graph.create();

private boolean canonicalAlgoIsDefined = false;
private boolean isDefaultOutputName = false;

public canonicalize() {
Expand All @@ -87,9 +86,6 @@ public Integer call() {
// Set owl import
Property.set(Value.DISABLE_OWL_AUTO_IMPORT, this.noOwlImport);

// Check if canonical algorithm is defined
this.canonicalAlgoIsDefined = this.output != null;

// Check if output file name is default
this.isDefaultOutputName = this.output != null
&& DEFAULT_OUTPUT_FILE_NAME.equals(this.output.toString());
Expand Down Expand Up @@ -169,7 +165,7 @@ private void exportGraph() throws IOException {
Path outputFileName;

// Set output file name
if (this.canonicalAlgoIsDefined && !this.isDefaultOutputName) {
if (!this.isDefaultOutputName) {
outputFileName = this.output;
} else {
outputFileName = Path.of(this.DEFAULT_OUTPUT_FILE_NAME + "." + this.canonicalAlgo.getExtention());
Expand Down

0 comments on commit fb480e8

Please sign in to comment.