org.intermine.api.bag
Class BagQuery

java.lang.Object
  extended by org.intermine.api.bag.BagQuery

public class BagQuery
extends java.lang.Object

A class encapsulating a query used to create a bag from a collection of input identifiers.


Constructor Summary
BagQuery(BagQueryConfig bagQueryConfig, Model model, java.util.Map<java.lang.String,java.util.List<FieldDescriptor>> classKeys, java.lang.String type)
          Create a new BagQuery object for the default query - search for all key fields of the given class.
BagQuery(BagQueryConfig bagQueryConfig, Model model, java.lang.String queryString, java.lang.String message, java.lang.String packageName, boolean matchesAreIssues)
          Create a new BagQuery object.
 
Method Summary
 java.lang.String getMessage()
          Return the message that was passed to the constructor.
 Query getQuery(java.util.Collection<java.lang.String> bag, java.lang.String extraFieldValue)
          Return the Query that was passed to the constructor.
 Query getQueryForWildcards(java.util.Collection<java.lang.String> bag, java.lang.String extraFieldValue)
          Return a Query to fetch bag contents for wildcards.
 boolean matchesAreIssues()
          Return the flag passed to the constructor.
 java.lang.String toString()
          
 void traverseConstraint(Constraint con, java.util.Map<QueryEvaluable,ConstraintSet> nodes)
          Finds all BagConstraints in a Constraint, and places the QueryEvaluable and the containing ConstraintSet into the given Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BagQuery

public BagQuery(BagQueryConfig bagQueryConfig,
                Model model,
                java.lang.String queryString,
                java.lang.String message,
                java.lang.String packageName,
                boolean matchesAreIssues)
Create a new BagQuery object.

Parameters:
bagQueryConfig - the configuration to use
model - the Model for the query
queryString - the query IQL
message - the message from the bag-queries.xml describing this query
packageName - the package name
matchesAreIssues - true if matches for this bag query should be treated as issues (aka low quality matches)

BagQuery

public BagQuery(BagQueryConfig bagQueryConfig,
                Model model,
                java.util.Map<java.lang.String,java.util.List<FieldDescriptor>> classKeys,
                java.lang.String type)
Create a new BagQuery object for the default query - search for all key fields of the given class.

Parameters:
bagQueryConfig - the configuration to use
model - the Model for the query
classKeys - map of class key fields
type - the qualified class name of the type to build query for
Method Detail

getQuery

public Query getQuery(java.util.Collection<java.lang.String> bag,
                      java.lang.String extraFieldValue)
               throws java.lang.ClassNotFoundException
Return the Query that was passed to the constructor.

Parameters:
bag - the collection to use to constrain the query
extraFieldValue - the value used if any extra constraint is configured
Returns:
the Query
Throws:
java.lang.ClassNotFoundException - if class given by type not found

getQueryForWildcards

public Query getQueryForWildcards(java.util.Collection<java.lang.String> bag,
                                  java.lang.String extraFieldValue)
                           throws java.lang.ClassNotFoundException
Return a Query to fetch bag contents for wildcards.

Parameters:
bag - the Collection of strings to use to constrain the query
extraFieldValue - the value used if any extra constraint is configured
Returns:
the Query
Throws:
java.lang.ClassNotFoundException - if class specified by type not found

traverseConstraint

public void traverseConstraint(Constraint con,
                               java.util.Map<QueryEvaluable,ConstraintSet> nodes)
Finds all BagConstraints in a Constraint, and places the QueryEvaluable and the containing ConstraintSet into the given Map.

Parameters:
con - the Constraint to search
nodes - the Map to put results into

matchesAreIssues

public boolean matchesAreIssues()
Return the flag passed to the constructor.

Returns:
the matchesAreIssues flag

getMessage

public java.lang.String getMessage()
Return the message that was passed to the constructor.

Returns:
the message

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object