org.openrdf.repository.sparql.query
Class SPARQLQuery

java.lang.Object
  extended by org.openrdf.repository.sparql.query.SPARQLQuery
All Implemented Interfaces:
Operation, Query
Direct Known Subclasses:
SPARQLBooleanQuery, SPARQLGraphQuery, SPARQLTupleQuery

public abstract class SPARQLQuery
extends Object
implements Query

Provides an execution thread for background result parsing and inlines binding in a SPARQL query.

Author:
James Leigh

Constructor Summary
SPARQLQuery(org.apache.commons.httpclient.HttpClient client, String url, String base, String query)
           
 
Method Summary
 void clearBindings()
          Removes all previously set bindings.
protected  void execute(Runnable command)
           
protected abstract  String getAccept()
           
protected  Set<String> getBindingNames()
           
 BindingSet getBindings()
          Retrieves the bindings that have been set on this operation.
 Dataset getDataset()
          Gets the dataset that has been set using Operation.setDataset(Dataset), if any.
 boolean getIncludeInferred()
          Returns whether or not this operation will return inferred statements (if any are present in the repository).
 int getMaxQueryTime()
          Returns the maximum query evaluation time.
protected  org.apache.commons.httpclient.HttpMethodBase getResponse()
           
 String getUrl()
           
 void removeBinding(String name)
          Removes a previously set binding on the supplied variable.
 void setBinding(String name, Value value)
          Binds the specified variable to the supplied value.
 void setDataset(Dataset dataset)
          Specifies the dataset against which to execute an operation, overriding any dataset that is specified in the operation itself.
 void setIncludeInferred(boolean inf)
          Determine whether evaluation results of this operation should include inferred statements (if any inferred statements are present in the repository).
 void setMaxQueryTime(int maxQueryTime)
          Specifies the maximum time that a query is allowed to run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPARQLQuery

public SPARQLQuery(org.apache.commons.httpclient.HttpClient client,
                   String url,
                   String base,
                   String query)
Method Detail

getBindings

public BindingSet getBindings()
Description copied from interface: Operation
Retrieves the bindings that have been set on this operation.

Specified by:
getBindings in interface Operation
Returns:
A (possibly empty) set of operation variable bindings.
See Also:
Operation.setBinding(String, Value)

getDataset

public Dataset getDataset()
Description copied from interface: Operation
Gets the dataset that has been set using Operation.setDataset(Dataset), if any.

Specified by:
getDataset in interface Operation

getIncludeInferred

public boolean getIncludeInferred()
Description copied from interface: Operation
Returns whether or not this operation will return inferred statements (if any are present in the repository).

Specified by:
getIncludeInferred in interface Operation
Returns:
true if inferred statements will be returned, false otherwise.

getMaxQueryTime

public int getMaxQueryTime()
Description copied from interface: Query
Returns the maximum query evaluation time.

Specified by:
getMaxQueryTime in interface Query
Returns:
The maximum query evaluation time, measured in seconds.
See Also:
Query.setMaxQueryTime(int)

removeBinding

public void removeBinding(String name)
Description copied from interface: Operation
Removes a previously set binding on the supplied variable. Calling this method with an unbound variable name has no effect.

Specified by:
removeBinding in interface Operation
Parameters:
name - The name of the variable from which the binding is to be removed.

setBinding

public void setBinding(String name,
                       Value value)
Description copied from interface: Operation
Binds the specified variable to the supplied value. Any value that was previously bound to the specified value will be overwritten.

Specified by:
setBinding in interface Operation
Parameters:
name - The name of the variable that should be bound.
value - The (new) value for the specified variable.

clearBindings

public void clearBindings()
Description copied from interface: Operation
Removes all previously set bindings.

Specified by:
clearBindings in interface Operation

setDataset

public void setDataset(Dataset dataset)
Description copied from interface: Operation
Specifies the dataset against which to execute an operation, overriding any dataset that is specified in the operation itself.

Specified by:
setDataset in interface Operation

setIncludeInferred

public void setIncludeInferred(boolean inf)
Description copied from interface: Operation
Determine whether evaluation results of this operation should include inferred statements (if any inferred statements are present in the repository). The default setting is 'true'.

Specified by:
setIncludeInferred in interface Operation
Parameters:
inf - indicates whether inferred statements should be included in the result.

setMaxQueryTime

public void setMaxQueryTime(int maxQueryTime)
Description copied from interface: Query
Specifies the maximum time that a query is allowed to run. The query will be interrupted when it exceeds the time limit. Any consecutive requests to fetch query results will result in QueryInterruptedExceptions.

Specified by:
setMaxQueryTime in interface Query
Parameters:
maxQueryTime - The maximum query time, measured in seconds. A negative or zero value indicates an unlimited query time (which is the default).

getUrl

public String getUrl()

getResponse

protected org.apache.commons.httpclient.HttpMethodBase getResponse()
                                                            throws org.apache.commons.httpclient.HttpException,
                                                                   IOException,
                                                                   QueryEvaluationException
Throws:
org.apache.commons.httpclient.HttpException
IOException
QueryEvaluationException

execute

protected void execute(Runnable command)

getBindingNames

protected Set<String> getBindingNames()

getAccept

protected abstract String getAccept()


Copyright © 2001-2012 Aduna. All Rights Reserved.