Arkadiusz Ryś пре 2 година
родитељ
комит
4caa66e372
2 измењених фајлова са 1 додато и 39 уклоњено
  1. 1 11
      spendpoint/endpoint.py
  2. 0 28
      spendpoint/yasgui.html

+ 1 - 11
spendpoint/endpoint.py

@@ -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":

+ 0 - 28
spendpoint/yasgui.html

@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-  <meta charset="utf-8">
-  <title>RDFLib endpoint</title>
-  <link href="https://unpkg.com/@triply/yasgui@4/build/yasgui.min.css" rel="stylesheet" type="text/css"/>
-  <script src="https://unpkg.com/@triply/yasgui@4/build/yasgui.min.js"></script>
-</head>
-
-<body>
-<div id="yasgui"></div>
-<script>
-  Yasqe.defaults.value = `$EXAMPLE_QUERY`
-  const url = window.location.href.endsWith('/') ? window.location.href.slice(0, -1) : window.location.href;
-  const yasgui = new Yasgui(document.getElementById("yasgui"), {
-    requestConfig: {endpoint: url + "/"},
-    endpointCatalogueOptions: {
-      getData: function () {
-        return [
-          {endpoint: url + "/"},
-        ];
-      },
-      keys: [],
-    },
-  });
-</script>
-</body>