def get_object_list(self, request): ''' Method to return the list of objects via GET method to the Resource (not concrete). If the variable 'search_type' is present returns the appropriate bundles which match the searching query. 'search_type' can have several values: 'name' - accompanied by 'q_str' variable containing the search string returns all Bundles containing the q_str in their name. 'id' - accompanied by 'q_str' variable containing the search string returns all Bundles containing a record that contains the q_str in their name. 'type' - accompanied by 'q_str' variable containing the search string returns all Bundles containing a literal attribute with type prov:type and value containing q_str. 'time' - accompanied by 'start' and/or 'end' variable containing the times returns all Bundles with within the time frame [strat:end] 'any' - accompanied by 'q_str' variable containing the search string returns all Bundles containing anything matching q_str. ''' search_type = request.GET.get('search_type', None) if not search_type: return ModelResource.get_object_list(self, request) try: if search_type == 'name': result = search_name(request.GET.get('q_str', None)) elif search_type == 'id': result = search_id(request.GET.get('q_str', None)) elif search_type == 'type': result = search_literal(request.GET.get('literal', None) + 'prov#type', request.GET.get('q_str', None)) elif search_type == 'time': result = search_timeframe(request.GET.get('start', None), request.GET.get('end', None)) elif search_type == 'any': result = search_any_text_field(request.GET.get('q_str', None)) else: raise ImmediateHttpResponse(HttpBadRequest()) return result except: raise ImmediateHttpResponse(HttpBadRequest())