@@ -361,6 +361,7 @@ exclude-result-prefixes="#all"
361361 <xsl : variable name =" textarea" select =" ancestor::form/descendant::textarea[@name = 'query']" as =" element()" />
362362 <xsl : variable name =" yasqe" select =" ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.yasqe'), $textarea/ixsl:get(., 'id'))" />
363363 <xsl : variable name =" query-string" select =" ixsl:call($yasqe, 'getValue', [])" as =" xs:string?" /> <!-- get query string from YASQE -->
364+ <xsl : variable name =" method" select =" 'PATCH'" as =" xs:string" />
364365 <xsl : variable name =" action" select =" ac:absolute-path(ldh:base-uri(.))" as =" xs:anyURI" />
365366 <xsl : variable name =" accept" select =" 'application/rdf+xml'" as =" xs:string" />
366367 <xsl : variable name =" etag" select =" ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || ac:absolute-path(ldh:base-uri(.)) || '`'), 'etag')" as =" xs:string" />
@@ -377,7 +378,7 @@ exclude-result-prefixes="#all"
377378 </xsl : apply-templates >
378379 </xsl : variable >
379380 <xsl : variable name =" triples" select =" ldh:descriptions-to-triples($query)" as =" element()*" />
380- <xsl : variable name =" update-string" select =" ldh:triples-to-sparql-update ($about, $triples)" as =" xs:string" />
381+ <xsl : variable name =" update-string" select =" ldh:insertdelete-update(ldh: triples-to-bgp(ldh:uri-po-pattern ($about)), ldh:triples-to-bgp( $triples), ldh:triples-to-bgp(ldh:uri-po-pattern($about)) )" as =" xs:string" />
381382 <xsl : variable name =" resources" as =" document-node()" >
382383 <xsl : document >
383384 <rdf : RDF >
@@ -386,19 +387,21 @@ exclude-result-prefixes="#all"
386387 </xsl : document >
387388 </xsl : variable >
388389 <xsl : variable name =" request-uri" select =" ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $action)" as =" xs:anyURI" />
389-
390- <xsl : variable name =" request" as =" item()*" >
391- <!-- If-Match header checks preconditions, i.e. that the graph has not been modified in the meanwhile -->
392- <ixsl : schedule-action http-request =" map{ 'method': 'PATCH', 'href': $request-uri, 'media-type': 'application/sparql-update', 'body': $update-string, 'headers': map{ 'If-Match': $etag, 'Accept': 'application/rdf+xml', 'Cache-Control': 'no-cache' } }" >
393- <xsl : call-template name =" ldh:ResourceUpdated" >
394- <xsl : with-param name =" doc-uri" select =" ac:absolute-path(ldh:base-uri(.))" />
395- <xsl : with-param name =" block" select =" $block" />
396- <!-- <xsl:with-param name="container" select="$container"/>-->
397- <xsl : with-param name =" resources" select =" $resources" />
398- </xsl : call-template >
399- </ixsl : schedule-action >
400- </xsl : variable >
401- <xsl : sequence select =" $request[current-date() lt xs:date('2000-01-01')]" />
390+ <!-- If-Match header checks preconditions, i.e. that the graph has not been modified in the meanwhile -->
391+ <xsl : variable name =" request" select =" map{ 'method': $method, 'href': $request-uri, 'media-type': 'application/sparql-update', 'body': $update-string, 'headers': map{ 'If-Match': $etag, 'Accept': 'application/rdf+xml', 'Cache-Control': 'no-cache' } }" as =" map(*)" />
392+ <xsl : variable name =" context" as =" map(*)" select ="
393+ map{
394+ 'request': $request,
395+ 'doc-uri': ac:absolute-path(ldh:base-uri(.)),
396+ 'block': $block,
397+ 'resources': $resources
398+ }" />
399+ <ixsl : promise select ="
400+ ixsl:http-request($context('request')) (: Step 1: send initial request :)
401+ => ixsl:then(ldh:rethread-response($context, ?)) (: Step 2: attach response to context :)
402+ => ixsl:then(ldh:handle-response#1) (: Step 3: handle 429s, etc. :)
403+ => ixsl:then(ldh:row-form-patch-response#1)
404+ " />
402405 </xsl : template >
403406
404407 <!-- open query onclick -->
0 commit comments