Package org.intermine.objectstore.query
Class QueryObjectPathExpression
- java.lang.Object
- 
- org.intermine.objectstore.query.QueryObjectPathExpression
 
- 
- All Implemented Interfaces:
- Queryable,- QueryPathExpression,- QueryPathExpressionWithSelect,- QuerySelectable
 
 public class QueryObjectPathExpression extends java.lang.Object implements QueryPathExpressionWithSelect, Queryable An element that can appear in the SELECT clause of a query, representing extra data to be collected for the Results - namely a object referenced by some other object in the results. In order to reference further into this reference, this class contains many of the features of Query. That is, you can add QueryFields and QueryPathExpressions to the SELECT list. You can also add QueryClasses to the FROM list and constraints to the WHERE clause. A default QueryClass corresponding to the reference is available from the getDefaultClass method. Counter-intuitively, this path expression may return multiple rows per original row, if extra things are added to the FROM list for example. In this case, this object should be on the SELECT list of the original Query. In the case where this object is guaranteed to return a maximum of one row per original row, then PathExpressionField objects should be put in the SELECT list of the original query instead. The definition is that if this object contains anything in the FROM element, then we cannot guarantee that it will only have one row per original row.- Author:
- Matthew Wakeling
 
- 
- 
Constructor SummaryConstructors Constructor Description QueryObjectPathExpression(QueryClass qc, java.lang.String fieldName)Constructs a QueryObjectPathExpression representing an object reference from the given QueryClass to the given fieldname.QueryObjectPathExpression(QueryClass qc, java.lang.String fieldName, java.lang.Class<?>... subclasses)Constructs a QueryObjectPathExpression representing an object reference from the given QueryClass to the given fieldname, constrained to be a particular subclass.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToSelect(QuerySelectable selectable)Adds an element to the SELECT list.ConstraintgetConstraint()Returns the additional constraint.QueryClassgetDefaultClass()Returns the QueryClass that represents the collection in this object.java.lang.StringgetFieldName()Returns the name of the field.QuerygetQuery(java.util.Collection<java.lang.Integer> bag, boolean isNoNotXml)Returns the Query that will fetch the data represented by this object, given a Collection of objects to fetch it for.QueryClassgetQueryClass()Returns the QueryClass of which the field is a member.java.util.List<QuerySelectable>getSelect()Returns the SELECT list.java.lang.Class<? extends FastPathObject>getSubclass()Returns the subclass if it exists.java.lang.Class<?>getType()Get Java type represented by this item.voidsetConstraint(Constraint c)Sets the additional constraint.
 
- 
- 
- 
Constructor Detail- 
QueryObjectPathExpressionpublic QueryObjectPathExpression(QueryClass qc, java.lang.String fieldName) Constructs a QueryObjectPathExpression representing an object reference from the given QueryClass to the given fieldname.- Parameters:
- qc- the QueryClass of the starting class
- fieldName- the name of field in qc we want to perform an outer join on
- Throws:
- java.lang.IllegalArgumentException- if the field is not an object reference
 
 - 
QueryObjectPathExpressionpublic QueryObjectPathExpression(QueryClass qc, java.lang.String fieldName, java.lang.Class<?>... subclasses) Constructs a QueryObjectPathExpression representing an object reference from the given QueryClass to the given fieldname, constrained to be a particular subclass.- Parameters:
- qc- the QueryClass
- fieldName- the name of the relevant field
- subclasses- a Class that is a subclass of the field class
- Throws:
- java.lang.IllegalArgumentException- if the field is not an object reference
 
 
- 
 - 
Method Detail- 
getQueryClasspublic QueryClass getQueryClass() Returns the QueryClass of which the field is a member.- Specified by:
- getQueryClassin interface- QueryPathExpressionWithSelect
- Returns:
- the QueryClass
 
 - 
getFieldNamepublic java.lang.String getFieldName() Returns the name of the field.- Returns:
- field name
 
 - 
getSubclasspublic java.lang.Class<? extends FastPathObject> getSubclass() Returns the subclass if it exists.- Returns:
- the subclass
 
 - 
getTypepublic java.lang.Class<?> getType() Get Java type represented by this item.- Specified by:
- getTypein interface- QuerySelectable
- Returns:
- class describing the type
 
 - 
getDefaultClasspublic QueryClass getDefaultClass() Returns the QueryClass that represents the collection in this object.- Returns:
- a QueryClass
 
 - 
addToSelectpublic void addToSelect(QuerySelectable selectable) Adds an element to the SELECT list. If the SELECT list is left empty, then the collection will use default behaviour.- Specified by:
- addToSelectin interface- Queryable
- Specified by:
- addToSelectin interface- QueryPathExpressionWithSelect
- Parameters:
- selectable- a QuerySelectable
 
 - 
getSelectpublic java.util.List<QuerySelectable> getSelect() Returns the SELECT list.
 - 
setConstraintpublic void setConstraint(Constraint c) Sets the additional constraint.- Specified by:
- setConstraintin interface- Queryable
- Parameters:
- c- a Constraint
 
 - 
getConstraintpublic Constraint getConstraint() Returns the additional constraint.- Specified by:
- getConstraintin interface- Queryable
- Returns:
- a Constraint
 
 - 
getQuerypublic Query getQuery(java.util.Collection<java.lang.Integer> bag, boolean isNoNotXml) Returns the Query that will fetch the data represented by this object, given a Collection of objects to fetch it for.- Parameters:
- bag- a Collection of objects to fetch data for, or null to not constrain
- isNoNotXml- true if the database is in missingNotXml mode
- Returns:
- a Query
 
 
- 
 
-