org.eclipse.rdf4j.query.Query.setBinding()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(365)

本文整理了Java中org.eclipse.rdf4j.query.Query.setBinding方法的一些代码示例,展示了Query.setBinding的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setBinding方法的具体详情如下:
包路径:org.eclipse.rdf4j.query.Query
类名称:Query
方法名:setBinding

Query.setBinding介绍

暂无

代码示例

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

  1. private static void addBindings(Query query, List<Argument> arguments, Value... args) {
  2. for (int i = 0; i < args.length; i++) {
  3. Argument argument = arguments.get(i);
  4. query.setBinding(argument.getPredicate().getLocalName(), args[i]);
  5. }
  6. }
  7. }

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

  1. private static void addBindings(Query query, List<Argument> arguments, Value... args) {
  2. for (int i = 0; i < args.length; i++) {
  3. Argument argument = arguments.get(i);
  4. query.setBinding(argument.getPredicate().getLocalName(), args[i]);
  5. }
  6. }
  7. }

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

  1. protected static void addArguments(Query query, Value... args)
  2. throws ValueExprEvaluationException
  3. {
  4. for (int i = 1; i < args.length; i += 2) {
  5. if (!(args[i] instanceof URI)) {
  6. throw new ValueExprEvaluationException("Argument " + i + " must be a URI");
  7. }
  8. query.setBinding(((URI)args[i]).getLocalName(), args[i + 1]);
  9. }
  10. }
  11. }

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

  1. protected static void addBindings(Query query, Value... args)
  2. throws ValueExprEvaluationException
  3. {
  4. for (int i = 1; i < args.length; i += 2) {
  5. if (!(args[i] instanceof Literal)) {
  6. throw new ValueExprEvaluationException("Argument " + i + " must be a literal");
  7. }
  8. query.setBinding(((Literal)args[i]).getLabel(), args[i + 1]);
  9. }
  10. }
  11. }

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

  1. private void setBindings(Query query, Resource subj, IRI pred, Value obj, Resource... contexts)
  2. throws RepositoryException
  3. {
  4. if (subj != null) {
  5. query.setBinding("s", subj);
  6. }
  7. if (pred != null) {
  8. query.setBinding("p", pred);
  9. }
  10. if (obj != null) {
  11. query.setBinding("o", obj);
  12. }
  13. if (contexts != null && contexts.length > 0) {
  14. SimpleDataset dataset = new SimpleDataset();
  15. for (Resource ctx : contexts) {
  16. if (ctx == null || ctx instanceof IRI) {
  17. dataset.addDefaultGraph((IRI)ctx);
  18. }
  19. else {
  20. throw new RepositoryException("Contexts must be URIs");
  21. }
  22. }
  23. query.setDataset(dataset);
  24. }
  25. }

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-sparql

  1. private void setBindings(Query query, Resource subj, IRI pred, Value obj, Resource... contexts)
  2. throws RepositoryException
  3. {
  4. if (subj != null) {
  5. query.setBinding("s", subj);
  6. }
  7. if (pred != null) {
  8. query.setBinding("p", pred);
  9. }
  10. if (obj != null) {
  11. query.setBinding("o", obj);
  12. }
  13. if (contexts != null && contexts.length > 0) {
  14. SimpleDataset dataset = new SimpleDataset();
  15. for (Resource ctx : contexts) {
  16. if (ctx == null || ctx instanceof IRI) {
  17. dataset.addDefaultGraph((IRI)ctx);
  18. }
  19. else {
  20. throw new RepositoryException("Contexts must be URIs");
  21. }
  22. }
  23. query.setDataset(dataset);
  24. }
  25. }

代码示例来源:origin: eclipse/rdf4j

  1. private void setBindings(Query query, Resource subj, IRI pred, Value obj, Resource... contexts)
  2. throws RepositoryException
  3. {
  4. if (subj != null) {
  5. query.setBinding("s", subj);
  6. }
  7. if (pred != null) {
  8. query.setBinding("p", pred);
  9. }
  10. if (obj != null) {
  11. query.setBinding("o", obj);
  12. }
  13. if (contexts != null && contexts.length > 0) {
  14. SimpleDataset dataset = new SimpleDataset();
  15. for (Resource ctx : contexts) {
  16. if (ctx == null || ctx instanceof IRI) {
  17. dataset.addDefaultGraph((IRI)ctx);
  18. }
  19. else {
  20. throw new RepositoryException("Contexts must be URIs");
  21. }
  22. }
  23. query.setDataset(dataset);
  24. }
  25. }

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring

  1. Value bindingValue = ProtocolUtil.parseValueParam(request, parameterName,
  2. SimpleValueFactory.getInstance());
  3. result.setBinding(bindingName, bindingValue);

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring

  1. Value bindingValue = ProtocolUtil.parseValueParam(request, parameterName,
  2. repository.getValueFactory());
  3. result.setBinding(bindingName, bindingValue);

相关文章