Class 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
    • 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 API
        profile - 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 execute
        pathToBagQueryResult - 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,
                               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 convert
        pathToBagQueryResult - will be populated with results from bag queries used in any LOOKUP constraints
        pathToQueryNode - 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 object
        info - 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