def assertionExpressionLookup(self, request, obj_url): assertionID = request.GET['id'] start = int(request.GET.get('start', '0')) limit = int(request.GET.get('limit', '10')) #NOTE: should return ranked by confidence score. For now assume that they do. try: assertion = Assertion.get(assertionID) except DoesNotExist: return rc.NOT_FOUND cursor = Expression.objects(assertion = assertion)[start:start + limit] expressions = [] while (True): try: expressions.append(str(cursor.next().id)) except StopIteration: break #no more assertions within the skip/limit boundaries if len(expressions) == 0: #no assertions were found for the concept return rc.NOT_FOUND return "{expressions: " + str(expressions) + "}"
def assertionExpressionLookup(self, request, obj_url): assertionID = request.GET['id'] start = int(request.GET.get('start', '0')) limit = int(request.GET.get('limit', '10')) #NOTE: should return ranked by confidence score. For now assume that they do. try: assertion = Assertion.get(assertionID) except DoesNotExist: return rc.NOT_FOUND cursor = Expression.objects(assertion=assertion)[start:start + limit] expressions = [] while (True): try: expressions.append(str(cursor.next().id)) except StopIteration: break #no more assertions within the skip/limit boundaries if len(expressions) == 0: #no assertions were found for the concept return rc.NOT_FOUND return "{expressions: " + str(expressions) + "}"