|
@@ -3,7 +3,6 @@
|
|
|
import logging
|
|
|
import re
|
|
|
import arklog
|
|
|
-import pkg_resources
|
|
|
import rdflib
|
|
|
from typing import Any, Callable, Dict, List, Optional, Union
|
|
|
from urllib import parse
|
|
@@ -66,6 +65,7 @@ class SparqlEndpoint(FastAPI):
|
|
|
self.description = description
|
|
|
self.version = version
|
|
|
super().__init__(*args, title=title, description=description, version=version, **kwargs)
|
|
|
+ logging.debug(self.description)
|
|
|
rdflib.plugins.sparql.CUSTOM_EVALS["evalCustomFunctions"] = self.eval_custom_functions
|
|
|
api_responses: Optional[Dict[Union[int, str], Dict[str, Any]]] = {
|
|
|
200: {
|
|
@@ -84,9 +84,6 @@ class SparqlEndpoint(FastAPI):
|
|
|
"text/turtle": {"example": "service description"},
|
|
|
"application/sparql-results+xml": {"example": "<root></root>"},
|
|
|
"application/xml": {"example": "<root></root>"},
|
|
|
- # "application/rdf+xml": {
|
|
|
- # "example": '<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"></rdf:RDF>'
|
|
|
- # },
|
|
|
},
|
|
|
},
|
|
|
400: {
|
|
@@ -159,13 +156,6 @@ class SparqlEndpoint(FastAPI):
|
|
|
query = parse.unquote(params[1])
|
|
|
return await sparql_endpoint_get(request, query)
|
|
|
|
|
|
- @self.get("/gui", include_in_schema=False)
|
|
|
- async def serve_yasgui() -> Response:
|
|
|
- """Serve YASGUI interface"""
|
|
|
- with open(pkg_resources.resource_filename("spendpoint", "yasgui.html")) as f:
|
|
|
- html_str = f.read()
|
|
|
- html_str = html_str.replace("$EXAMPLE_QUERY", "")
|
|
|
- return Response(content=html_str, media_type="text/html")
|
|
|
|
|
|
def eval_custom_functions(self, ctx: QueryContext, part: CompValue) -> List[Any]:
|
|
|
if part.name != "Extend":
|