Skip to content

Commit

Permalink
Add option --no-owl-import to skip automatic owl:imports handling. Cl…
Browse files Browse the repository at this point in the history
…oses #134
  • Loading branch information
remiceres committed Sep 6, 2023
1 parent e3725e4 commit 294149b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import fr.inria.corese.command.utils.format.EnumInputFormat;
import fr.inria.corese.command.utils.format.EnumOutputFormat;
import fr.inria.corese.core.Graph;
import fr.inria.corese.core.util.Property;
import fr.inria.corese.core.util.Property.Value;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -52,6 +54,10 @@ public class Convert implements Callable<Integer> {
"--init" }, description = "Path to a configuration file. If not provided, the default configuration file will be used.", required = false)
private Path configFilePath;

@Option(names = { "-n",
"--no-owl-import" }, description = "Disables the automatic importation of ontologies specified in 'owl:imports' statements. When this flag is set, the application will not fetch and include referenced ontologies.", required = false, defaultValue = "false")
private boolean noOwlImport;

private Graph graph = Graph.create();

private boolean outputFormatIsDefined = false;
Expand All @@ -73,6 +79,9 @@ public Integer call() {
ConfigManager.loadDefaultConfig(this.spec, this.verbose);
}

// Set owl import
Property.set(Value.DISABLE_OWL_AUTO_IMPORT, this.noOwlImport);

// Check if output format is defined
this.outputFormatIsDefined = this.output != null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import fr.inria.corese.command.utils.format.EnumInputFormat;
import fr.inria.corese.command.utils.format.EnumOutputFormat;
import fr.inria.corese.core.Graph;
import fr.inria.corese.core.util.Property;
import fr.inria.corese.core.util.Property.Value;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -63,6 +65,10 @@ public class Shacl implements Callable<Integer> {
"--init" }, description = "Path to a configuration file. If not provided, the default configuration file will be used.", required = false)
private Path configFilePath;

@Option(names = { "-n",
"--no-owl-import" }, description = "Disables the automatic importation of ontologies specified in 'owl:imports' statements. When this flag is set, the application will not fetch and include referenced ontologies.", required = false, defaultValue = "false")
private boolean noOwlImport;

private Graph dataGraph = Graph.create();
private Graph shapesGraph = Graph.create();
private Graph reportGraph = Graph.create();
Expand All @@ -85,6 +91,9 @@ public Integer call() {
ConfigManager.loadDefaultConfig(this.spec, this.verbose);
}

// Set owl import
Property.set(Value.DISABLE_OWL_AUTO_IMPORT, this.noOwlImport);

// Check if output format is defined
this.outputFormatIsDefined = this.output != null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import fr.inria.corese.command.utils.format.EnumResultFormat;
import fr.inria.corese.core.Graph;
import fr.inria.corese.core.query.QueryProcess;
import fr.inria.corese.core.util.Property;
import fr.inria.corese.core.util.Property.Value;
import fr.inria.corese.kgram.core.Mappings;
import fr.inria.corese.sparql.triple.parser.ASTQuery;
import picocli.CommandLine.Command;
Expand Down Expand Up @@ -71,6 +73,10 @@ public class Sparql implements Callable<Integer> {
"--init" }, description = "Path to a configuration file. If not provided, the default configuration file will be used.", required = false)
private Path configFilePath;

@Option(names = { "-n",
"--no-owl-import" }, description = "Disables the automatic importation of ontologies specified in 'owl:imports' statements. When this flag is set, the application will not fetch and include referenced ontologies.", required = false, defaultValue = "false")
private boolean noOwlImport;

private String query;

private Graph graph = Graph.create();
Expand All @@ -97,6 +103,9 @@ public Integer call() {
ConfigManager.loadDefaultConfig(this.spec, this.verbose);
}

// Set owl import
Property.set(Value.DISABLE_OWL_AUTO_IMPORT, this.noOwlImport);

this.resultFormatIsDefined = this.resultFormat != null;
this.outputPathIsDefined = this.output != null;
this.isDefaultOutputName = this.output == null
Expand Down

0 comments on commit 294149b

Please sign in to comment.