/** * @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead. */ @Deprecated public static Literal anyObjectLiteral(Model m) { return objectLiteral(m).orElse(null); }
/** * @deprecated since 4.0. Use {@link #objectLiteral(Model)} instead. */ @Deprecated public static Literal anyObjectLiteral(Model m) { return objectLiteral(m).orElse(null); }
private static Optional<Literal> backCompatibilityFilterObjectLiteral(Model graph, Resource subject, IRI predicate) { Optional<Literal> value = Models.objectLiteral(graph.filter(subject, predicate, null)); return value.isPresent() ? value : Models.objectLiteral(graph.filter(subject, BACK_COMPATIBILITY_MAP.get(predicate), null)); } }
/** * Retrieve a property value as a {@link Literal} for the supplied subject from the given model. If more * than one property value exists, any one value is picked and returned. * * @param m * the model from which to retrieve an object value. * @param subject * the subject resource for which to retrieve a property literal value. * @param property * the property for which to retrieve a value. * @param contexts * the contexts from which to retrieve the property value. Optional vararg argument. If not * specified the operations works on the entire Model. * @return a property value Literal from the given model, or {@link Optional#empty()} if no such value exists. */ public static Optional<Literal> getPropertyLiteral(Model m, Resource subject, IRI property, Resource... contexts) { Objects.requireNonNull(m, "model may not be null"); Objects.requireNonNull(subject, "subject may not be null"); Objects.requireNonNull(property, "property may not be null"); return objectLiteral(m.filter(subject, property, null, contexts)); }
public void parse(Model model, Resource resource) throws RepositoryConfigException { Models.objectLiteral(model.filter(resource, REPOSITORYTYPE, null)).ifPresent( typeLit -> setType(typeLit.getLabel())); }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { Models.objectLiteral(model.filter(resource, REPOSITORYTYPE, null)).ifPresent( typeLit -> setType(typeLit.getLabel())); }
@Override public void parse(Model graph, Resource implNode) throws RepositoryConfigException { super.parse(graph, implNode); try { // use repositoryID as name objectLiteral(graph.filter(null, REPOSITORYID, null)) .ifPresent(lit -> this.setName(lit.getLabel())); objectLiteral(graph.filter(implNode, REPOSITORYTYPE, null)) .ifPresent(lit -> setType(lit.getLabel())); objectLiteral(graph.filter(implNode, OWLFILE, null)) .ifPresent(lit -> this.owlFile = new File(lit.getLabel())); objectLiteral(graph.filter(implNode, OBDAFILE, null)) .ifPresent(lit -> this.obdaFile = new File(lit.getLabel())); objectLiteral(graph.filter(implNode, PROPERTIESFILE, null)) .ifPresent(lit -> this.propertiesFile = new File(lit.getLabel())); } catch (Exception e) { throw new RepositoryConfigException(e.getMessage(), e); } }
@Override public void parse(Model graph, Resource implNode) throws RepositoryConfigException { super.parse(graph, implNode); try { // use repositoryID as name objectLiteral(graph.filter(null, REPOSITORYID, null)) .ifPresent(lit -> this.setName(lit.getLabel())); objectLiteral(graph.filter(implNode, REPOSITORYTYPE, null)) .ifPresent(lit -> setType(lit.getLabel())); this.owlFile = objectLiteral(graph.filter(implNode, OWLFILE, null)) .filter(l -> !l.getLabel().isEmpty()) .map(l -> new File(l.getLabel())); objectLiteral(graph.filter(implNode, OBDAFILE, null)) .ifPresent(lit -> this.obdaFile = new File(lit.getLabel())); objectLiteral(graph.filter(implNode, PROPERTIESFILE, null)) .ifPresent(lit -> this.propertiesFile = new File(lit.getLabel())); this.constraintFile = objectLiteral(graph.filter(implNode, CONSTRAINTFILE, null)) .filter(l -> !l.getLabel().isEmpty()) .map(l -> new File(l.getLabel())); } catch (Exception e) { throw new RepositoryConfigException(e.getMessage(), e); } }
public void parse(Model m, Resource implNode) throws SailConfigException { try { Models.objectLiteral(m.filter(implNode, SAILTYPE, null)).ifPresent( lit -> setType(lit.getLabel())); Models.objectLiteral( m.filter(implNode, SailConfigSchema.ITERATION_CACHE_SYNC_THRESHOLD, null)).ifPresent( lit -> setIterationCacheSyncThreshold(lit.longValue())); Models.objectLiteral( m.filter(implNode, SailConfigSchema.CONNECTION_TIME_OUT, null)).ifPresent( lit -> setConnectionTimeOut(lit.longValue())); } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } }
public void parse(Model m, Resource implNode) throws SailConfigException { try { Models.objectLiteral(m.filter(implNode, SAILTYPE, null)).ifPresent( lit -> setType(lit.getLabel())); Models.objectLiteral( m.filter(implNode, SailConfigSchema.ITERATION_CACHE_SYNC_THRESHOLD, null)).ifPresent( lit -> setIterationCacheSyncThreshold(lit.longValue())); Models.objectLiteral( m.filter(implNode, SailConfigSchema.CONNECTION_TIME_OUT, null)).ifPresent( lit -> setConnectionTimeOut(lit.longValue())); } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } }
public void parse(Model model, Resource repositoryNode) throws RepositoryConfigException { try { Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent( lit -> setID(lit.getLabel())); Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent( lit -> setTitle(lit.getLabel())); Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent( res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res))); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } }
public void parse(Model model, Resource repositoryNode) throws RepositoryConfigException { try { Models.objectLiteral(model.filter(repositoryNode, REPOSITORYID, null)).ifPresent( lit -> setID(lit.getLabel())); Models.objectLiteral(model.filter(repositoryNode, RDFS.LABEL, null)).ifPresent( lit -> setTitle(lit.getLabel())); Models.objectResource(model.filter(repositoryNode, REPOSITORYIMPL, null)).ifPresent( res -> setRepositoryImplConfig(AbstractRepositoryImplConfig.create(model, res))); } 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); } } }
@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); } } }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
@Override public void parse(Model graph, Resource implNode) throws SailConfigException { super.parse(graph, implNode); try { Models.objectLiteral(graph.filter(implNode, EVALUATION_STRATEGY_FACTORY, null)).ifPresent( factoryClassName -> { setEvaluationStrategyFactoryClassName(factoryClassName.stringValue()); }); } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } } }
@Override public void parse(Model model, Resource implNode) throws RepositoryConfigException { super.parse(model, implNode); try { Models.objectIRI(model.filter(implNode, REPOSITORYURL, null)).ifPresent( iri -> setURL(iri.stringValue())); Models.objectLiteral(model.filter(implNode, USERNAME, null)).ifPresent( username -> setUsername(username.getLabel())); Models.objectLiteral(model.filter(implNode, PASSWORD, null)).ifPresent( password -> setPassword(password.getLabel())); } catch (ModelException e) { throw new RepositoryConfigException(e.getMessage(), e); } } }
@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()); } } } } }