@Command(name = "truncate", description = "Truncates the journal to a given offset") public class JournalTruncate extends AbstractJournalCommand { @Option(name = {"-o", "--offset"}, description = "Truncate journal up to this offset, no remaining offset will be larger than the given offset.") @Required private long offset = Long.MIN_VALUE; public JournalTruncate() { super("truncate-journal"); } @Override protected void runCommand() { try { final long logEndOffset = journal.getLogEndOffset(); if (offset > logEndOffset) { System.err.println("Truncating journal to " + offset + " has no effect as the largest offset in the log is " + (logEndOffset - 1) + "."); } else { journal.truncateTo(offset); } } catch (IllegalArgumentException e) { System.err.println("Illegal offset value " + offset); } } }
@Required private String rangeArg;
@Required @Arguments( title = "config-file",
@Required @Arguments( title = "server",
@Command(name = "pretty-r2rml", description = "prettify R2RML file using Jena") public class OntopR2RMLPrettify implements OntopCommand { @Option(type = OptionType.COMMAND, name = {"-i", "--input"}, title = "input.ttl", description = "Input mapping file in Ontop native format (.obda)") @Required protected String inputMappingFile; @Option(type = OptionType.COMMAND, name = {"-o", "--output"}, title = "pretty.ttl", description = "Input mapping file in Ontop native format (.obda)") @Required protected String outputMappingFile; @Override public void run() { try { Model model = RDFDataMgr.loadModel(new File(inputMappingFile).toURI().toString(), Lang.TURTLE); OutputStream out = new FileOutputStream(outputMappingFile); RDFDataMgr.write(out, model, RDFFormat.TURTLE_PRETTY) ; } catch (FileNotFoundException e) { e.printStackTrace(); } } }
@Command(name = "truncate", description = "Truncates the journal to a given offset") public class JournalTruncate extends AbstractJournalCommand { @Option(name = {"-o", "--offset"}, description = "Truncate journal up to this offset, no remaining offset will be larger than the given offset.") @Required private long offset = Long.MIN_VALUE; public JournalTruncate() { super("truncate-journal"); } @Override protected void runCommand() { try { final long logEndOffset = journal.getLogEndOffset(); if (offset > logEndOffset) { System.err.println("Truncating journal to " + offset + " has no effect as the largest offset in the log is " + (logEndOffset - 1) + "."); } else { journal.truncateTo(offset); } } catch (IllegalArgumentException e) { System.err.println("Illegal offset value " + offset); } } }
abstract class OntopMappingOntologyRelatedCommand implements OntopCommand { @Option(type = OptionType.COMMAND, name = {"-t", "--ontology"}, title = "ontology file", description = "OWL ontology file") @BashCompletion(behaviour = CompletionBehaviour.FILENAMES) String owlFile; @Option(type = OptionType.COMMAND, name = {"-m", "--mapping"}, title = "mapping file", description = "Mapping file in R2RML (.ttl) or in Ontop native format (.obda)") @Required @BashCompletion(behaviour = CompletionBehaviour.FILENAMES) String mappingFile; @Option(type = OptionType.COMMAND, name = {"-p", "--properties"}, title = "properties file", description = "Properties file") @Required @BashCompletion(behaviour = CompletionBehaviour.FILENAMES) String propertiesFile; protected boolean isR2rmlFile(String mappingFile) { return !mappingFile.endsWith(".obda"); } }
@Command(name = "ArgsRequired") public class ArgsRequired { @Arguments(description = "List of files") @Required public List<String> parameters = new ArrayList<>(); }
@Required protected String inputMappingFile;
@Command(name = "ArgsRequiredWrongMain") public class ArgsRequiredWrongMain { @Arguments @Required public String[] file; }
@Command(name = "terminate", description = "Provision a new agent") public static class AgentTerminateCommand extends GalaxyCommand { @Arguments(title = "agent-id", description = "Agent to terminate") @Required public String agentId; @Override public String toString() { return toStringHelper(this) .add("agentId", agentId) .add("globalOptions", globalOptions) .toString(); } } }
description = "SPARQL SELECT query file") @BashCompletion(behaviour = CompletionBehaviour.FILENAMES) @Required private String queryFile;
@Command(name = "ArgsDefaultOptionGroupScope") public class ArgsDefaultOptionGroupScope { @Option(name = "--test", arity = 1, type = OptionType.GROUP) @Required @DefaultOption public String arg; }
@Command(name = "ArgsDefaultOptionGlobalScope") public class ArgsDefaultOptionGlobalScope { @Option(name = "--test", arity = 1, type = OptionType.GLOBAL) @Required @DefaultOption public String arg; }
@Command(name = "ArgsDefaultOption") public class ArgsDefaultOption { @Option(name = "--test", arity = 1) @Required @DefaultOption public String arg; }
@Command(name = "OptionsRequired") public class OptionsRequired { @Option(name = "--required") @Required public String requiredOption; @Option(name = "--optional") public String optionalOption; }
@Command(name = "ArgsDefaultOption") public class ArgsDefaultOptionBadArity { @Option(name = "--test", arity = 2) @Required @DefaultOption public List<String> arg; }
@Command(name = "ArgsDefaultOptionAndArguments") public class ArgsDefaultOptionAndArguments { @Option(name = "--test", arity = 1) @Required @DefaultOption public String option; @Arguments public String arg; }
@Required @BashCompletion(behaviour = CompletionBehaviour.FILENAMES) private String inputMappingFile;