Returns the query for this item by joining together its children, 
        or building its data.
        
        :return     <Query> || <QueryCompound>

def query( self ):
        """
        Returns the query for this item by joining together its children, 
        or building its data.
        
        :return     <Query> || <QueryCompound>
        """
        # create the query compound
        if ( self.childCount() ):
            q = Q()
            operator = 'and'
            for i in range(self.childCount()):
                item = self.child(i)
                if ( isinstance(item, XQueryItem) ):
                    if ( operator == 'and' ):
                        q &= item.query()
                    else:
                        q |= item.query()
                else:
                    operator = nativestring(item.text(0))
            return q
        
        # create the query for this individual item
        else:
            q = Q(self.columnName())
            q.setOperatorType(self.operatorType())
            q.setValue(self.value())
            return q