public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { con.loadDataset(sailQuery.getActiveDataset()); ((GraphQuery)sailQuery).evaluate(handler); } }
public GraphQueryResult evaluate() throws QueryEvaluationException { con.loadDataset(sailQuery.getActiveDataset()); return ((GraphQuery)sailQuery).evaluate(); }
public GraphQueryResult evaluate() throws QueryEvaluationException { con.loadDataset(sailQuery.getActiveDataset()); return ((GraphQuery)sailQuery).evaluate(); }
public void evaluate(RDFHandler handler) throws QueryEvaluationException, RDFHandlerException { con.loadDataset(sailQuery.getActiveDataset()); ((GraphQuery)sailQuery).evaluate(handler); } }
/** * Evaluate a {@link GraphQuery} in this transaction and return the result. * * @param gQuery * a {@link GraphQuery} prepared on this transaction. * @return a {@link GraphQueryResult} * @throws InterruptedException * if the transaction thread is interrupted * @throws ExecutionException * if an error occurs while executing the operation. */ GraphQueryResult evaluate(GraphQuery gQuery) throws InterruptedException, ExecutionException { Future<GraphQueryResult> result = submit(() -> gQuery.evaluate()); return getFromFuture(result); }
/** * Performs a SPARQL Construct or Describe query on the given Repository without opening a transaction and * passes the results to the given {@link RDFHandler}. * * @param repository * The {@link Repository} to open a connection to. * @param query * The SPARQL Construct or Describe query to execute. * @param handler * An {@link RDFHandler} that consumes the results. * @throws RepositoryException * If there was an exception dealing with the Repository. * @throws UnknownTransactionStateException * If the transaction state was not properly recognised. (Optional specific exception) * @throws MalformedQueryException * If the supplied query is malformed * @throws QueryEvaluationException * If there was an error evaluating the query */ public static void graphQueryNoTransaction(Repository repository, String query, RDFHandler handler) throws RepositoryException, UnknownTransactionStateException, MalformedQueryException, QueryEvaluationException { consumeNoTransaction(repository, conn -> { GraphQuery preparedQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, query); preparedQuery.evaluate(handler); }); }
/** * Performs a SPARQL Construct or Describe query on the given Repository without opening a transaction and * passes the results to the given {@link RDFHandler}. * * @param repository * The {@link Repository} to open a connection to. * @param query * The SPARQL Construct or Describe query to execute. * @param handler * An {@link RDFHandler} that consumes the results. * @throws RepositoryException * If there was an exception dealing with the Repository. * @throws UnknownTransactionStateException * If the transaction state was not properly recognised. (Optional specific exception) * @throws MalformedQueryException * If the supplied query is malformed * @throws QueryEvaluationException * If there was an error evaluating the query */ public static void graphQueryNoTransaction(Repository repository, String query, RDFHandler handler) throws RepositoryException, UnknownTransactionStateException, MalformedQueryException, QueryEvaluationException { consumeNoTransaction(repository, conn -> { GraphQuery preparedQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, query); preparedQuery.evaluate(handler); }); }
/** * Performs a SPARQL Construct or Describe query on the given Repository within a transaction and passes * the results to the given {@link RDFHandler}. * * @param repository * The {@link Repository} to open a connection to. * @param query * The SPARQL Construct or Describe query to execute. * @param handler * An {@link RDFHandler} that consumes the results. * @throws RepositoryException * If there was an exception dealing with the Repository. * @throws UnknownTransactionStateException * If the transaction state was not properly recognised. (Optional specific exception) * @throws MalformedQueryException * If the supplied query is malformed * @throws QueryEvaluationException * If there was an error evaluating the query */ public static void graphQuery(Repository repository, String query, RDFHandler handler) throws RepositoryException, UnknownTransactionStateException, MalformedQueryException, QueryEvaluationException { consume(repository, conn -> { GraphQuery preparedQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, query); preparedQuery.evaluate(handler); }); }
/** * Performs a SPARQL Construct or Describe query on the given Repository within a transaction and passes * the results to the given {@link RDFHandler}. * * @param repository * The {@link Repository} to open a connection to. * @param query * The SPARQL Construct or Describe query to execute. * @param handler * An {@link RDFHandler} that consumes the results. * @throws RepositoryException * If there was an exception dealing with the Repository. * @throws UnknownTransactionStateException * If the transaction state was not properly recognised. (Optional specific exception) * @throws MalformedQueryException * If the supplied query is malformed * @throws QueryEvaluationException * If there was an error evaluating the query */ public static void graphQuery(Repository repository, String query, RDFHandler handler) throws RepositoryException, UnknownTransactionStateException, MalformedQueryException, QueryEvaluationException { consume(repository, conn -> { GraphQuery preparedQuery = conn.prepareGraphQuery(QueryLanguage.SPARQL, query); preparedQuery.evaluate(handler); }); }
public void exportStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, RDFHandler handler, Resource... contexts) throws RepositoryException, RDFHandlerException { try { GraphQuery query = prepareGraphQuery(SPARQL, EVERYTHING, ""); setBindings(query, subj, pred, obj, contexts); query.evaluate(handler); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
public void exportStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, RDFHandler handler, Resource... contexts) throws RepositoryException, RDFHandlerException { try { GraphQuery query = prepareGraphQuery(SPARQL, EVERYTHING, ""); setBindings(query, subj, pred, obj, contexts); query.evaluate(handler); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
@Override public void exportStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, RDFHandler handler, Resource... contexts) throws RepositoryException, RDFHandlerException { try { GraphQuery query = prepareGraphQuery(SPARQL, EVERYTHING, ""); setBindings(query, subj, pred, obj, contexts); query.evaluate(handler); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
query.setIncludeInferred(includeInferred); setBindings(query, subj, pred, obj, contexts); gRes = query.evaluate(); result = new RepositoryResult<Statement>( new ExceptionConvertingIteration<Statement, RepositoryException>(gRes)
GraphQueryResult gqr = ((GraphQuery)query).evaluate(); Set<Statement> queryResult = Iterations.asSet(gqr); Set<Statement> expectedResult = readExpectedGraphQueryResult();
private static void translateRDFDocumentUseingConstructQuery(final String query, final File inputFile, final OutputStream out, final RDFFormat inFormat, final RDFFormat outFormat, final String baseURI) throws SailException, IOException, RDFHandlerException, RDFParseException, RepositoryException, MalformedQueryException, QueryEvaluationException { Sail sail = new MemoryStore(); sail.initialize(); try { Repository repo = new SailRepository(sail); try (RepositoryConnection rc = repo.getConnection()) { rc.add(inputFile, baseURI, inFormat); rc.commit(); RDFWriter w = Rio.createWriter(outFormat, out); rc.prepareGraphQuery(QueryLanguage.SPARQL, query).evaluate(w); } } finally { sail.shutDown(); } } }
@Override public CloseableIteration<? extends List<? extends Value>, QueryEvaluationException> evaluate( ValueFactory valueFactory, Value... args) throws QueryEvaluationException { QueryPreparer qp = getCurrentQueryPreparer(); if (args.length == 0 || !(args[0] instanceof Resource)) { throw new QueryEvaluationException("First argument must be a resource"); } if ((args.length % 2) == 0) { throw new QueryEvaluationException("Old number of arguments required"); } try { ParsedGraphQuery graphQuery = parser.parseConstructQuery((Resource)args[0], qp.getTripleSource()); GraphQuery queryOp = qp.prepare(graphQuery); addBindings(queryOp, args); final GraphQueryResult queryResult = queryOp.evaluate(); return new GraphQueryResultIteration(queryResult); } catch (QueryEvaluationException e) { throw e; } catch (RDF4JException e) { throw new ValueExprEvaluationException(e); } }
addBindings(subj, constraint, graphQuery, queryOp, tripleSource, parser); ConstraintViolationRDFHandler handler = new ConstraintViolationRDFHandler(); queryOp.evaluate(handler); violation = handler.getConstraintViolation();
addBindings(subj, constraint, graphQuery, queryOp, tripleSource, parser); ConstraintViolationRDFHandler handler = new ConstraintViolationRDFHandler(); queryOp.evaluate(handler); violation = handler.getConstraintViolation();
CountingRDFInferencerInserter handler = new CountingRDFInferencerInserter(conn, tripleSource.getValueFactory()); queryOp.evaluate(handler); nofInferred = handler.getStatementCount();
queryBuilder.append(" USING NAMESPACE foaf = <" + FOAF_NS + ">"); GraphQueryResult result = testCon.prepareGraphQuery(QueryLanguage.SERQL, queryBuilder.toString()).evaluate();