/** * Creates one or more {@link Statement} objects with the given subject, predicate and object, one for * each given context. If no context is supplied, only a single statement (without any assigned context) * is created. * * @param vf * the {@link ValueFactory} to use for creating statements. * @param subject * the subject of each statement. May not be null. * @param predicate * the predicate of each statement. May not be null. * @param object * the object of each statement. May not be null. * @param collection * the collection of Statements to which the newly created Statements will be added. May not be * null. * @return the input collection of Statements, with the newly created Statements added. * @param contexts * the context(s) for which to produce statements. This argument is an optional vararg: leave it * out completely to produce a single statement without context. */ public static <C extends Collection<Statement>> C create(ValueFactory vf, Resource subject, IRI predicate, Value object, C collection, Resource... contexts) { Objects.requireNonNull(collection); consume(vf, subject, predicate, object, st -> collection.add(st), contexts); return collection; }
while (stmts.hasNext()) { Statement nextStmt = stmts.next(); if (!org.eclipse.rdf4j.model.util.Statements.isSameTriple(stmt, nextStmt)) { throw new QueryEvaluationException( "Multiple statements for pattern: " + subj + " " + pred + " " + obj);
while (stmts.hasNext()) { Statement nextStmt = stmts.next(); if (!org.eclipse.rdf4j.model.util.Statements.isSameTriple(stmt, nextStmt)) { throw new QueryEvaluationException( "Multiple statements for pattern: " + subj + " " + pred + " " + obj);
/** * Creates one or more {@link Statement} objects with the given subject, predicate and object, one for * each given context. If no context is supplied, only a single statement (without any assigned context) * is created. * * @param vf * the {@link ValueFactory} to use for creating statements. * @param subject * the subject of each statement. May not be null. * @param predicate * the predicate of each statement. May not be null. * @param object * the object of each statement. May not be null. * @param collection * the collection of Statements to which the newly created Statements will be added. May not be * null. * @return the input collection of Statements, with the newly created Statements added. * @param contexts * the context(s) for which to produce statements. This argument is an optional vararg: leave it * out completely to produce a single statement without context. */ public static <C extends Collection<Statement>> C create(ValueFactory vf, Resource subject, IRI predicate, Value object, C collection, Resource... contexts) { Objects.requireNonNull(collection); consume(vf, subject, predicate, object, st -> collection.add(st), contexts); return collection; }
Statements.consume(vf, current, RDF.TYPE, RDF.LIST, consumer, contexts); Object o = iter.next(); Value v = o instanceof Value ? (Value)o : Literals.createLiteralOrFail(vf, o); Statements.consume(vf, current, RDF.FIRST, v, consumer, contexts); if (iter.hasNext()) { Resource next = vf.createBNode(); Statements.consume(vf, current, RDF.REST, next, consumer, contexts); current = next; Statements.consume(vf, current, RDF.REST, RDF.NIL, consumer, contexts);
Statements.consume(vf, current, RDF.TYPE, RDF.LIST, consumer, contexts); Object o = iter.next(); Value v = o instanceof Value ? (Value)o : Literals.createLiteralOrFail(vf, o); Statements.consume(vf, current, RDF.FIRST, v, consumer, contexts); if (iter.hasNext()) { Resource next = vf.createBNode(); Statements.consume(vf, current, RDF.REST, next, consumer, contexts); current = next; Statements.consume(vf, current, RDF.REST, RDF.NIL, consumer, contexts);