Coverage report: /development/source/library/org/datagraph/spocq-shard/src/spocq-server/streams/resource-functions.lisp

KindCoveredAll%
expression067 0.0
branch08 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: org.datagraph.spocq.server.implementation; -*-
2
 ;;; (load #p"patches/graph-store.lisp")
3
 
4
 (in-package :org.datagraph.spocq.server.implementation)
5
 
6
 (:documentation "implement binding for rdf stream semantics.
7
 
8
 This file implements ths responses to the rdf stream protocol:
9
 
10
         ${STORE_URL}/${STORE_ACCOUNT}
11
           /${STORE_REPOSITORY}
12
           /${STORE_REPOSITORY}/stream?default               : the default graph
13
           /${STORE_REPOSITORY}/service?graph=${STORE_IGRAPH} : an arbitrary indirect graph
14
                               /service?graph=urn:dydra:service-description : the repository SPARQL endpoint service description
15
           /${STORE_REPOSITORY}/${STORE_RGRAPH}               : graph relative to the repository base url
16
                                                                that is, anything which is not otherwise matched to a static
17
                                                                route, wil be treated as a graph store request for that concrete reaph
18
           /${STORE_REPOSITORY}/sparql                        : the general sparql path is implemented here as well
19
 
20
 ")
21
 
22
 (defclass |/:account/:repository/stream/timestamp-graph| (|/:account/:repository|)
23
   ()
24
   (:documentation "the graph store protocol adjusted for streams")
25
   (:metaclass spocq.i::persistent-class))
26
 
27
 
28
 (http:def-resource-function rdfstream-response (resource request response)
29
   (:log )
30
   (:auth http:authenticate-request-password)
31
   (:auth http:authenticate-request-token)
32
   (:auth http:authenticate-request-session)
33
   (:auth http:authenticate-request-location)
34
 
35
   (:auth http:authorize-request)
36
 
37
  (:post ((resource |/:account/:repository/stream/timestamp-graph|) request response (request-type mime:application/x-www-form-urlencoded) (response-type mime:rdf))
38
     ;; given a form body, decode it and extract the query
39
     (let ((repository (resource-repository resource))
40
           (meta (http:request-post-argument request "meta"))
41
           (default (http:request-post-argument request "default"))
42
           (graph (http:request-post-argument request "graph"))
43
           (timestamp (http:request-post-argument request "timestamp"))
44
           (name nil))
45
       (cond ((plusp (length timestamp))
46
              (setf timestamp (first (spocq.i::parse-term timestamp))
47
                    name (spocq:triple-subject timestamp)))
48
             (t
49
              (setf name (cons-blank-node))
50
              (spocq:triple name (rsp:timestamp-predicate repository) (spocq.e:now))))
51
       (when (plusp (length meta))
52
         (setf meta (spocq.i::parse-turtle meta)))
53
       (when (plusp (length default))
54
         (setf meta (spocq.i::parse-turtle default)))
55
       (when (plusp (length graph))
56
         (setf graph (spocq.i::parse-turtle graph)))
57
       (timestamp-graph-response resource request response response-type
58
                                 :name name :graph graph :timestamp timestamp :default :default)
59
       (http:created))))
60
 
61
 
62