/** * @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead. */ @Deprecated public static Literal anyObjectLiteral(Model m) { return objectLiteral(m).orElse(null); }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectLiteral(model.filter(implNode, ProxyRepositorySchema.PROXIED_ID, null)).ifPresent( lit -> setProxiedRepositoryID(lit.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
@Override public void parse(Model m, Resource implNode) throws SailConfigException { super.parse(m, implNode); try { Models.objectLiteral(m.filter(implNode, SpinSailSchema.AXIOM_CLOSURE_NEEDED, null)).ifPresent( lit -> setAxiomClosureNeeded(lit.booleanValue())); } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } } }
Optional<Literal> language = Models.objectLiteral(m.filter(implNode, QUERY_LANGUAGE, null)); Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent( lit -> setRuleQuery(lit.stringValue())); Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent( lit -> setMatcherQuery(lit.stringValue()));
Models.objectLiteral(model.filter(resource, INCLUDE_INFERRED, null)).ifPresent( lit -> setIncludeInferred(lit.booleanValue())); Models.objectLiteral(model.filter(resource, MAX_QUERY_TIME, null)).ifPresent( lit -> setMaxQueryTime(lit.intValue())); Models.objectLiteral(model.filter(resource, QUERY_LANGUAGE, null)).ifPresent( lit -> setQueryLanguage(QueryLanguage.valueOf(lit.getLabel())));
@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); } } }
Optional<Literal> bool = Models.objectLiteral(model.filter(implNode, DISTINCT, null)); if (bool.isPresent() && bool.get().booleanValue()) { distinct = true; bool = Models.objectLiteral(model.filter(implNode, READ_ONLY, null)); if (bool.isPresent() && bool.get().booleanValue()) { readOnly = true;
@Override public void parse(Model graph, Resource implNode) throws SailConfigException { super.parse(graph, implNode); Literal indexDirLit = Models.objectLiteral(graph.filter(implNode, INDEX_DIR, null)).orElseThrow( () -> new SailConfigException("no value found for " + INDEX_DIR)); setIndexDir(indexDirLit.getLabel()); for (Statement stmt : graph.filter(implNode, null, null)) { if (stmt.getPredicate().getNamespace().equals(LuceneSailConfigSchema.NAMESPACE)) { if (stmt.getObject() instanceof Literal) { String key = stmt.getPredicate().getLocalName(); setParameter(key, stmt.getObject().stringValue()); } } } } }