org.aksw.commons.sparql.api.compare
Class QueryExecutionCompare

java.lang.Object
  extended by org.aksw.commons.sparql.api.compare.QueryExecutionCompare
All Implemented Interfaces:
com.hp.hpl.jena.query.QueryExecution

public class QueryExecutionCompare
extends Object
implements com.hp.hpl.jena.query.QueryExecution

Author:
Claus Stadler

Date: 1/5/12 Time: 12:33 AM


Constructor Summary
QueryExecutionCompare(com.hp.hpl.jena.query.QueryExecution a, com.hp.hpl.jena.query.QueryExecution b, boolean isOrdered)
           
 
Method Summary
 void abort()
          Stop in mid execution.
 void close()
          Close the query execution and stop query evaluation as soon as convenient.
static org.aksw.commons.collections.diff.ModelDiff compareModel(com.hp.hpl.jena.rdf.model.Model a, com.hp.hpl.jena.rdf.model.Model b)
           
static org.aksw.commons.collections.diff.ListDiff<com.hp.hpl.jena.query.QuerySolution> compareOrdered(com.hp.hpl.jena.query.ResultSet a, com.hp.hpl.jena.query.ResultSet b)
          Traverse the resultset in order, and write out the missing items on each side: 1 2 --- a a b c d d gives: [c] [b] (1 lacks c, 2 lacks b)
static org.aksw.commons.collections.diff.ListDiff<com.hp.hpl.jena.query.QuerySolution> compareUnordered(com.hp.hpl.jena.query.ResultSet a, com.hp.hpl.jena.query.ResultSet b)
           
 boolean execAsk()
          Execute an ASK query
 com.hp.hpl.jena.rdf.model.Model execConstruct()
          Execute a CONSTRUCT query
 com.hp.hpl.jena.rdf.model.Model execConstruct(com.hp.hpl.jena.rdf.model.Model model)
          Execute a CONSTRUCT query, putting the statements into 'model'.
 com.hp.hpl.jena.rdf.model.Model execDescribe()
          Execute a DESCRIBE query
 com.hp.hpl.jena.rdf.model.Model execDescribe(com.hp.hpl.jena.rdf.model.Model model)
          Execute a DESCRIBE query, putting the statements into 'model'.
 com.hp.hpl.jena.query.ResultSet execSelect()
          Execute a SELECT query
 com.hp.hpl.jena.sparql.util.Context getContext()
          The properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph).
 com.hp.hpl.jena.query.Dataset getDataset()
          The dataset against which the query will execute.
 com.hp.hpl.jena.query.Query getQuery()
          The query associated with a query execution.
 boolean isDifference()
           
 void setFileManager(com.hp.hpl.jena.util.FileManager fm)
          Set the FileManger that might be used to load files.
 void setInitialBinding(com.hp.hpl.jena.query.QuerySolution binding)
          Set the initial association of variables and values.
 void setTimeout(long timeout)
          Set time, in milliseconds
 void setTimeout(long timeout1, long timeout2)
          Set time, in milliseconds
 void setTimeout(long timeout, TimeUnit timeoutUnits)
          Set a timeout on the query execution.
 void setTimeout(long timeout1, TimeUnit timeUnit1, long timeout2, TimeUnit timeUnit2)
          Set timeouts on the query execution; the first timeout refers to time to first result, the second refers to overall query execution after the first result.
static com.google.common.collect.Multiset<com.hp.hpl.jena.query.QuerySolution> toMultiset(com.hp.hpl.jena.query.ResultSet rs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryExecutionCompare

public QueryExecutionCompare(com.hp.hpl.jena.query.QueryExecution a,
                             com.hp.hpl.jena.query.QueryExecution b,
                             boolean isOrdered)
Method Detail

toMultiset

public static com.google.common.collect.Multiset<com.hp.hpl.jena.query.QuerySolution> toMultiset(com.hp.hpl.jena.query.ResultSet rs)

compareOrdered

public static org.aksw.commons.collections.diff.ListDiff<com.hp.hpl.jena.query.QuerySolution> compareOrdered(com.hp.hpl.jena.query.ResultSet a,
                                                                                                             com.hp.hpl.jena.query.ResultSet b)
Traverse the resultset in order, and write out the missing items on each side: 1 2 --- a a b c d d gives: [c] [b] (1 lacks c, 2 lacks b)

Parameters:
a -
b -
Returns:

compareUnordered

public static org.aksw.commons.collections.diff.ListDiff<com.hp.hpl.jena.query.QuerySolution> compareUnordered(com.hp.hpl.jena.query.ResultSet a,
                                                                                                               com.hp.hpl.jena.query.ResultSet b)

compareModel

public static org.aksw.commons.collections.diff.ModelDiff compareModel(com.hp.hpl.jena.rdf.model.Model a,
                                                                       com.hp.hpl.jena.rdf.model.Model b)

isDifference

public boolean isDifference()

setFileManager

public void setFileManager(com.hp.hpl.jena.util.FileManager fm)
Set the FileManger that might be used to load files. May not be supported by all QueryExecution implementations.

Specified by:
setFileManager in interface com.hp.hpl.jena.query.QueryExecution

setInitialBinding

public void setInitialBinding(com.hp.hpl.jena.query.QuerySolution binding)
Set the initial association of variables and values. May not be supported by all QueryExecution implementations.

Specified by:
setInitialBinding in interface com.hp.hpl.jena.query.QueryExecution
Parameters:
binding -

getDataset

public com.hp.hpl.jena.query.Dataset getDataset()
The dataset against which the query will execute. May be null, implying it is expected that the query itself has a dataset description.

Specified by:
getDataset in interface com.hp.hpl.jena.query.QueryExecution

getContext

public com.hp.hpl.jena.sparql.util.Context getContext()
The properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph). Keys should be URIs as strings. May be null (this implementation does not provide any configuration).

