Package org.intermine.api.bag
Class BagQueryRunner
- java.lang.Object
-
- org.intermine.api.bag.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
-
-
Constructor Summary
Constructors Constructor Description 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.
-
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.
-
-
-
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 onclassKeys
- the class keys MapbagQueryConfig
- the configuration for running queriestemplateManager
- 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 objectsinput
- a list of strings to queryextraFieldValue
- 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 modelInterMineException
- 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 objectsinput
- a list of strings to queryextraFieldValue
- 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 wildcardsignoreConfig
- 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 modelInterMineException
- 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 objectsinput
- a list of strings to queryextraFieldValue
- 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 wildcardscaseSensitive
- true if the strings have to match case tooignoreConfig
- 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 modelInterMineException
- 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
-
-