示例#1
0
def download(format_):
    format_,mimetype_=mimeutils.format_to_mime(format_)
    response=make_response(g.graph.serialize(format=format_))

    response.headers["Content-Type"]=mimetype_

    return response        
示例#2
0
def data(label, format_, type_=None):
    r=get_resource(label, type_)
    if isinstance(r,tuple): # 404
        return r
    #graph=g.graph.query('DESCRIBE %s'%r.n3())
    # DESCRIBE <uri> is broken. 
    # http://code.google.com/p/rdfextras/issues/detail?id=25
    graph=g.graph.query('CONSTRUCT { %s ?p ?o . } WHERE { %s ?p ?o } '%(r.n3(), r.n3())).graph
    graph+=g.graph.query('CONSTRUCT { ?s ?p %s . } WHERE { ?s ?p %s } '%(r.n3(), r.n3()))

    format_,mimetype_=mimeutils.format_to_mime(format_)
    response=make_response(graph.serialize(format=format_))

    response.headers["Content-Type"]=mimetype_

    return response