Class BagQueryRunner


  • public class BagQueryRunner
    extends java.lang.Object
    For a given list of input strings search for objects using default and configured queries for a particular type.
    Author:
    Richard Smith
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<ApiTemplate> getConversionTemplates()
      Fetch conversion template queries from the template manager.
      BagQueryResult search​(java.lang.String type, java.util.Collection<java.lang.String> input, java.lang.String extraFieldValue, boolean doWildcards, boolean caseSensitive, boolean ignoreConfig)
      Given an input list of string identifiers search for corresponding objects.
      BagQueryResult searchForBag​(java.lang.String type, java.util.List<java.lang.String> input, java.lang.String extraFieldValue, boolean doWildcards)
      Given an input list of string identifiers search for corresponding objects.
      BagQueryResult searchForBag​(java.lang.String type, java.util.List<java.lang.String> input, java.lang.String extraFieldValue, boolean doWildcards, boolean ignoreConfig)
      Given an input list of string identifiers search for corresponding objects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BagQueryRunner

        public BagQueryRunner​(ObjectStore os,
                              java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys,
                              BagQueryConfig bagQueryConfig,
                              TemplateManager templateManager)
        Construct with configured bag queries and a map of type -> key fields.
        Parameters:
        os - the ObjectStore to run queries on
        classKeys - the class keys Map
        bagQueryConfig - the configuration for running queries
        templateManager - the InterMine template manager to access conversion templates a list of template queries to be used when type converting results
    • Method Detail

      • searchForBag

        public BagQueryResult searchForBag​(java.lang.String type,
                                           java.util.List<java.lang.String> input,
                                           java.lang.String extraFieldValue,
                                           boolean doWildcards)
                                    throws java.lang.ClassNotFoundException,
                                           InterMineException
        Given an input list of string identifiers search for corresponding objects. First run a default query then any queries configured for the specified type.
        Parameters:
        type - an unqualified class name to search for objects
        input - a list of strings to query
        extraFieldValue - the value used when adding an extra constraint to the bag query, configured in BagQueryConfig (e.g. if connectField is "organism", the extraClassName is "Organism" and the constrainField is "name", the extraFieldValue might be "Drosophila melanogaster")
        doWildcards - true if the strings should be evaluated as wildcards
        Returns:
        the matches, issues and unresolved input
        Throws:
        java.lang.ClassNotFoundException - if the type isn't in the model
        InterMineException - if there is any other exception
      • searchForBag

        public BagQueryResult searchForBag​(java.lang.String type,
                                           java.util.List<java.lang.String> input,
                                           java.lang.String extraFieldValue,
                                           boolean doWildcards,
                                           boolean ignoreConfig)
                                    throws java.lang.ClassNotFoundException,
                                           InterMineException
        Given an input list of string identifiers search for corresponding objects. First run a default query then any queries configured for the specified type.
        Parameters:
        type - an unqualified class name to search for objects
        input - a list of strings to query
        extraFieldValue - the value used when adding an extra constraint to the bag query, configured in BagQueryConfig (e.g. if connectField is "organism", the extraClassName is "Organism" and the constrainField is "name", the extraFieldValue might be "Drosophila melanogaster")
        doWildcards - true if the strings should be evaluated as wildcards
        ignoreConfig - TRUE if we should ignore the config that controls match behaviour
        Returns:
        the matches, issues and unresolved input
        Throws:
        java.lang.ClassNotFoundException - if the type isn't in the model
        InterMineException - if there is any other exception
      • search

        public BagQueryResult search​(java.lang.String type,
                                     java.util.Collection<java.lang.String> input,
                                     java.lang.String extraFieldValue,
                                     boolean doWildcards,
                                     boolean caseSensitive,
                                     boolean ignoreConfig)
                              throws java.lang.ClassNotFoundException,
                                     InterMineException
        Given an input list of string identifiers search for corresponding objects. First run a default query then any queries configured for the specified type.
        Parameters:
        type - an unqualified class name to search for objects
        input - a list of strings to query
        extraFieldValue - the value used when adding an extra constraint to the bag query, configured in BagQueryConfig (e.g. if connectField is "organism", the extraClassName is "Organism" and the constrainField is "name", the extraFieldValue might be "Drosophila melanogaster")
        doWildcards - true if the strings should be evaluated as wildcards
        caseSensitive - true if the strings have to match case too
        ignoreConfig - TRUE if we should ignore configuration on how matches should work
        Returns:
        the matches, issues and unresolved input
        Throws:
        java.lang.ClassNotFoundException - if the type isn't in the model
        InterMineException - if there is any other exception
      • getConversionTemplates

        protected java.util.List<ApiTemplate> getConversionTemplates()
        Fetch conversion template queries from the template manager. This is in a separate method so we can override and easily use a custom list of templates for testing.
        Returns:
        a list of conversion templates