You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy";
let $query := "$QUERY_STRING"
let $vars := ()
let $options := $OPTIONS
return try {
let $ret := $FUNCTION
let $triples := for $item in $ret where $item instance of sem:triple return $item
let $other := for $item in $ret where not($item instance of sem:triple) return $item
return if (count($triples) > 0) then
let $fmt := sem:rdf-serialize($triples, "$TRIPLE_FORMAT")
let $_ := xdmp:add-response-header("X-Content-Type", "$CONTENT_TYPE")
return ($fmt, $other)
else
$ret
} catch ($e) { $e }
to run SPARQL queries in a plugin of mine, replacing $FUNCTION, etc. with string replacement logic.
X-Content-Type is used because setting Content-Type changes the multipart content type and breaks things. This could be removed for the roxy version. $FUNCTION is the appropriate invoke/eval function, allowing support for profiling and debugging.
Using /v1/graph/sparql is probably better for roxy. I'm using eval to make use of things like better exception reporting, profiling, and debugging if available.
See also #821
The text was updated successfully, but these errors were encountered: