Coverage report: /development/source/library/org/datagraph/spocq-shard/src/spocq-server/streams/resource-functions.lisp
| Kind | Covered | All | % |
| expression | 0 | 67 | 0.0 |
| branch | 0 | 8 | 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")
4
(in-package :org.datagraph.spocq.server.implementation)
6
(:documentation "implement binding for rdf stream semantics.
8
This file implements ths responses to the rdf stream protocol:
10
${STORE_URL}/${STORE_ACCOUNT}
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
22
(defclass |/:account/:repository/stream/timestamp-graph| (|/:account/:repository|)
24
(:documentation "the graph store protocol adjusted for streams")
25
(:metaclass spocq.i::persistent-class))
28
(http:def-resource-function rdfstream-response (resource request response)
30
(:auth http:authenticate-request-password)
31
(:auth http:authenticate-request-token)
32
(:auth http:authenticate-request-session)
33
(:auth http:authenticate-request-location)
35
(:auth http:authorize-request)
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"))
45
(cond ((plusp (length timestamp))
46
(setf timestamp (first (spocq.i::parse-term timestamp))
47
name (spocq:triple-subject timestamp)))
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)