org.intermine.api.bag
Class BagQueryResult

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

public class BagQueryResult
extends java.lang.Object

Class to hold the results of querying for a bag of objects. Makes available the matched objects, results that require some user input (issues) and unresolved input.


Field Summary
static java.lang.String DUPLICATE
          Key of the Map returned by getIssues() when the query for the input string found more than one object.
static java.lang.String OTHER
          Key of the Map returned by getIssues() when the input string
static java.lang.String TYPE_CONVERTED
          Key of the Map returned by getIssues() when the object found when querying using input string needed to be translated.
static java.lang.String WILDCARD
          Key of the Map returned by getIssues() when the object found by querying with a wildcard.
 
Constructor Summary
BagQueryResult()
           
 
Method Summary
 void addIssue(java.lang.String type, java.lang.String query, java.lang.String input, java.util.List objects)
          Add an issue to this result.
 void addMatch(java.lang.String input, java.lang.Integer id)
          Add a new match from an input string to an InterMineObject id.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List>>> getIssues()
          Get any results that require some user input before adding to the bag.
 java.util.Set<java.lang.Integer> getMatchAndIssueIds()
          Get ids of all InterMineObjects returned that were matches or issues for this bag query lookup.
 java.util.Map<java.lang.Integer,java.util.List> getMatches()
          Get any exact matches found by the queries [id -> [input strings].
 java.util.Map<java.lang.String,java.lang.Object> getUnresolved()
          Get a Map of any input Strings for which objects of the right type could not be found.
 void setUnresolved(java.util.Map<java.lang.String,java.lang.Object> unresolved)
          Set the Map of unresolved input strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUPLICATE

public static final java.lang.String DUPLICATE
Key of the Map returned by getIssues() when the query for the input string found more than one object.

See Also:
Constant Field Values

OTHER

public static final java.lang.String OTHER
Key of the Map returned by getIssues() when the input string

See Also:
Constant Field Values

TYPE_CONVERTED

public static final java.lang.String TYPE_CONVERTED
Key of the Map returned by getIssues() when the object found when querying using input string needed to be translated.

See Also:
Constant Field Values

WILDCARD

public static final java.lang.String WILDCARD
Key of the Map returned by getIssues() when the object found by querying with a wildcard.

See Also:
Constant Field Values
Constructor Detail

BagQueryResult

public BagQueryResult()
Method Detail

getIssues

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List>>> getIssues()
Get any results that require some user input before adding to the bag. [issue type -> [query -> [input string -> List of InterMineObjects]]] or for issue type of "TYPE_TRANSLATED": [issue type -> [query -> [input string -> List of ConvertedObjectPair]]

Returns:
a map from issues type to queries to input to possible objects

addIssue

public void addIssue(java.lang.String type,
                     java.lang.String query,
                     java.lang.String input,
                     java.util.List objects)
Add an issue to this result.

Parameters:
type - one of the type constants from BagQueryResult
query - the name of the query that generated this issue
input - the input identifier
objects - the objects found for the input identifiers

getMatches

public java.util.Map<java.lang.Integer,java.util.List> getMatches()
Get any exact matches found by the queries [id -> [input strings]. If the same input string appears twice in the initial list it will appear twice in the list of inputs matching the InterMineObject id.

Returns:
a map from InterMineObject id to list of input strings

getMatchAndIssueIds

public java.util.Set<java.lang.Integer> getMatchAndIssueIds()
Get ids of all InterMineObjects returned that were matches or issues for this bag query lookup.

Returns:
the set of all ids that were matches or issues

addMatch

public void addMatch(java.lang.String input,
                     java.lang.Integer id)
Add a new match from an input string to an InterMineObject id.

Parameters:
input - the original input string entered
id - the id of an InterMineObject

getUnresolved

public java.util.Map<java.lang.String,java.lang.Object> getUnresolved()
Get a Map of any input Strings for which objects of the right type could not be found.

Returns:
a Map of from input string to null/object - null when the input doesn't match any object of any type, otherwise a reference to a Set of the objects that matched

setUnresolved

public void setUnresolved(java.util.Map<java.lang.String,java.lang.Object> unresolved)
Set the Map of unresolved input strings. It is Map from input string to null/object - null when the input doesn't match any object of any type, otherwise a reference to the object that matched.

Parameters:
unresolved - the new unresolved Map