Expands any shortcuts that were created for this query.  Shortcuts
        provide the user access to joined methods using the '.' accessor to
        access individual columns for referenced tables.
        
        :param      model | <orb.Model> || None
        
        :usage      |>>> from orb import Query as Q
                    |>>> # lookup the 'username' of foreign key 'user'
                    |>>> Q('user.username') == 'bob.smith'
        
        :return     <orb.Query> || <orb.QueryCompound>

def expand(self, model=None, ignoreFilter=False):
        """
        Expands any shortcuts that were created for this query.  Shortcuts
        provide the user access to joined methods using the '.' accessor to
        access individual columns for referenced tables.
        
        :param      model | <orb.Model> || None
        
        :usage      |>>> from orb import Query as Q
                    |>>> # lookup the 'username' of foreign key 'user'
                    |>>> Q('user.username') == 'bob.smith'
        
        :return     <orb.Query> || <orb.QueryCompound>
        """
        model = self.__model or model
        if not model:
            raise orb.errors.QueryInvalid('Could not traverse: {0}'.format(self.__column))

        schema = model.schema()
        parts = self.__column.split('.')

        # expand the current column
        lookup = schema.column(parts[0], raise_=False) or schema.collector(parts[0])

        if lookup:
            # utilize query filters to generate
            # a new filter based on this object
            query_filter = lookup.queryFilterMethod()
            if callable(query_filter) and not ignoreFilter:
                new_q = query_filter(model, self)
                if new_q:
                    return new_q.expand(model, ignoreFilter=True)
                else:
                    return None

            # otherwise, check to see if the lookup
            # has a shortcut to look through
            elif isinstance(lookup, orb.Column) and lookup.shortcut():
                parts = lookup.shortcut().split('.')
                lookup = schema.column(parts[0], raise_=False)

        if len(parts) == 1:
            return self
        else:
            if isinstance(lookup, orb.Collector):
                return orb.Query(model).in_(lookup.collectExpand(self, parts))

            elif isinstance(lookup, orb.ReferenceColumn):
                rmodel = lookup.referenceModel()
                sub_q = self.copy()
                sub_q._Query__column = '.'.join(parts[1:])
                sub_q._Query__model = rmodel
                records = rmodel.select(columns=[rmodel.schema().idColumn()], where=sub_q)
                return orb.Query(model, parts[0]).in_(records)

            else:
                raise orb.errors.QueryInvalid('Could not traverse: {0}'.format(self.__column))