I use sparql from XQuery with MarkLogic 9.
I serialize the results from sem:sparql function with sem:query-results-serialize, but the serialization costs a lot of time.
Is there a way to avoid it, or speed it up? By using map or something else?
my code :
let $_ := prof:enable(xdmp:request())
let $sparql:=concat("
SELECT ?encoche ?uriDoc1 ?uriDoc2
WHERE {
{
?encoche <http://www.lefebvre-sarrut.eu/ns/hubeditorial/est-encoche-dans> ?uriDoc1 .
?encoche <http://www.lefebvre-sarrut.eu/ns/hubeditorial/est-defini-dans> ?uriDoc2
}
}
")
let $p1 := prof:report(xdmp:request())//prof:overall-elapsed
let $res:=sem:sparql($sparql, (), (), ())
let $p2 := prof:report(xdmp:request())//prof:overall-elapsed
let $resXML := sem:query-results-serialize($res, "xml")
let $p3 := prof:report(xdmp:request())//prof:overall-elapsed
return ($p1,$p2,$p3)
the return :
PT0.0000221S
PT0.011936S
PT0.2549374S
any idea?