Example #1
0
    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) + "}"
Example #2
0
    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) + "}"