Package org.intermine.api.query
Class WebResultsExecutor
- java.lang.Object
-
- org.intermine.api.query.QueryExecutor
-
- org.intermine.api.query.WebResultsExecutor
-
public class WebResultsExecutor extends QueryExecutor
Executes a PathQuery and returns a WebResults object, to be used when multi-row style results are required.- Author:
- Richard Smith, Jakub Kulaviak, Alex Kalderimis
-
-
Field Summary
-
Fields inherited from class org.intermine.api.query.QueryExecutor
bagManager, bagQueryRunner, os, profile, queryToPathToQueryNode, summaryBatchSize
-
-
Constructor Summary
Constructors Constructor Description WebResultsExecutor(InterMineAPI im, Profile profile)
Constructor with necessary objects to generate an ObjectStore query from a PathQuery and execute it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebResults
execute(PathQuery pathQuery)
Create and ObjectStore query from a PathQuery and execute it, returning results in a format appropriate for displaying a web table.WebResults
execute(PathQuery pathQuery, java.util.Map<java.lang.String,BagQueryResult> pathToBagQueryResult)
Create and ObjectStore query from a PathQuery and execute it, returning results in a format appropriate for displaying a web table.ResultsInfo
explain(PathQuery pathQuery)
Explain a query and return estimates of execution time and row count.java.util.Map<PathQuery,ResultsInfo>
getInfoCache()
Returns the entire infoCache, which is an unmodifiable Map from PathQuery (by identity) to ResultsInfo.ResultsInfo
getQueryInfo(PathQuery query)
Retrieve an entry from the infoCache.Query
makeQuery(PathQuery pathQuery)
Creates an IQL query from a PathQuery.Query
makeQuery(PathQuery pathQuery, java.util.Map<java.lang.String,BagQueryResult> pathToBagQueryResult, java.util.Map<java.lang.String,QuerySelectable> pathToQueryNode)
Creates an IQL query from a PathQuery.java.lang.String
makeSql(PathQuery pathQuery)
Creates an SQL query from a PathQuery.boolean
precomputeTemplate(TemplateQuery t)
Precomputes a template query if it is not already precomputed, returning whether precomputing was necessary.void
setQueryInfo(PathQuery query, ResultsInfo info)
Sets a ResultsInfo entry in the infoCache for a given PathQuery.-
Methods inherited from class org.intermine.api.query.QueryExecutor
count, makeSummaryQuery, makeSummaryQuery, makeSummaryQuery, summariseQuery, summariseQuery, summariseQuery, uniqueColumnValues, updateQueryToPathToQueryNode
-
-
-
-
Constructor Detail
-
WebResultsExecutor
public WebResultsExecutor(InterMineAPI im, Profile profile)
Constructor with necessary objects to generate an ObjectStore query from a PathQuery and execute it.- Parameters:
im
- intermine APIprofile
- the user executing the query - for access to saved lists
-
-
Method Detail
-
execute
public WebResults execute(PathQuery pathQuery) throws ObjectStoreException
Create and ObjectStore query from a PathQuery and execute it, returning results in a format appropriate for displaying a web table.- Parameters:
pathQuery
- the query to execute- Returns:
- results in a format appropriate for display in a web page table
- Throws:
ObjectStoreException
- if problem running query
-
execute
public WebResults execute(PathQuery pathQuery, java.util.Map<java.lang.String,BagQueryResult> pathToBagQueryResult) throws ObjectStoreException
Create and ObjectStore query from a PathQuery and execute it, returning results in a format appropriate for displaying a web table.- Parameters:
pathQuery
- the query to executepathToBagQueryResult
- will be populated with results from bag queries used in any LOOKUP constraints- Returns:
- results in a format appropriate for display in a web page table
- Throws:
ObjectStoreException
- if problem running query
-
explain
public ResultsInfo explain(PathQuery pathQuery) throws ObjectStoreException
Explain a query and return estimates of execution time and row count.- Parameters:
pathQuery
- the query to explain- Returns:
- a ResultsInfo object
- Throws:
ObjectStoreException
- if there is a problem explaining the query
-
makeSql
public java.lang.String makeSql(PathQuery pathQuery) throws ObjectStoreException
Creates an SQL query from a PathQuery.- Parameters:
pathQuery
- the query to convert- Returns:
- an SQL String
- Throws:
ObjectStoreException
- if problem creating query
-
makeQuery
public Query makeQuery(PathQuery pathQuery) throws ObjectStoreException
Creates an IQL query from a PathQuery.- Specified by:
makeQuery
in classQueryExecutor
- Parameters:
pathQuery
- the query to convert- Returns:
- an IQL Query object
- Throws:
ObjectStoreException
- if problem creating query
-
makeQuery
public Query makeQuery(PathQuery pathQuery, java.util.Map<java.lang.String,BagQueryResult> pathToBagQueryResult, java.util.Map<java.lang.String,QuerySelectable> pathToQueryNode) throws ObjectStoreException
Creates an IQL query from a PathQuery.- Parameters:
pathQuery
- the query to convertpathToBagQueryResult
- will be populated with results from bag queries used in any LOOKUP constraintspathToQueryNode
- a Map from String path in the PathQuery to QuerySelectable in the resulting IQL Query- Returns:
- an IQL Query object
- Throws:
ObjectStoreException
- if problem creating query
-
precomputeTemplate
public boolean precomputeTemplate(TemplateQuery t) throws ObjectStoreException
Precomputes a template query if it is not already precomputed, returning whether precomputing was necessary.- Parameters:
t
- the TemplateQuery to precompute- Returns:
- true if the template was not already precomputed
- Throws:
ObjectStoreException
- if there is a problem precomputing
-
setQueryInfo
public void setQueryInfo(PathQuery query, ResultsInfo info)
Sets a ResultsInfo entry in the infoCache for a given PathQuery. This info can then be used later on the MyMine page to see a preview of how many rows are in the results.- Parameters:
query
- a PathQuery objectinfo
- a ResultsInfo object corresponding to the query
-
getQueryInfo
public ResultsInfo getQueryInfo(PathQuery query)
Retrieve an entry from the infoCache.- Parameters:
query
- a PathQuery object- Returns:
- a ResultsInfo object, or null if none is present in the cache
-
getInfoCache
public java.util.Map<PathQuery,ResultsInfo> getInfoCache()
Returns the entire infoCache, which is an unmodifiable Map from PathQuery (by identity) to ResultsInfo.- Returns:
- a Map
-
-