#NEWLINE# def request_sru2csw( self , kvpin ) : #NEWLINE# #INDENT# 'transform an SRU request into a CSW request' #NEWLINE# kvpout = { #NEWLINE# #INDENT# 'service' : 'CSW' , #NEWLINE# 'version' : '2.0.2' , #NEWLINE# 'mode' : 'sru' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( 'operation' in self ) : #NEWLINE# #INDENT# if ( kvpin [ 'operation' ] == 'explain' ) : #NEWLINE# #INDENT# kvpout [ 'request' ] = 'GetCapabilities' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( kvpin [ 'operation' ] == 'searchRetrieve' ) : #NEWLINE# #INDENT# kvpout [ 'request' ] = 'GetRecords' #NEWLINE# if ( 'startrecord' in kvpin ) : #NEWLINE# #INDENT# kvpout [ 'startposition' ] = int ( kvpin [ 'startrecord' ] ) #NEWLINE# #UNINDENT# if ( 'maximumrecords' in kvpin ) : #NEWLINE# #INDENT# kvpout [ 'maxrecords' ] = int ( kvpin [ 'maximumrecords' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kvpout [ 'maxrecords' ] = 0 #NEWLINE# #UNINDENT# kvpout [ 'typenames' ] = 'csw:Record' #NEWLINE# kvpout [ 'elementsetname' ] = 'brief' #NEWLINE# kvpout [ 'constraintlanguage' ] = 'CQL_TEXT' #NEWLINE# kvpout [ 'resulttype' ] = 'results' #NEWLINE# if ( 'query' in kvpin ) : #NEWLINE# #INDENT# pname_in_query = False #NEWLINE# for coops in fes1 . MODEL [ 'ComparisonOperators' ] . keys ( ) : #NEWLINE# #INDENT# if ( kvpin [ 'query' ] . find ( fes1 . MODEL [ 'ComparisonOperators' ] [ coops ] [ 'opvalue' ] ) != ( - 1 ) ) : #NEWLINE# #INDENT# pname_in_query = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# kvpout [ 'constraint' ] = { #NEWLINE# #INDENT# 'type' : 'cql' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( not pname_in_query ) : #NEWLINE# #INDENT# kvpout [ 'constraint' ] = ( "csw:AnyText like '%%%s%%'" % kvpin [ 'query' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kvpout [ 'constraint' ] = kvpin [ 'query' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# kvpout [ 'request' ] = 'GetCapabilities' #NEWLINE# #UNINDENT# return kvpout