Package org.intermine.api.bag
Class BagQueryResult
- java.lang.Object
-
- 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.- Author:
- Richard Smith
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BagQueryResult.IssueResult
Simple struct to hold three pieces of information together.
-
Field Summary
Fields Modifier and Type Field Description 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.util.Set<java.lang.String>
ISSUE_KEYS
keys of the map in a setstatic java.lang.String
OTHER
Key of the Map returned by getIssues() when the input stringstatic 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
Constructors Constructor Description BagQueryResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.void
addUnresolved(java.util.Collection<java.lang.String> unresolvedIdentifiers)
Set the Map of unresolved input strings.java.util.Set<java.lang.String>
getInputIdentifiersForIssue(java.lang.String issueKey)
java.util.Set<java.lang.Integer>
getIssueIds()
Get ids of all InterMineObjects returned that were issues for this bag query lookup.java.util.Set<java.lang.Integer>
getIssueIds(java.lang.String issueKey)
Get ids of all InterMineObjects returned that were registered as issues of this particular type for this bag query lookup.java.util.Set<BagQueryResult.IssueResult>
getIssueResults(java.lang.String issueKey)
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()
Deprecated.Use getUnresolvedIdentifiersjava.util.Collection<java.lang.String>
getUnresolvedIdentifiers()
Get all the unresolved identifiers.
-
-
-
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
-
ISSUE_KEYS
public static final java.util.Set<java.lang.String> ISSUE_KEYS
keys of the map in a set
-
-
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 BagQueryResultquery
- the name of the query that generated this issueinput
- the input identifierobjects
- 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
-
getIssueIds
public java.util.Set<java.lang.Integer> getIssueIds()
Get ids of all InterMineObjects returned that were issues for this bag query lookup.- Returns:
- the set of all ids that were issues
-
getIssueIds
public java.util.Set<java.lang.Integer> getIssueIds(java.lang.String issueKey)
Get ids of all InterMineObjects returned that were registered as issues of this particular type for this bag query lookup.- Parameters:
issueKey
- The type of issue we want (eg "DUPLICATE").- Returns:
- the set of all ids that were issues
-
getIssueResults
public java.util.Set<BagQueryResult.IssueResult> getIssueResults(java.lang.String issueKey)
- Parameters:
issueKey
- key for issue- Returns:
- set of issues
-
getInputIdentifiersForIssue
public java.util.Set<java.lang.String> getInputIdentifiersForIssue(java.lang.String issueKey)
- Parameters:
issueKey
- key for the issue- Returns:
- set of identifiers
-
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 enteredid
- the id of an InterMineObject
-
getUnresolved
@Deprecated public java.util.Map<java.lang.String,java.lang.Object> getUnresolved()
Deprecated.Use getUnresolvedIdentifiersGet 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 The values of this map are always null - and this method should be avoided. Changes to the returned map will not affect the information in this bag query result.
-
getUnresolvedIdentifiers
public java.util.Collection<java.lang.String> getUnresolvedIdentifiers()
Get all the unresolved identifiers.- Returns:
- a collection of unresolved identifiers.
-
addUnresolved
public void addUnresolved(java.util.Collection<java.lang.String> unresolvedIdentifiers)
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:
unresolvedIdentifiers
- the unresolved identifiers to add to this result.
-
-