public OpenlletCmdOption getIgnoreImportsOption() { final OpenlletCmdOption option = new OpenlletCmdOption("ignore-imports"); //option.setShortOption("I"); option.setDescription("Ignore imported ontologies"); option.setDefaultValue(false); option.setIsMandatory(false); option.setArg(NONE); return option; }
@Override public boolean equals(final Object o) { if (!(o instanceof OpenlletCmdOption)) return false; final OpenlletCmdOption other = (OpenlletCmdOption) o; return (((_shortOption == null && other.getShortOption() == null) || // (_shortOption != null && _shortOption.equals(other.getShortOption())))// && _longOption.equals(other.getLongOption()) // && ((_type == null && other.getType() == null) || (_type != null && _type.equals(other.getType()))) // && ((_description == null && other.getDescription() == null) || (_description != null && _description.equals(other.getDescription()))) // && _isMandatory == other.isMandatory() // && ((_value == null && other.getValue() == null) || (_value != null && _value.equals(other.getValue()))) // && ((_defaultValue == null && other.getDefaultValue() == null) || (_defaultValue != null && _defaultValue.equals(other.getDefaultValue())))); }
public void add(final OpenlletCmdOption option) { final String shortOption = option.getShortOption(); final String longOption = option.getLongOption(); if (options.containsKey(longOption)) throw new OpenlletCmdException("Duplicate long option for command: " + longOption); else if (shortOption != null && shortOptions.containsKey(shortOption)) throw new OpenlletCmdException("Duplicate short option for command: " + shortOption); shortOptions.put(shortOption, option); options.put(longOption, option); if (option.isMandatory()) mandatory.add(option); }
if (option.getLongOption().equals("help")) if (option.getLongOption().equals("verbose")) if (seenOptions.contains(option.getLongOption())) { throw new OpenlletCmdException("Repeated use of option: " + arg); } seenOptions.add(option.getLongOption()); final OpenlletCmdOptionArg optionArg = option.getArg(); final boolean nextIsArg = args.length > i + 1 && args[i + 1].charAt(0) != '-'; switch (optionArg) option.setValue(true); break; case REQUIRED: if (!nextIsArg) throw new OpenlletCmdException("Option <" + option.getLongOption() + "> requires an argument"); option.setValue(args[++i]); option.setValue(args[++i]); option.setExists(true); if (option.isMandatory()) if (option.getValue() == null) { throw new OpenlletCmdException("Option <" + option.getLongOption() + "> is mandatory"); }
final String longOption = option.getLongOption(); final String shortOption = option.getShortOption(); final String type = option.getType(); final OpenlletCmdOptionArg arg = option.getArg(); final String description = option.getDescription(); if (option.getDefaultValue() != null) defaultValue = option.getDefaultValue().toString();
@Override public OpenlletCmdOptions getOptions() { final OpenlletCmdOptions options = getGlobalOptions(); final OpenlletCmdOption option = new OpenlletCmdOption("persist"); option.setShortOption("p"); option.setDescription("Enable persistence of classification results. The classifier will save its internal state in a file, and will reuse it the next time this ontology is loaded, therefore saving classification time. This option can only be used with OWLAPI _loader."); option.setIsMandatory(false); option.setArg(NONE); options.add(option); options.add(getLoaderOption()); options.add(getIgnoreImportsOption()); options.add(getInputFormatOption()); return options; }
@Override public void parseArgs(final String[] args) { super.parseArgs(args); setQueryFile(_options.getOption("query-file").getValueAsString()); setOutputFormat(_options.getOption("output-format").getValueAsString()); setQueryFormat(_options.getOption("query-format").getValueAsString()); setQueryEngine(_options.getOption("query-engine").getValueAsString()); OpenlletOptions.TREAT_ALL_VARS_DISTINGUISHED = !_options.getOption("bnode").getValueAsBoolean(); }
@Override public void run() _propertyName = _options.getOption("property").getValueAsString(); boolean filter = false; if (_options.getOption("filter").exists()) final String filterName = _options.getOption("filter").getValueAsString(); final OWLEntity filterClass = OntologyUtils.findEntity(filterName, loader.allOntologies()); if (filterClass == null) final boolean indParam = _options.getOption("individuals").getValueAsBoolean();
@Override public void run() { if (_options.getOption("persist").getValueAsBoolean()) runIncrementalClassify(); else runClassicClassify(); }
protected String getMandatoryOptions() { final StringBuffer ret = new StringBuffer(); final Set<OpenlletCmdOption> mandatory = _options.getMandatoryOptions(); for (final OpenlletCmdOption option : mandatory) { ret.append("-" + option.getShortOption() + " arg "); } return ret.toString(); }
_loader.setIgnoreImports(_options.getOption("ignore-imports").getValueAsBoolean()); final OpenlletCmdOption option = _options.getOption("input-format"); if (option != null && option.getValueAsString() != null) final String inputFormat = option.getValueAsString().toUpperCase();
private void runLintForRDFXML() throws IOException { final RDFModelReader reader = new RDFModelReader(); RDFModel rootModel = null; try { rootModel = reader.read(_inputOntologyPath, !_doRootOnly); } catch (final Exception e) { throw new OpenlletCmdException(e); } final OWLSyntaxChecker checker = new OWLSyntaxChecker(); checker.setExcludeValidPunnings(_options.getOption("exclude-valid-punning").getValueAsBoolean()); final RDFLints lints = checker.validate(rootModel); output(lints.toString()); if (_outputOntologyPath != null && !_doOWL) { final List<Statement> missingStmts = lints.getMissingStatements(); rootModel.addAllStatementsWithExistingBNodesOnly(missingStmts); final RDFModelWriter writer = new RDFModelWriter(); writer.write(new FileOutputStream(new File(_outputOntologyPath)), rootModel); output("Saved to " + _outputOntologyPath); } }
public OpenlletCmdOption getInputFormatOption() { final OpenlletCmdOption option = new OpenlletCmdOption("input-format"); option.setDefaultValue(null); option.setDescription("Format of the input file (valid only for the " + "Jena _loader). Default behaviour is to guess " + "the input format based on the file extension."); option.setType("RDF/XML | Turtle | N-Triples"); option.setIsMandatory(false); option.setArg(REQUIRED); return option; }
@Override public void parseArgs(final String[] args) { super.parseArgs(args); final String only = _options.getOption("only").getValueAsString(); if (only == null) { setDoRDF(true); setDoOWL(true); } else if (only.equalsIgnoreCase("RDF")) { setDoRDF(true); setDoOWL(false); } else if (only.equalsIgnoreCase("OWL")) { setDoRDF(false); setDoOWL(true); } else throw new OpenlletCmdException("Invalid argument to lint --only: " + only); setDoRootOnly(_options.getOption("root-only").getValueAsBoolean()); if (getInputFiles().length > 1) throw new OpenlletCmdException("lint doesn't handle multiple input files"); setInputOntologyPath(getInputFiles()[0]); setOutputOntologyPath(_options.getOption("fix").getValueAsString()); }
manager.getIRIMappers().clear(); if (_options.getOption("ignore-imports").getValueAsBoolean()) if (_options.getOption("merge").getValueAsBoolean()) manager = mergeOntologiesInNewManager(manager);
public OpenlletCmdOption getLoaderOption() { final OpenlletCmdOption option = new OpenlletCmdOption("loader"); option.setShortOption("l"); option.setDescription("Use Jena, OWLAPI, OWLAPI or KRSS to load the ontology"); option.setType("Jena | OWLAPI | KRSS"); option.setDefaultValue("OWLAPI"); option.setIsMandatory(false); option.setArg(REQUIRED); return option; }
@Override public void run() entailmentFile = _options.getOption("entailment-file").getValueAsString(); findAll = _options.getOption("all").getValueAsBoolean();
private TransactionAwareSingleExpGen getSingleExplanationGenerator() { if (_useBlackBox) { if (_options.getOption("inconsistent") != null) { if (!_options.getOption("inconsistent").getValueAsBoolean()) { return new BlackBoxExplanation(_reasoner.getRootOntology(), OpenlletReasonerFactory.getInstance(), _reasoner); } else { output("WARNING: black method cannot be used to explain inconsistency. Switching to glass."); return new GlassBoxExplanation(_reasoner); } } else { return new BlackBoxExplanation(_reasoner.getRootOntology(), OpenlletReasonerFactory.getInstance(), _reasoner); } } else { return new GlassBoxExplanation(_reasoner); } }
public OpenlletCmdOptions getGlobalOptions() { final OpenlletCmdOptions options = new OpenlletCmdOptions(); final OpenlletCmdOption helpOption = new OpenlletCmdOption("help"); helpOption.setShortOption("h"); helpOption.setDescription("Print this message"); helpOption.setDefaultValue(false); helpOption.setIsMandatory(false); helpOption.setArg(NONE); options.add(helpOption); final OpenlletCmdOption verboseOption = new OpenlletCmdOption("verbose"); verboseOption.setShortOption("v"); verboseOption.setDescription("Print full stack trace for errors."); verboseOption.setDefaultValue(false); verboseOption.setIsMandatory(false); verboseOption.setArg(NONE); options.add(verboseOption); final OpenlletCmdOption configOption = new OpenlletCmdOption("config"); configOption.setShortOption("C"); configOption.setDescription("Use the selected configuration file"); configOption.setIsMandatory(false); configOption.setType("configuration file"); configOption.setArg(REQUIRED); options.add(configOption); return options; }
if (option.getValueAsBoolean()) { return; } if (option.getValueAsBoolean()) if (option.getValueAsBoolean()) final String unsatisfiable = option.getValueAsString(); if (unsatisfiable != null) final String subclass = option.getValueAsString(); if (subclass != null) final String instance = option.getValueAsString(); if (instance != null) final String optionValue = option.getValueAsString(); if (optionValue != null)