def queryClaimSize(self, claimType, query):
        """
        Queries claim's size

        Queries the data according the the given query and returns the number of records retrieved from the query.

        Args:
            claimType: the claimType
            query: the query string

        Returns:
            The number of records retrieved from the query

        Raises:
            PersistenceException: There is DB error
        """
        try:
            claimType = ClaimTypeFactory.load(claimType)

            query_parser = RedisQueryParser(claimType)
            parse_tree = query_parser.parse(query)

            query_executor = RedisQueryExecutor(self.connection, claimType)
            object_ids = query_executor.visit(parse_tree)

            cnt = len(object_ids)
            return cnt
        except RedisQueryParserError as e:
            raise PersistenceException(*e.args)
        except RedisError as e:
            raise PersistenceException(*e.args)
    def queryClaimSize(self, claimType, query):
        """
        Queries claim's size

        Queries the data according the the given query and returns the number of records retrieved from the query.

        Args:
            claimType: the claimType
            query: the query string

        Returns:
            The number of records retrieved from the query

        Raises:
            PersistenceException: There is DB error
        """
        try:
            claimType = ClaimTypeFactory.load(claimType)

            query_parser = RedisQueryParser(claimType)
            parse_tree = query_parser.parse(query)

            query_executor = RedisQueryExecutor(self.connection, claimType)
            object_ids = query_executor.visit(parse_tree)

            cnt = len(object_ids)
            return cnt
        except RedisQueryParserError as e:
            raise PersistenceException(*e.args)
        except RedisError as e:
            raise PersistenceException(*e.args)
    def queryClaims(self, claimType, query, pageNumber, pageSize):
        """
        Queries claims

        Queries the data according the the given filtering options from the given claim type, and returns the list of
        records (as lists) of data for the given claim type

        Args:
            claimType: the claimType
            query: the query string
            pageNumber: the page number
            pageSize: the page size

        Returns:
            The list of records of data for the given claim type

        Raises:
            PersistenceException: There is DB error
        """
        try:
            claimType = ClaimTypeFactory.load(claimType)

            query_parser = RedisQueryParser(claimType)
            parse_tree = query_parser.parse(query)

            query_executor = RedisQueryExecutor(self.connection, claimType)
            object_ids = query_executor.visit(parse_tree)
            if pageNumber:
                start = (pageNumber - 1) * pageSize
                end = start + pageSize
                object_ids = object_ids[start:end]

            for id in object_ids:
                self.cursor.hgetall(claimType.tablename + ":" + id.decode())
            claims = self.cursor.execute()

            for i in range(len(claims)):
                claims[i] = self._convert_to_tuple(claimType, claims[i])
            return claims
        except RedisQueryParserError as e:
            raise PersistenceException(*e.args)
        except RedisError as e:
            raise PersistenceException(*e.args)
    def queryClaims(self, claimType, query, pageNumber, pageSize):
        """
        Queries claims

        Queries the data according the the given filtering options from the given claim type, and returns the list of
        records (as lists) of data for the given claim type

        Args:
            claimType: the claimType
            query: the query string
            pageNumber: the page number
            pageSize: the page size

        Returns:
            The list of records of data for the given claim type

        Raises:
            PersistenceException: There is DB error
        """
        try:
            claimType = ClaimTypeFactory.load(claimType)

            query_parser = RedisQueryParser(claimType)
            parse_tree = query_parser.parse(query)

            query_executor = RedisQueryExecutor(self.connection, claimType)
            object_ids = query_executor.visit(parse_tree)
            if pageNumber:
                start = (pageNumber-1) * pageSize
                end = start + pageSize
                object_ids = object_ids[start:end]

            for id in object_ids:
                self.cursor.hgetall(claimType.tablename + ":" + id.decode())
            claims = self.cursor.execute()

            for i in range(len(claims)):
                claims[i] = self._convert_to_tuple(claimType, claims[i])
            return claims
        except RedisQueryParserError as e:
            raise PersistenceException(*e.args)
        except RedisError as e:
            raise PersistenceException(*e.args)