@Override public void evaluate(TupleQueryResultHandler handler) throws QueryEvaluationException, TupleQueryResultHandlerException { TupleQueryResult queryResult = evaluate(); QueryResults.report(queryResult, handler); } }
@Override protected boolean accept(BindingSet outputBindings) throws QueryEvaluationException { return QueryResults.bindingSetsCompatible(inputBindings, outputBindings); } }
/** * Get a {@link Model} containing all elements obtained from the specified query result. * * @param iteration * the source iteration to get the statements from. This can be a {@link GraphQueryResult}, a * {@link RepositoryResult<Statement>}, or any other instance of {@link CloseableIteration * <Statement>} * @return a {@link Model} containing all statements obtained from the specified source iteration. */ public static Model asModel(CloseableIteration<? extends Statement, ? extends RDF4JException> iteration) throws QueryEvaluationException { Model model = new LinkedHashModel(); addAll(iteration, model); return model; }
BindingSet bs1 = queryResult1.get(idx); List<BindingSet> matchingBindingSets = findMatchingBindingSets(bs1, queryResult2, bNodeMapping); result = matchBindingSets(queryResult1, queryResult2, newBNodeMapping, idx + 1);
@Override public void write(DataSource ds) { try (RepositoryConnection conn = repo.getConnection()) { RepositoryResult<Resource> contexts = conn.getContextIDs(); while (contexts.hasNext()) { Resource context = contexts.next(); LOGGER.info("Writing context {}", context); RepositoryResult<Statement> statements; statements = conn.getStatements(null, null, null, context); Model model = QueryResults.asModel(statements); copyNamespacesToModel(conn, model); String outname = context.toString(); write(model, outputStream(ds, outname)); } } }
? QueryResults.distinctResults(tQuery.evaluate()) : tQuery.evaluate(); queryResult = QueryResults.limitResults(tqr, limit, offset); ? QueryResults.distinctResults(gQuery.evaluate()) : gQuery.evaluate(); queryResult = QueryResults.limitResults(qqr, limit, offset);
private static List<BindingSet> findMatchingBindingSets(BindingSet st, Iterable<? extends BindingSet> model, Map<BNode, BNode> bNodeMapping) { List<BindingSet> result = new ArrayList<BindingSet>(); for (BindingSet modelSt : model) { if (bindingSetsMatch(st, modelSt, bNodeMapping)) { // All components possibly match result.add(modelSt); } } return result; }
private static QueryResult<?> distinct(QueryResult<?> qr) { if (qr instanceof TupleQueryResult) { TupleQueryResult tqr = (TupleQueryResult)qr; return QueryResults.distinctResults(tqr); } else if (qr instanceof GraphQueryResult) { GraphQueryResult gqr = (GraphQueryResult)qr; return QueryResults.distinctResults(gqr); } else { return qr; } }
BindingSet bs1 = queryResult1.get(idx); List<BindingSet> matchingBindingSets = findMatchingBindingSets(bs1, queryResult2, bNodeMapping); result = matchBindingSets(queryResult1, queryResult2, newBNodeMapping, idx + 1);
@Deprecated public static RepositoryConfig getRepositoryConfig(Repository repository, String repositoryID) throws RepositoryConfigException, RepositoryException { try (RepositoryConnection con = repository.getConnection()) { Statement idStatement = getIDStatement(con, repositoryID); if (idStatement == null) { // No such config return null; } Resource repositoryNode = idStatement.getSubject(); Resource context = idStatement.getContext(); if (context == null) { throw new RepositoryException("No configuration context for repository " + repositoryID); } Model contextGraph = QueryResults.asModel(con.getStatements(null, null, null, true, context)); return RepositoryConfig.create(contextGraph, repositoryNode); } }
private static List<BindingSet> findMatchingBindingSets(BindingSet st, Iterable<? extends BindingSet> model, Map<BNode, BNode> bNodeMapping) { List<BindingSet> result = new ArrayList<BindingSet>(); for (BindingSet modelSt : model) { if (bindingSetsMatch(st, modelSt, bNodeMapping)) { // All components possibly match result.add(modelSt); } } return result; }
try (TupleQueryResult r = QueryResults.distinctResults(q.evaluate())) { List<String> names = r.getBindingNames(); while (r.hasNext()) {
@Override public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { GraphQueryResult queryResult = evaluate(); QueryResults.report(queryResult, handler); } }
@Override protected boolean accept(BindingSet outputBindings) throws QueryEvaluationException { return QueryResults.bindingSetsCompatible(inputBindings, outputBindings); } }
BindingSet bs1 = queryResult1.get(idx); List<BindingSet> matchingBindingSets = findMatchingBindingSets(bs1, queryResult2, bNodeMapping); result = matchBindingSets(queryResult1, queryResult2, newBNodeMapping, idx + 1);
@Deprecated public static RepositoryConfig getRepositoryConfig(Repository repository, String repositoryID) throws RepositoryConfigException, RepositoryException { RepositoryConnection con = repository.getConnection(); try { Statement idStatement = getIDStatement(con, repositoryID); if (idStatement == null) { // No such config return null; } Resource repositoryNode = idStatement.getSubject(); Resource context = idStatement.getContext(); if (context == null) { throw new RepositoryException("No configuration context for repository " + repositoryID); } Model contextGraph = QueryResults.asModel(con.getStatements(null, null, null, true, context)); return RepositoryConfig.create(contextGraph, repositoryNode); } finally { con.close(); } }
private static List<BindingSet> findMatchingBindingSets(BindingSet st, Iterable<? extends BindingSet> model, Map<BNode, BNode> bNodeMapping) { List<BindingSet> result = new ArrayList<>(); for (BindingSet modelSt : model) { if (bindingSetsMatch(st, modelSt, bNodeMapping)) { // All components possibly match result.add(modelSt); } } return result; }
/** * Get a {@link Model} containing all elements obtained from the specified query result. * * @param iteration * the source iteration to get the statements from. This can be a {@link GraphQueryResult}, a * {@link RepositoryResult<Statement>}, or any other instance of {@link CloseableIteration * <Statement>} * @return a {@link Model} containing all statements obtained from the specified source iteration. */ public static Model asModel(CloseableIteration<? extends Statement, ? extends RDF4JException> iteration) throws QueryEvaluationException { Model model = new LinkedHashModel(); addAll(iteration, model); return model; }
@Override public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { GraphQueryResult queryResult = evaluate(); QueryResults.report(queryResult, handler); } }
if (QueryResults.bindingSetsCompatible(excluded, object)) {