Java Code Examples for org.eclipse.rdf4j.query.Query#setBinding()
The following examples show how to use
org.eclipse.rdf4j.query.Query#setBinding() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPARQLConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void setBindings(Query query, Resource subj, IRI pred, Value obj, Resource... contexts) throws RepositoryException { if (subj != null) { query.setBinding("s", subj); } if (pred != null) { query.setBinding("p", pred); } if (obj != null) { query.setBinding("o", obj); } if (contexts != null && contexts.length > 0) { SimpleDataset dataset = new SimpleDataset(); for (Resource ctx : contexts) { if (ctx == null || ctx instanceof IRI) { dataset.addDefaultGraph((IRI) ctx); } else { throw new RepositoryException("Contexts must be URIs"); } } query.setDataset(dataset); } }
Example 2
Source File: AbstractSpinFunction.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected static void addBindings(Query query, Value... args) throws ValueExprEvaluationException { for (int i = 1; i < args.length; i += 2) { if (!(args[i] instanceof Literal)) { throw new ValueExprEvaluationException("Argument " + i + " must be a literal"); } query.setBinding(((Literal) args[i]).getLabel(), args[i + 1]); } }
Example 3
Source File: EvalFunction.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected static void addArguments(Query query, Value... args) throws ValueExprEvaluationException { for (int i = 1; i < args.length; i += 2) { if (!(args[i] instanceof URI)) { throw new ValueExprEvaluationException("Argument " + i + " must be a URI"); } query.setBinding(((URI) args[i]).getLocalName(), args[i + 1]); } }
Example 4
Source File: SpinFunction.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static void addBindings(Query query, List<Argument> arguments, Value... args) { for (int i = 0; i < args.length; i++) { Argument argument = arguments.get(i); query.setBinding(argument.getPredicate().getLocalName(), args[i]); } }
Example 5
Source File: SpinTupleFunction.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static void addBindings(Query query, List<Argument> arguments, Value... args) { for (int i = 0; i < args.length; i++) { Argument argument = arguments.get(i); query.setBinding(argument.getPredicate().getLocalName(), args[i]); } }