Specified by:
getContext in interface com.hp.hpl.jena.query.QueryExecution

getQuery

public com.hp.hpl.jena.query.Query getQuery()
The query associated with a query execution. May be null (QueryExecution may have been created by other means)

Specified by:
getQuery in interface com.hp.hpl.jena.query.QueryExecution

execSelect

public com.hp.hpl.jena.query.ResultSet execSelect()
Execute a SELECT query

Specified by:
execSelect in interface com.hp.hpl.jena.query.QueryExecution

execConstruct

public com.hp.hpl.jena.rdf.model.Model execConstruct()
Execute a CONSTRUCT query

Specified by:
execConstruct in interface com.hp.hpl.jena.query.QueryExecution

execConstruct

public com.hp.hpl.jena.rdf.model.Model execConstruct(com.hp.hpl.jena.rdf.model.Model model)
Execute a CONSTRUCT query, putting the statements into 'model'.

Specified by:
execConstruct in interface com.hp.hpl.jena.query.QueryExecution
Returns:
Model The model argument for casaded code.

execDescribe

public com.hp.hpl.jena.rdf.model.Model execDescribe()
Execute a DESCRIBE query

Specified by:
execDescribe in interface com.hp.hpl.jena.query.QueryExecution

execDescribe

public com.hp.hpl.jena.rdf.model.Model execDescribe(com.hp.hpl.jena.rdf.model.Model model)
Execute a DESCRIBE query, putting the statements into 'model'.

Specified by:
execDescribe in interface com.hp.hpl.jena.query.QueryExecution
Returns:
Model The model argument for casaded code.

execAsk

public boolean execAsk()
Execute an ASK query

Specified by:
execAsk in interface com.hp.hpl.jena.query.QueryExecution

abort

public void abort()
Stop in mid execution. This method can be called in parallel with other methods on the QueryExecution object. There is no guarantee that the concrete implementation actual will stop or that it will do so immediately. No operations on the query execution or any associated result set are permitted after this call and may cause exceptions to be thrown.

Specified by:
abort in interface com.hp.hpl.jena.query.QueryExecution

close

public void close()
Close the query execution and stop query evaluation as soon as convenient. It is important to close query execution objects in order to release resources such as working memory and to stop the query execution. Some storage subsystems require explicit ends of operations and this operation will cause those to be called where necessary. No operations on the query execution or any associated result set are permitted after this call. This method should not be called in parallel with other methods on the QueryExecution object.

Specified by:
close in interface com.hp.hpl.jena.query.QueryExecution

setTimeout

public void setTimeout(long timeout,
                       TimeUnit timeoutUnits)
Set a timeout on the query execution. Processing will be aborted after the timeout (which starts when the approprate exec call is made). Not all query execution systems support timeouts. A timeout of less than zero means no timeout.

Specified by:
setTimeout in interface com.hp.hpl.jena.query.QueryExecution

setTimeout

public void setTimeout(long timeout)
Set time, in milliseconds

Specified by:
setTimeout in interface com.hp.hpl.jena.query.QueryExecution
See Also:
setTimeout(long, java.util.concurrent.TimeUnit)

setTimeout

public void setTimeout(long timeout1,
                       TimeUnit timeUnit1,
                       long timeout2,
                       TimeUnit timeUnit2)
Set timeouts on the query execution; the first timeout refers to time to first result, the second refers to overall query execution after the first result. Processing will be aborted if a timeout expires. Not all query execution systems support timeouts. A timeout of less than zero means no timeout; this can be used for timeout1 or timeout2.

Specified by:
setTimeout in interface com.hp.hpl.jena.query.QueryExecution

setTimeout

public void setTimeout(long timeout1,
                       long timeout2)
Set time, in milliseconds

Specified by:
setTimeout in interface com.hp.hpl.jena.query.QueryExecution
See Also:
setTimeout(long, java.util.concurrent.TimeUnit, long, java.util.concurrent.TimeUnit)


Copyright © 2012. All Rights Reserved.