[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/QueryInterfaces - QueryInterfaces.py:1.1

Christian Theune ct@gocept.com
Tue, 3 Dec 2002 11:28:27 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/QueryInterfaces
In directory cvs.zope.org:/tmp/cvs-serv21979

Added Files:
	QueryInterfaces.py 
Log Message:
initial checkin


=== Added File Zope3/lib/python/Zope/App/QueryInterfaces/QueryInterfaces.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""XXX short summary goes here.

XXX longer description goes here.

$Id: QueryInterfaces.py,v 1.1 2002/12/03 16:28:27 ctheune Exp $
"""

class IQueryDescription(Interface):
    """An interface the describes the input or output of a
       query processor.

       There should exist an adapter that adapts the type we
       are describing to an object that implements this interface.
    """

class ITextIndexQuery(IQueryDescription):
    """A unicode query string that's compatible to the TextIndex
       syntax.
    """

    textIndexQuery = Attribute("The query.")

class IBatchedQuery(Interface):

    startPosition = Attribute("The first element of the batch.")
    batchSize = Attribute("The size of the batch.")
    
class IHubIdSet(IQueryDescription):
    """Contains an IISet or IOSet of HubIds.
    """

    iset = Attribute("The set of HubIds.")

class IRankedHubIdList(IQueryDescription):
    """Describes a sequence of tuples (hubid, rank) where
       rank is a float between 0 and 1 inclusive.
    """

    def __getitem__(index):
        """Returns a tuple (hubid, rank) with that index."""

class IInstrumentalQuery(Interface):
    """The original query in a form that was actually used.
    """

    instrumentalQuery = Attribute("Contains the instrumental query.")

class IRankedObjectIterator(Interface):
    """Provides an iterable presentation of ranked results
       of a ranked query.
    """

    class IRecord(Interface):
        """One item returned by the iterator."""

        rank = Attribute("A float between 0 and 1 inclusive.")
        object = Attribute("The object.")

    def __iter__():
        """Iterates over the results."""