01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.repository.dataset;
07:
08: import org.openrdf.query.GraphQuery;
09: import org.openrdf.query.GraphQueryResult;
10: import org.openrdf.query.QueryEvaluationException;
11: import org.openrdf.repository.sail.SailGraphQuery;
12: import org.openrdf.rio.RDFHandler;
13: import org.openrdf.rio.RDFHandlerException;
14:
15: /**
16: * @author Arjohn Kampman
17: */
18: class DatasetGraphQuery extends DatasetQuery implements GraphQuery {
19:
20: protected DatasetGraphQuery(DatasetRepositoryConnection con,
21: SailGraphQuery sailQuery) {
22: super (con, sailQuery);
23: }
24:
25: public GraphQueryResult evaluate() throws QueryEvaluationException {
26: con.loadDataset(sailQuery.getActiveDataset());
27: return ((GraphQuery) sailQuery).evaluate();
28: }
29:
30: public void evaluate(RDFHandler handler)
31: throws QueryEvaluationException, RDFHandlerException {
32: con.loadDataset(sailQuery.getActiveDataset());
33: ((GraphQuery) sailQuery).evaluate(handler);
34: }
35: }
|