From 69acd15a9748a22f4cb14fe566226f39ac197c6a Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Wed, 12 Jul 2023 07:24:56 -0500
Subject: SPARQL parsing
---
gn3-guile/web/webserver.scm | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
(limited to 'gn3-guile')
diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm
index d7687a0..b6f3417 100755
--- a/gn3-guile/web/webserver.scm
+++ b/gn3-guile/web/webserver.scm
@@ -99,8 +99,8 @@ SELECT DISTINCT ?species WHERE {
(map (lambda (m) (cdr (assoc "value"(cdr (car m))))) (array->list (sparql-species)))
)
-(define (sparql-species-meta)
- (sparql-results "
+(define (sparql-species-meta2)
+ (sparql-exec "
PREFIX gn:
PREFIX rdf:
@@ -109,13 +109,36 @@ SELECT DISTINCT ?species ?p ?o WHERE {
?species ?p ?o .
}"
))
+(define (sparql-species-meta)
+ (sparql-exec "
+PREFIX gn:
+PREFIX rdf:
+
+SELECT ?species ?p ?o WHERE {
+ MINUS { ?species rdf:type ?o . }
+{
+ SELECT DISTINCT ?species ?p ?o WHERE {
+ ?species rdf:type gn:species .
+ ?species ?p ?o .
+ }}}"
+ ))
+
(define (get-species-all)
(sparql-species-meta))
(define (get-species)
- (receive (names results) (sparql-species))
- results)
+ (receive (names results) (sparql-species-meta)
+ results))
+
+(define (get-values name resultlist)
+ (map (lambda (m) (cdr (assoc "value" (cdr (assoc name m))))) resultlist)
+ )
+
+(define (filter-results)
+ (get-values "o" (array->list (get-species)))
+ )
+
(define (triples)
(array->list (get-species-all)))
--
cgit v1.2.3