Exemple #1
0
def test_describe_many_dataset_void():
    ref_graph = Graph()
    ref_graph.parse("tests/descriptors/data/describe_all.ttl", format="ttl")
    # generate description
    url = "http://localhost:8000"
    desc_graph = Graph()
    desc_graph.parse(data=many_void(url, dataset, "turtle"), format="ttl")
    assert ref_graph.isomorphic(desc_graph)
Exemple #2
0
 async def server_void(request: Request):
     """Describe all RDF datasets hosted by the Sage endpoint"""
     try:
         mimetypes = request.headers['accept'].split(",")
         url = urlunparse(request.url.components[0:3] + (None, None, None))
         if url.endswith('/'):
             url = url[0:len(url) - 1]
         void_format, res_mimetype = choose_void_format(mimetypes)
         description = many_void(url, dataset, void_format)
         return Response(description, media_type=res_mimetype)
     except Exception as err:
         logging.error(err)
         raise HTTPException(status_code=500, detail=str(err))
Exemple #3
0
 def void_all():
     """Describe all RDF datasets hosted by the Sage endpoint"""
     try:
         mimetype = request.accept_mimetypes.best_match([
             "application/n-triples", "text/turtle", "application/xml",
             "application/n-quads", "application/trig", "application/json",
             "application/json+ld"
         ])
         url = dataset.uri if dataset.uri is not None else secure_url(
             request.url_root)
         if url.endswith('/'):
             url = url[0:len(url) - 1]
         format, mimetype = choose_format(mimetype)
         description = many_void(url, dataset, format)
         return Response(description, content_type=mimetype)
     except Exception as e:
         logger.error(e)
         abort(500)