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.http;
07:
08: import java.io.IOException;
09:
10: import org.openrdf.http.client.HTTPClient;
11: import org.openrdf.query.BooleanQuery;
12: import org.openrdf.query.MalformedQueryException;
13: import org.openrdf.query.QueryLanguage;
14: import org.openrdf.repository.RepositoryException;
15:
16: /**
17: * TupleQuery specific to the HTTP protocol. Methods in this class may throw the
18: * specific RepositoryException subclasses UnautorizedException and
19: * NotAllowedException, the semantics of which are defined by the HTTP protocol.
20: *
21: * @see org.openrdf.http.protocol.UnauthorizedException
22: * @see org.openrdf.http.protocol.NotAllowedException
23: * @author Arjohn Kampman
24: */
25: public class HTTPBooleanQuery extends HTTPQuery implements BooleanQuery {
26:
27: public HTTPBooleanQuery(HTTPRepositoryConnection con,
28: QueryLanguage ql, String queryString, String baseURI) {
29: super (con, ql, queryString, baseURI);
30: }
31:
32: public boolean evaluate() throws HTTPQueryEvaluationException {
33: HTTPClient client = httpCon.getRepository().getHTTPClient();
34:
35: try {
36: return client.sendBooleanQuery(queryLanguage, queryString,
37: dataset, includeInferred, getBindingsArray());
38: } catch (IOException e) {
39: throw new HTTPQueryEvaluationException(e.getMessage(), e);
40: } catch (RepositoryException e) {
41: throw new HTTPQueryEvaluationException(e.getMessage(), e);
42: } catch (MalformedQueryException e) {
43: throw new HTTPQueryEvaluationException(e.getMessage(), e);
44: }
45: }
46: }
|