public static GraphQueryResult query(RepositoryConnection connection, ParsedGraphQuery graphQueryModel, boolean includeInferred) throws org.openrdf.repository.RepositoryException, QueryEvaluationException { return getQuery(connection, graphQueryModel, includeInferred).evaluate(); }
public static GraphResult query(RepositoryConnection connection, GraphQueryModel graphQueryModel, boolean includeInferred) throws StoreException { return getQuery(connection, graphQueryModel, includeInferred).evaluate(); }
public static GraphResult query(RepositoryConnection connection, GraphQueryModel graphQueryModel, boolean includeInferred) throws StoreException{ return getQuery(connection, graphQueryModel, includeInferred).evaluate(); }
public GraphQueryResult asGraphQueryResult() throws OpenRDFException { return prepareGraphQuery().evaluate(); }
public GraphQueryResult asGraphQueryResult() throws OpenRDFException { return prepareGraphQuery().evaluate(); }
@Override public CloseableIterator<STMT> getTriples() { try { return new GraphResultIterator(graphQuery.evaluate(), dialect); } catch (StoreException e) { throw new RepositoryException(e); } }
@Override public CloseableIterator<STMT> getTriples() { try { return new GraphResultIterator(graphQuery.evaluate(), dialect); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
@Override public CloseableIterator<STMT> getTriples() { try { return new GraphResultIterator(graphQuery.evaluate(), dialect); } catch (StoreException e) { throw new RepositoryException(e); } }
public Model asModel() throws OpenRDFException { GraphQuery qry = prepareGraphQuery(); Model model = new LinkedHashModel(); qry.evaluate(new StatementCollector(model)); return model; }
private void query(GraphQuery query, OutputStream output, RDFFormat format) throws QueryEvaluationException { try { QueryResultIO.write(query.evaluate(), format, output); } catch (IOException | RDFHandlerException e) { throw new QueryEvaluationException("error while writing query graph result: ",e); } catch(UnsupportedRDFormatException e) { throw new QueryEvaluationException("Could not find requested output RDF format for results of query: ",e); } }
public Model asModel() throws OpenRDFException { GraphQuery qry = prepareGraphQuery(); Model model = new LinkedHashModel(); qry.evaluate(new StatementCollector(model)); return model; }
private void query(GraphQuery query, OutputStream output, RDFFormat format) throws QueryEvaluationException { try { QueryResultIO.write(query.evaluate(), format, output); } catch (IOException | RDFHandlerException e) { throw new QueryEvaluationException("error while writing query graph result: ",e); } catch(UnsupportedRDFormatException e) { throw new QueryEvaluationException("Could not find requested output RDF format for results of query: ",e); } }
public GraphQueryResult evaluate() throws QueryEvaluationException { GraphQueryResult result = delegate.evaluate(); CloseableIteration<Statement, QueryEvaluationException> iter; iter = new AStatementIterator<QueryEvaluationException>(result, node, "subject", "object"); return new GraphQueryResultImpl(result.getNamespaces(), iter); }
public ClosableIterable<Statement> sparqlDescribe(String queryString) throws ModelRuntimeException { this.assertModel(); GraphQuery query; try { query = this.connection.prepareGraphQuery(QueryLanguage.SPARQL, queryString); GraphQueryResult graphQueryResult = query.evaluate(); return new StatementIterable(graphQueryResult, null); } catch (OpenRDFException e) { throw new ModelRuntimeException(e); } }
@Override public ClosableIterable<Statement> sparqlConstruct(String queryString) throws ModelRuntimeException { this.assertModel(); GraphQuery query; try { query = this.connection.prepareGraphQuery(QueryLanguage.SPARQL, queryString); GraphQueryResult graphQueryResult = query.evaluate(); return new StatementIterable(graphQueryResult, null); } catch(OpenRDFException e) { throw new ModelRuntimeException(e); } }
@Override public ClosableIterable<Statement> sparqlDescribe(String queryString) throws ModelRuntimeException { this.assertModel(); GraphQuery query; try { query = this.connection.prepareGraphQuery(QueryLanguage.SPARQL, queryString); GraphQueryResult graphQueryResult = query.evaluate(); return new StatementIterable(graphQueryResult, null); } catch(OpenRDFException e) { throw new ModelRuntimeException(e); } }
@Override public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { try { GraphQuery query = prepareStatementQuery(subj, pred, obj, contexts); return new SPARQLResult(query.evaluate()); } catch (MalformedQueryException e) { throw new RepositoryException(e); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } }
public ClosableIterable<Statement> sparqlConstruct(String queryString) throws ModelRuntimeException { this.assertModel(); GraphQuery query; try { query = this.connection.prepareGraphQuery(QueryLanguage.SPARQL, queryString); GraphQueryResult graphQueryResult = query.evaluate(); return new StatementIterable(graphQueryResult, null); } catch (OpenRDFException e) { throw new ModelRuntimeException(e); } }
@Override public void streamTriples(Writer writer, String contentType) { try { RDFFormat targetFormat = RDFFormat.forMIMEType(contentType); if (targetFormat == null) { targetFormat = RDFFormat.RDFXML; } RDFWriter rdfWriter = Rio.createWriter(targetFormat, writer); graphQuery.evaluate(rdfWriter); } catch (QueryEvaluationException e) { throw new RepositoryException(e); } catch (RDFHandlerException e) { throw new RepositoryException(e); } }
@Test public void testSES2104ConstructBGPSameURI() throws Exception { final String queryStr = "PREFIX : <urn:> CONSTRUCT {:x :p :x } WHERE {} "; conn.add(new StringReader("@prefix : <urn:> . :a :p :b . "), "", RDFFormat.TURTLE); final IRI x = conn.getValueFactory().createIRI("urn:x"); final IRI p = conn.getValueFactory().createIRI("urn:p"); GraphQuery query = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr); Model result = QueryResults.asModel(query.evaluate()); assertNotNull(result); assertFalse(result.isEmpty()); assertTrue(result.contains(x, p, x)); }