/** * @deprecated since 4.0. Use {@link #objectResource(Model)} instead. */ @Deprecated public static Resource anyObjectResource(Model m) { return objectResource(m).orElse(null); }
/** * @deprecated since 4.0. Use {@link #objectResource(Model)} instead. */ @Deprecated public static Resource anyObjectResource(Model m) { return objectResource(m).orElse(null); }
/** * Retrieve a property value as an IRI 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 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 Resource from the given model, or {@link Optional#empty()} if no such value exists. */ public static Optional<Resource> getPropertyResource(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 objectResource(m.filter(subject, property, null, contexts)); }
/** * Retrieve a property value as an IRI 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 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 Resource from the given model, or {@link Optional#empty()} if no such value exists. */ public static Optional<Resource> getPropertyResource(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 objectResource(m.filter(subject, property, null, contexts)); }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { super.parse(model, resource); Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent( delegate -> setDelegate(create(model, delegate))); } }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { super.parse(model, resource); Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent( delegate -> setDelegate(create(model, delegate))); } }
@Override public void parse(Model m, Resource implNode) throws SailConfigException { super.parse(m, implNode); try { Models.objectResource(m.filter(implNode, DELEGATE, null)).ifPresent( delegate -> setDelegate(SailConfigUtil.parseRepositoryImpl(m, delegate))); } catch (ModelException e) { throw new SailConfigException(e.getMessage(), e); } } }
@Override public void parse(Model m, Resource implNode) throws SailConfigException { super.parse(m, implNode); try { Models.objectResource(m.filter(implNode, DELEGATE, null)).ifPresent( delegate -> setDelegate(SailConfigUtil.parseRepositoryImpl(m, delegate))); } 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); } }
Optional<Resource> object = Models.objectResource(m.filter(implNode, RULE_QUERY, null)); if (object.isPresent()) { Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent( object = Models.objectResource(m.filter(implNode, MATCHER_QUERY, null)); if (object.isPresent()) { Models.objectLiteral(m.filter(object.get(), SP.TEXT_PROPERTY, null)).ifPresent(
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 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); } } }