public void validate() throws SailConfigException { if (type == null) { throw new SailConfigException("No type specified for sail implementation"); } }
public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { if (config instanceof SailRepositoryConfig) { SailRepositoryConfig sailRepConfig = (SailRepositoryConfig)config; try { Sail sail = createSailStack(sailRepConfig.getSailImplConfig()); return new SailRepository(sail); } catch (SailConfigException e) { throw new RepositoryConfigException(e.getMessage(), e); } } throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); }
@Override public void validate() throws RepositoryConfigException { super.validate(); if (sailImplConfig == null) { throw new RepositoryConfigException("No Sail implementation specified for Sail repository"); } try { sailImplConfig.validate(); } catch (SailConfigException e) { throw new RepositoryConfigException(e.getMessage(), e); } }
public void validate() throws SailConfigException { if (type == null) { throw new SailConfigException("No type specified for sail implementation"); } }
@Override public void parse(Model model, Resource repImplNode) throws RepositoryConfigException { try { Optional<Resource> sailImplNode = Models.objectResource( model.filter(repImplNode, SAILIMPL, null)); if (sailImplNode.isPresent()) { Models.objectLiteral(model.filter(sailImplNode.get(), SAILTYPE, null)).ifPresent(typeLit -> { SailFactory factory = SailRegistry.getInstance().get(typeLit.getLabel()).orElseThrow( () -> new RepositoryConfigException( "Unsupported Sail type: " + typeLit.getLabel())); sailImplConfig = factory.getConfig(); sailImplConfig.parse(model, sailImplNode.get()); }); } } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } catch (SailConfigException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
public EvaluationStrategyFactory getEvaluationStrategyFactory() throws SailConfigException { if (evalStratFactoryClassName == null) { return null; } try { return (EvaluationStrategyFactory)Thread.currentThread().getContextClassLoader().loadClass( evalStratFactoryClassName).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new SailConfigException(e); } }
public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } return new ForwardChainingRDFSInferencer(); } }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } return new DedupingInferencer(); } }
@Override public void validate() throws SailConfigException { super.validate(); if (null == language) { throw new SailConfigException("No query language specified for " + getType() + " Sail."); } if (null == ruleQuery) { throw new SailConfigException("No rule query specified for " + getType() + " Sail."); } else { try { QueryParserUtil.parseGraphQuery(language, ruleQuery, null); } catch (RDF4JException e) { throw new SailConfigException("Problem occured parsing supplied rule query.", e); } } try { if (matcherQuery.trim().isEmpty()) { matcherQuery = buildMatcherQueryFromRuleQuery(language, ruleQuery); } QueryParserUtil.parseGraphQuery(language, matcherQuery, null); } catch (RDF4JException e) { throw new SailConfigException("Problem occured parsing matcher query: " + matcherQuery, e); } }
public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } return new DirectTypeHierarchyInferencer(); } }
@Override public void validate() throws SailConfigException { super.validate(); if (delegate == null) { throw new SailConfigException("No delegate specified for " + getType() + " Sail"); } delegate.validate(); }
@Override public void validate() throws SailConfigException { super.validate(); if (delegate == null) { throw new SailConfigException("No delegate specified for " + getType() + " Sail"); } delegate.validate(); }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } SpinSail spinSail = new SpinSail(); if (config instanceof SpinSailConfig) { spinSail.setAxiomClosureNeeded(((SpinSailConfig)config).isAxiomClosureNeeded()); } return spinSail; } }
public static SailImplConfig parseRepositoryImpl(Model m, Resource implNode) throws SailConfigException { try { Optional<Literal> typeLit = Models.objectLiteral( m.filter(implNode, SailConfigSchema.SAILTYPE, null)); if (typeLit.isPresent()) { Optional<SailFactory> factory = SailRegistry.getInstance().get(typeLit.get().getLabel()); if (factory.isPresent()) { SailImplConfig implConfig = factory.get().getConfig(); implConfig.parse(m, implNode); return implConfig; } else { throw new SailConfigException("Unsupported Sail type: " + typeLit.get().getLabel()); } } return null; } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } } }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } if (config instanceof HBaseSailConfig) { HBaseSailConfig hconfig = (HBaseSailConfig) config; //instantiate the sail HBaseSail sail = new HBaseSail(HBaseConfiguration.create(), hconfig.getTablespace(), hconfig.isCreate(), hconfig.getSplitBits(), hconfig.isPush(), hconfig.getEvaluationTimeout(), hconfig.getElasticIndexURL(), null); return sail; } else { throw new SailConfigException("Invalid configuration: " + config); } }
public static SailImplConfig parseRepositoryImpl(Model m, Resource implNode) throws SailConfigException { try { Optional<Literal> typeLit = Models.objectLiteral( m.filter(implNode, SailConfigSchema.SAILTYPE, null)); if (typeLit.isPresent()) { Optional<SailFactory> factory = SailRegistry.getInstance().get(typeLit.get().getLabel()); if (factory.isPresent()) { SailImplConfig implConfig = factory.get().getConfig(); implConfig.parse(m, implNode); return implConfig; } else { throw new SailConfigException("Unsupported Sail type: " + typeLit.get().getLabel()); } } return null; } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } } }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } SpinSail spinSail = new SpinSail(); if (config instanceof SpinSailConfig) { spinSail.setAxiomClosureNeeded(((SpinSailConfig)config).isAxiomClosureNeeded()); } return spinSail; } }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } LuceneSpinSail sail = new LuceneSpinSail(); Properties params = sail.getParameters(); // set up parameters params.setProperty(LuceneSail.INDEX_CLASS_KEY, LuceneSail.DEFAULT_INDEX_CLASS); if (config instanceof AbstractLuceneSailConfig) { AbstractLuceneSailConfig luceneConfig = (AbstractLuceneSailConfig)config; log.debug("Lucene indexDir: {}", luceneConfig.getIndexDir()); params.setProperty(LuceneSail.LUCENE_DIR_KEY, luceneConfig.getIndexDir()); for (String key : luceneConfig.getParameterNames()) { params.setProperty(key, luceneConfig.getParameter(key)); } } return sail; }
@Override public Sail getSail(SailImplConfig config) throws SailConfigException { if (!SAIL_TYPE.equals(config.getType())) { throw new SailConfigException("Invalid Sail type: " + config.getType()); } CustomGraphQueryInferencer sail = new CustomGraphQueryInferencer(); if (config instanceof CustomGraphQueryInferencerConfig) { CustomGraphQueryInferencerConfig customConfig = (CustomGraphQueryInferencerConfig)config; try { sail.setFields(customConfig.getQueryLanguage(), customConfig.getRuleQuery(), customConfig.getMatcherQuery()); } catch (RDF4JException e) { throw new SailConfigException("Problem occured parsing rule or matcher query text.", e); } } return sail; } }
throw new SailConfigException( "Boolean value required for " + PERSIST + " property, found " + persistValue); throw new SailConfigException("Long integer value required for " + SYNC_DELAY + " property, found " + syncDelayValue); throw new SailConfigException(e.getMessage(), e);