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.QueryEvaluationException;
09: import org.openrdf.query.TupleQuery;
10: import org.openrdf.query.TupleQueryResult;
11: import org.openrdf.query.TupleQueryResultHandler;
12: import org.openrdf.query.TupleQueryResultHandlerException;
13: import org.openrdf.repository.sail.SailTupleQuery;
14:
15: /**
16: * @author Arjohn Kampman
17: */
18: class DatasetTupleQuery extends DatasetQuery implements TupleQuery {
19:
20: protected DatasetTupleQuery(DatasetRepositoryConnection con,
21: SailTupleQuery sailQuery) {
22: super (con, sailQuery);
23: }
24:
25: public TupleQueryResult evaluate() throws QueryEvaluationException {
26: con.loadDataset(sailQuery.getActiveDataset());
27: return ((TupleQuery) sailQuery).evaluate();
28: }
29:
30: public void evaluate(TupleQueryResultHandler handler)
31: throws QueryEvaluationException,
32: TupleQueryResultHandlerException {
33: con.loadDataset(sailQuery.getActiveDataset());
34: ((TupleQuery) sailQuery).evaluate(handler);
35: }
36: }
|