about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/webserver.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index 0c0bdd1..e2412d2 100644
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -327,6 +327,31 @@ otherwise search for set/group data"
                 #\n)
           (render-json (get-id-data (list->string name))))
          (rest (render-json "NOP")))))
+    ;; RDF End-points
+    (('GET "v1" "id" id)
+     (receive (sparql-header sparql-resp)
+	 (sparql-http-get
+	  (or (getenv "SPARQL-ENDPOINT") "http://localhost:8890/sparql/")
+	  (sparql-by-term 'gn id))
+       (list '((content-type text/html))
+	     (lambda (port)
+	       (put-string port sparql-resp)))))
+    (('GET "v1" "category" category)
+     (receive (sparql-header sparql-resp)
+	 (sparql-http-get
+	  (or (getenv "SPARQL-ENDPOINT") "http://localhost:8890/sparql/")
+	  (sparql-by-term 'gnc category))
+       (list '((content-type text/html))
+	     (lambda (port)
+	       (put-string port sparql-resp)))))
+    (('GET "v1" "term" term)
+     (receive (sparql-header sparql-resp)
+	 (sparql-http-get
+	  (or (getenv "SPARQL-ENDPOINT") "http://localhost:8890/sparql/")
+	  (sparql-by-term 'gnt term))
+       (list '((content-type text/html))
+	     (lambda (port)
+	       (put-string port sparql-resp)))))
     (_ (not-found (request-uri request)))))
 
 (define (request-path-components request)