示例#1
0
def compose_annotation(request):
    context = {}
    logging.debug(request)
        
    if request.REQUEST.get('target_link', None):
        context['target_link'] = request.REQUEST.get('target_link')
        return mm_render_to_response(request, context, 'compose_annotation.html')
    
    if isPOST(request):
            insert_rdf('', request.body)
    #target_link = request.REQUEST['target_link']
    #extract_alternative_links(target_link)
    return mm_render_to_response(request, context, 'compose_annotation.html')
示例#2
0
def index(request, graph = 'stable'):
    '''
        Returns a tabular view of the stored annotations.
        - HTTPRequest **request** the client request
        - string **graph**  the required named graph
        TDB - In a future implemenation this actions should be supported by an OpenSearch implementation
    '''
    tmp_g = None
    try:
        tmp_g = _collect_annotations(graph)
    except StoreConnectionError as e:
        messages.add_message(request, messages.ERROR, e)
        return mm_render_to_response_error(request, '503.html', 503)
        
                
    req_format = _validateFormat(request)
    
    if req_format != 'html':
        LOGGING.debug("Annotations %s" % __serialize(tmp_g, req_format = req_format))
        return HttpResponse(__serialize(tmp_g, req_format = req_format))

    states = {}            
    LOGGING.debug("Annotations %s" % tmp_g.serialize())
    for s, p, o in tmp_g.triples((None, None, OA['Annotation'])):
        states[s] = find_annotation_graph(s)   
        
    context = {'results': tmp_g.serialize(), 'states': json.dumps(states)}
    return mm_render_to_response(request, context, 'viewer.html')
示例#3
0
def process_page(request, resource_id = None):
    if 'text/html' not in http_accept(request):
        return process_resource(request, resource_id)
        
    tmp_g = find_resource_by_id(resource_id)                 
    context = {'results': tmp_g.serialize()}
    return mm_render_to_response(request, context, 'viewer.html')
示例#4
0
def process_page(request, resource_id = None):
    if 'text/html' not in request.META.get('HTTP_ACCEPT', None):
        process_resource(request, resource_id)
        
    tmp_g = find_resource_by_id(resource_id)                 
    context = {'results': tmp_g.serialize()}
    return mm_render_to_response(request, context, 'viewer.html')
示例#5
0
def welcome(request):                
    context = {}
    return mm_render_to_response(request, context, 'welcome.html')