Class IqlQuery
- java.lang.Object
-
- org.intermine.objectstore.query.iql.IqlQuery
-
public class IqlQuery extends java.lang.Object
OQL representation of an object-based Query- Author:
- Andrew Varley, Matthew Wakeling
-
-
Constructor Summary
Constructors Constructor Description IqlQuery()
No-arg constructor (for deserialization)IqlQuery(java.lang.String queryString, java.lang.String packageName)
Construct an IQL query from a String.IqlQuery(java.lang.String queryString, java.lang.String packageName, java.util.List<?> parameters)
Construct an IQL query from a String.IqlQuery(Query q)
Construct an IQL query from a Query object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
constraintToString(Query q, Constraint cc, java.util.List<java.lang.Object> parameters)
Converts a Constraint into a String.boolean
equals(java.lang.Object o)
static java.lang.String
escapeReservedWord(java.lang.String word)
Converts words into escaped form.java.lang.String
getPackageName()
Get the package namejava.util.List<?>
getParameters()
Get the parametersjava.lang.String
getQueryString()
Get the query String NOTE: this will be unvalidatedint
hashCode()
static boolean
isReservedWord(java.lang.String word)
Returns true if the given String is an IQL reserved word.static java.lang.String
nodeToString(Query q, java.lang.Object qn, java.util.List<java.lang.Object> parameters, java.util.Set<QueryObjectPathExpression> pathList)
Converts an Object into a String.static java.lang.String
queryCollectionPathExpressionToString(Query q, java.util.List<java.lang.Object> parameters, QueryCollectionPathExpression col)
Converts a QueryObjectPathExpression into a String.static java.lang.String
queryExpressionToString(Query q, QueryExpression qe, java.util.List<java.lang.Object> parameters)
Converts a QueryExpression into a String.static java.lang.String
queryObjectPathExpressionToString(Query q, java.util.List<java.lang.Object> parameters, QueryObjectPathExpression ref)
Converts a QueryObjectPathExpression into a String.static java.lang.String
queryReferenceToString(Query q, QueryReference ref, java.util.List<java.lang.Object> parameters)
Converts a QueryReference into a String.void
setPackageName(java.lang.String packageName)
Set the package name NOTE: this method is merely here to make this a Bean.void
setParameters(java.util.List<?> parameters)
Set the parametersvoid
setQueryString(java.lang.String queryString)
Set the query String NOTE: this method is merely here to make this a Bean.Query
toQuery()
Convert to a InterMine queryjava.lang.String
toString()
Return a string version of the IqlQueryjava.lang.String
toStringTruncateParameters(int maxSize)
Return a string version of the IqlQuery but truncated the parameters (lists of bag contents) to the specified length.
-
-
-
Constructor Detail
-
IqlQuery
public IqlQuery()
No-arg constructor (for deserialization)
-
IqlQuery
public IqlQuery(java.lang.String queryString, java.lang.String packageName, java.util.List<?> parameters)
Construct an IQL query from a String. NOTE: The query string is not validated on construction- Parameters:
queryString
- the string-based querypackageName
- the package name with which to qualify unqualified classnames. Note that this can be null if every class name is fully qualifiedparameters
- values to substitute for '?' in query text- Throws:
java.lang.NullPointerException
- if queryString is null
-
IqlQuery
public IqlQuery(java.lang.String queryString, java.lang.String packageName)
Construct an IQL query from a String. NOTE: The query string is not validated on construction- Parameters:
queryString
- the string-based querypackageName
- the package name with which to qualify unqualified classnames. Note that this can be null if every class name is fully qualified- Throws:
java.lang.NullPointerException
- if queryString is null
-
IqlQuery
public IqlQuery(Query q)
Construct an IQL query from a Query object.- Parameters:
q
- the Query object- Throws:
java.lang.NullPointerException
- if query is null
-
-
Method Detail
-
nodeToString
public static java.lang.String nodeToString(Query q, java.lang.Object qn, java.util.List<java.lang.Object> parameters, java.util.Set<QueryObjectPathExpression> pathList)
Converts an Object into a String.- Parameters:
q
- a Query, to provide aliasesqn
- an Object to convertparameters
- a List, in which this method will place objects corresponding to the question marks in the resulting StringpathList
- QueryObjectPathExpressions will be added to this for PathExpressionField objects in the SELECT list- Returns:
- a String
-
queryCollectionPathExpressionToString
public static java.lang.String queryCollectionPathExpressionToString(Query q, java.util.List<java.lang.Object> parameters, QueryCollectionPathExpression col)
Converts a QueryObjectPathExpression into a String.- Parameters:
q
- a Query, to provide aliasesparameters
- a List, in which this method will place objects corresponding to the question marks in the resulting Stringcol
- an Object to convert- Returns:
- a String
-
queryObjectPathExpressionToString
public static java.lang.String queryObjectPathExpressionToString(Query q, java.util.List<java.lang.Object> parameters, QueryObjectPathExpression ref)
Converts a QueryObjectPathExpression into a String.- Parameters:
q
- a Query, to provide aliasesparameters
- a List, in which this method will place objects corresponding to the question marks in the resulting Stringref
- an Object to convert- Returns:
- a String
-
queryExpressionToString
public static java.lang.String queryExpressionToString(Query q, QueryExpression qe, java.util.List<java.lang.Object> parameters)
Converts a QueryExpression into a String.- Parameters:
q
- a Query, to provide aliasesqe
- an Object to convertparameters
- a List, in which this method will place objects corresponding to the question marks in the resulting String- Returns:
- a String
-
constraintToString
public static java.lang.String constraintToString(Query q, Constraint cc, java.util.List<java.lang.Object> parameters)
Converts a Constraint into a String.- Parameters:
q
- a Query, to provide aliasescc
- a Constraint to convertparameters
- a List, in which this method will place objects corresponding to the question marks in the resulting String- Returns:
- a String
-
queryReferenceToString
public static java.lang.String queryReferenceToString(Query q, QueryReference ref, java.util.List<java.lang.Object> parameters)
Converts a QueryReference into a String.- Parameters:
q
- a Query, from which to get aliasesref
- a QueryReferenceparameters
- a List to which parameters will be added- Returns:
- a String
-
toQuery
public Query toQuery()
Convert to a InterMine query- Returns:
- the InterMine Query object
-
getQueryString
public java.lang.String getQueryString()
Get the query String NOTE: this will be unvalidated- Returns:
- the query String
-
setQueryString
public void setQueryString(java.lang.String queryString)
Set the query String NOTE: this method is merely here to make this a Bean.- Parameters:
queryString
- the query String
-
getPackageName
public java.lang.String getPackageName()
Get the package name- Returns:
- the package name
-
setPackageName
public void setPackageName(java.lang.String packageName)
Set the package name NOTE: this method is merely here to make this a Bean.- Parameters:
packageName
- the package name
-
getParameters
public java.util.List<?> getParameters()
Get the parameters- Returns:
- the parameters
-
setParameters
public void setParameters(java.util.List<?> parameters)
Set the parameters- Parameters:
parameters
- the parameters
-
toString
public java.lang.String toString()
Return a string version of the IqlQuery- Overrides:
toString
in classjava.lang.Object
- Returns:
- a String version of the query
-
toStringTruncateParameters
public java.lang.String toStringTruncateParameters(int maxSize)
Return a string version of the IqlQuery but truncated the parameters (lists of bag contents) to the specified length.- Parameters:
maxSize
- the maximum length- Returns:
- a String version of the query
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isReservedWord
public static boolean isReservedWord(java.lang.String word)
Returns true if the given String is an IQL reserved word.- Parameters:
word
- the String- Returns:
- a boolean
-
escapeReservedWord
public static java.lang.String escapeReservedWord(java.lang.String word)
Converts words into escaped form.- Parameters:
word
- the String- Returns:
- an escaped String
-
-