Coverage report: /development/source/library/org/datagraph/spocq-shard/src/core/encoding/sparql-query-olog.lisp
| Kind | Covered | All | % |
| expression | 0 | 48 | 0.0 |
| branch | 0 | 2 | 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.implementation; -*-
3
(in-package :org.datagraph.spocq.implementation)
6
(def-mime-type-key "SPARQL-QUERY+OLOG")
7
(def-mime-type-key "SPARQL-QUERY+OLOG+TEX")
8
(def-mime-type-key "SPARQL-QUERY+OLOG+SVG+XML")
11
(def-mime-type ("APPLICATION" "SPARQL-QUERY+OLOG") ()
12
((de.setf.utility.implementation::charset
14
(de.setf.utility.implementation::file-type
16
(:documentation "SPARQL query encoded as an OLOG"))
19
(def-mime-type ("APPLICATION" "SPARQL-QUERY+OLOG+TEX") (mime::application/SPARQL-QUERY+OLOG)
21
(:documentation "SPARQL query encoded as an OLOG as a tex tikz document"))
23
(def-mime-type ("APPLICATION" "SPARQL-QUERY+OLOG+SVG+XML") (mime::application/SPARQL-QUERY+OLOG)
25
(:documentation "SPARQL query encoded as an OLOG as a tex tikz document rendered to svg"))
27
(defparameter *executable-pathname.tikztosvg* "/usr/local/texlive/2020/bin/x86_64-linux/tikztosvg")
29
(defmethod send-response-message ((operation t) (tex-expression string) (response-stream stream) (content-type mime:application/sparql-query+olog+svg+xml))
30
"Given a QUERY, and a STREAM with the application/sparql-query+olog+svg CONTENT-TYPE, render the query as olog+svg"
31
(when *encoding-trace-output*
32
(setf response-stream (make-broadcast-stream *encoding-trace-output* response-stream)))
33
;; the generation process did not behave well reading from standard input
34
(let* ((tex-pathname (tmp-export-pathname (task-id *task*) "olog")))
37
(with-open-file (tex-stream tex-pathname :direction :output :if-exists :error :if-does-not-exist :create)
38
(write-string tex-expression tex-stream))
39
(let ((process (run-program *executable-pathname.tikztosvg*
40
`("-q" "-p" "tikz-cd" "-p" "xfrac" "-o" "/dev/stdout"
41
,(namestring tex-pathname))
42
:output response-stream
44
(unless (and process (zerop (run-program-exit-code process)))
45
(http:internal-error "tikz-cd image generation failed."))
46
(run-program-close process)
47
(finish-output response-stream)
48
(run-program-exit-code process)))
49
(conditional-delete-file tex-pathname))))
54
(send-response-message
57
G \\arrow[r, \"\\varphi\"] \\arrow[d, \"\\psi\"', two heads] & H \\\\
58
\\sfrac{G}{\\ker \\varphi} \\arrow[ru, dotted] &
62
mime:application/sparql-query+olog+svg+xml)
64
curl -k -v -H "Accept: application/sparql-query+olog+svg+xml" \
65
"https://nl4.dydra.com/james/test/olog.olog?query=%5Cbegin%7Btikzcd%7D%0AG%20%5Carrow%5Br%2C%20%22%5Cvarphi%22%5D%20%5Carrow%5Bd%2C%20%22%5Cpsi%22%27%2C%20two%20heads%5D%20%26%20H%20%5C%5C%0A%5Csfrac%7BG%7D%7B%5Cker%20%5Cvarphi%7D%20%5Carrow%5Bru%2C%20dotted%5D%20%20%20%20%20%20%20%20%20%20%20%26%20%20%0A%5Cend%7Btikzcd%7D%0A"