net.sf.sparql.benchmarking.operations.query.callables
Class AbstractScalarValueCallable<T extends Options,TCallable extends AbstractQueryCallable<T>>

java.lang.Object
  extended by net.sf.sparql.benchmarking.operations.AbstractOperationCallable<T>
      extended by net.sf.sparql.benchmarking.operations.query.callables.AbstractQueryCallable<T>
          extended by net.sf.sparql.benchmarking.operations.query.callables.WrapperQueryCallable<T,TCallable>
              extended by net.sf.sparql.benchmarking.operations.query.callables.AbstractScalarValueCallable<T,TCallable>
Type Parameters:
T - Options type
TCallable - Callable type
All Implemented Interfaces:
Callable<OperationRun>, OperationCallable<T>
Direct Known Subclasses:
LongValueCallable

public abstract class AbstractScalarValueCallable<T extends Options,TCallable extends AbstractQueryCallable<T>>
extends WrapperQueryCallable<T,TCallable>

A callable which counts SELECT results by retrieving the value of a specific column of the first row and then converting that value into an integer

Author:
rvesse

Constructor Summary
AbstractScalarValueCallable(Runner<T> runner, T options, TCallable callable, String var)
          Creates a new scalar value callable
 
Method Summary
protected  long countResults(T options, ResultSet rset)
          Counts results for queries that return a result set
protected abstract  long nodeToLong(Node n)
          Method that should be implemented by derived classes to convert the node into an integer
 
Methods inherited from class net.sf.sparql.benchmarking.operations.query.callables.WrapperQueryCallable
call, countResults, countResults, createQueryExecution, customizeRequest, getQuery
 
Methods inherited from class net.sf.sparql.benchmarking.operations.AbstractOperationCallable
cancel, getOptions, getRunner, isCancelled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScalarValueCallable

public AbstractScalarValueCallable(Runner<T> runner,
                                   T options,
                                   TCallable callable,
                                   String var)
Creates a new scalar value callable

Parameters:
runner - Runner
options - Options
callable - Callable to decorate
var - Variable name to take the value from
Method Detail

countResults

protected long countResults(T options,
                            ResultSet rset)
Description copied from class: AbstractQueryCallable
Counts results for queries that return a result set

The default implementation either returns OperationRun.UNKNOWN if the options indicate that counting is disabled or iterates over the results to count them.

Overrides:
countResults in class WrapperQueryCallable<T extends Options,TCallable extends AbstractQueryCallable<T>>
Parameters:
options - Options
rset - Result Set
Returns:
Number of results

nodeToLong

protected abstract long nodeToLong(Node n)
Method that should be implemented by derived classes to convert the node into an integer

Parameters:
n - Node
Returns:
Long integer


Copyright © 2014. All Rights Reserved.