""" SQI Core interface http://nm.wu-wien.ac.at/e-learning/interoperability/SQI_V1.0beta_2005_04_13.pdf http://nm.wu-wien.ac.at/e-learning/interoperability/SessionMgmt_V1.0beta_2005_04_13.pdf $Id: $ """ from zope.interface import Interface class ISQISessionManager(Interface): """ Session manager """ def createAnonymousSession(): """ create anonymous session """ def createSession(username, password): """ create session - log in """ def destroySession(sessionID): """ destroy session """ class ISQIInterface(Interface): """ General interface for SQI """ # # QUERY PARAMETER CONFIGURATION # def setQueryLanguage(targetSessionID, queryLanguageID): """ This method allows the source to control the syntax used in the query statement by identifying the query language. Values for the parameter queryLanguageID are case-insensitive. targetSessionID:string queryLanguageID:string faults: NO_SUCH_SESSION, QUERY_LANGUAGE_NOT_SUPPORTED, METHOD_FAILURE return void """ def setResultsFormat(targetSessionID, resultsFormat): """ This method allows the source to control the format of the results returned by the target. The format according to which the results shall be formatted is specified in the resultsFormat parameter. The parameter is provided via a URI (e.g., the LOM XML Schema definitions files are available at http://standards.ieee.org/reading/ieee/downloads/LOM/lomv1.0/) or via predefined values that are case-insensitive. targetSessionID:string resultsFormat:string faults: NO_SUCH_SESSION, RESULTS_FORMAT_NOT_SUPPORTED, METHOD_FAILURE """ def setMaxQueryResults(targetSessionID, maxQueryResults): """ This method defines the maximum number of results, which a query will produce. The maximum number of query results is set to 100 by default, but can be controlled via this method. maxQueryResults must be 0 (zero) or greater. If the maximum number of query results is set to 0 (zero), the source does not want to limit the number of maximum query results produced. targetSessionID:string maxQueryResults:integer faults: NO_SUCH_SESSION, INVALID_MAX_QUERY_RESULTS, METHOD_FAILURE """ def setMaxDuration(targetSessionID, maxDuration): """ This method enables the source to set a time-out for the query in case of an asynchronously operated query interface. The values of maxDuration must be 0 (zero) or greater. A source delegates the time out management of the query to the target by setting maxDuration to 0 (zero). The parameter maxDuration is interpreted in milliseconds. The default value is zero (i.e., time out management is delegated to the target). targetSessionID:string maxDuration:integer faults: NO_SUCH_SESSION, INVALID_MAX_DURATION, METHOD_FAILURE """ # # SYNCHRONOUS QUERY INTERFACE # def setResultsSetSize(targetSessionID, resultsSetSize): """ This method defines the maximum number of results, which will be returned by a single results set. The size of the results set is set to 25 records by default, but can be controlled via this method. resultsSetSize must be 0 (zero) or greater. A source asks for all results when the maximum number of results is set to 0 (zero). targetSessionID:string resultsSetSize:integer faults: NO_SUCH_SESSION, INVALID_RESULTS_SET_SIZE, QUERY_MODE_NOT_SUPPORTED, METHOD_FAILURE """ def synchronousQuery(targetSessionID, queryStatement, startResult): """ This method places a query at the target. The query statement is provided via the queryStatement parameter. Within a session identified via targetSessionID multiple queries can be submitted simultaneously. The method returns a set of metadata records matching the query. The startResult parameter identifies the start record of the results set. The index of the result set size starts with 1. The number of results returned is controlled by setResultsSetSize and its default value. A valid number for startResult can range from 1 to the total number of results. The total number of results produced is limited by setMaxQueryResults and its default value. targetSessionID:string queryStatement:string startResult:integer faults: NO_SUCH_SESSION, INVALID_QUERY_STATEMENT, QUERY_MODE_NOT_SUPPORTED, METHOD_FAILURE, NO_MORE_RESULTS """ def getTotalResultsCount(targetSessionID, queryStatement): """ This method returns the total number of available results of a query. The targetSessionID identifies the session. The query is provided via the queryStatement parameter (see Section 3.1 on Stateful versus Stateless Implementation). targetSessionID:string queryStatement:string faults: NO_SUCH_SESSION, QUERY_MODE_NOT_SUPPORTED, INVALID_QUERY_STATEMENT, METHOD_FAILURE """ # # ASYNCHRONOUS QUERY INTERFACE # def asynchronousQuery(targetSessionID, queryStatement, queryID): """ This method allows the source to submit a query to the target, while the results are returned in an asynchronous method. The query statement is provided via the queryStatement parameter. A query ID issued by the source is required in order to link the query results with the query, when they are later returned using the results listener. By using unique query IDs it is possible to submit an arbitrary number of queries per active session. The location of the source’s results listener is needed and must be provided using setSourceLocation method. Due to the asynchronous nature of this method, query results could still arrive from previous queries. The query is processed and results are forwarded within the timeframe specified in the setMaxDuration method. targetSessionID:string queryStatement:string queryID:string faults: NO_SUCH_SESSION, QUERY_MODE_NOT_SUPPORTED, NO_SOURCE_LOCATION, INVALID_QUERY_STATEMENT, METHOD_FAILURE """ def setSourceLocation(targetSessionID, sourceLocation): """ This method is required to be called before a query is submitted in asynchronous mode. The parameter sourceLocation specifies the location of the source’s results listener in order for the target to be able to send the results. The sourceLocation must be an URL. targetSessionID:string sourceLocation:string faults: NO_SUCH_SESSION, QUERY_MODE_NOT_SUPPORTED, METHOD_FAILURE """ def queryResultsListener(queryID, queryResults): """ this must be implemented on client not here! This target-initiated method forwards the results sets to the source. The queryID parameter is used for linking the query results to previously submitted query, when they are later return using the results listener. The queryResults holds a results set consisting of a list of metadata records, which is formatted according to the schema specified in the query. queryID: string queryResults: string faults: INVALID_QUERY_RESULTS, NO_SUCH_QUERY, METHOD_FAILURE """