Skip to content

Commit 94bc699

Browse files
namedgraphclaude
andcommitted
Load metadata in ontology-view block render chain; rename for clarity
ldh:RenderRow's view-block injection (the chain that queries /ns for ?property ldh:view ?block and fetches each matching block template) was rendering those blocks via apply-templates mode='bs2:Row' with no property-metadata or object-metadata tunnel param. Anything inside an injected view block — typically rdfs:isDefinedBy, spin:query, rdf:type — therefore couldn't resolve labels via mode B and fell through to mode D's local-name() fallback. Extend the per-view-block promise to load object-metadata and property-metadata against the view block's own response body, mirroring the main-page chain in client.xsl, and pass both as tunnel params into the render. Adds 'endpoint' to the outer view-block context so load-object-metadata can read it. Also rename ldh:view-blocks-* to ldh:ontology-view-* (and the SPARQL string to \$ontology-view-query) to disambiguate from the ldh:View-typed block chain in block/view.xsl (ldh:view-self-thunk / ldh:view-query-thunk / ldh:view-results-thunk). The "view" here refers to the ldh:view *predicate*, not the ldh:View *type*. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c4124b4 commit 94bc699

1 file changed

Lines changed: 27 additions & 16 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block.xsl

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ exclude-result-prefixes="#all"
114114
</xsl:variable>
115115

116116
<!-- combined forward + inverse view-block lookup; substitutes VALUES ?type { ... } from the resource's rdf:types -->
117-
<xsl:variable name="view-query" as="xs:string">
117+
<xsl:variable name="ontology-view-query" as="xs:string">
118118
<![CDATA[
119119
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
120120
PREFIX ldh: <https://w3id.org/atomgraph/linkeddatahub#>
@@ -170,15 +170,16 @@ exclude-result-prefixes="#all"
170170
<xsl:for-each select="self::div[contains-token(@class, 'block')][@about]/div[contains-token(@class, 'span12')]/div[contains-token(@class, 'block')][@typeof]">
171171
<xsl:variable name="typeof-uris" select="tokenize(@typeof, ' ') ! xs:anyURI(.)" as="xs:anyURI*"/>
172172
<xsl:variable name="values-clause" select="' VALUES ?type { ' || string-join(for $t in $typeof-uris return '&lt;' || $t || '&gt;', ' ') || ' }'" as="xs:string"/>
173-
<xsl:variable name="request-uri" select="ldh:href(ac:build-uri(resolve-uri('ns', ldt:base()), map{ 'query': $view-query || $values-clause }), map{})" as="xs:anyURI"/>
173+
<xsl:variable name="request-uri" select="ldh:href(ac:build-uri(resolve-uri('ns', ldt:base()), map{ 'query': $ontology-view-query || $values-clause }), map{})" as="xs:anyURI"/>
174174
<xsl:variable name="request" select="map{ 'method': 'GET', 'href': $request-uri, 'headers': map{ 'Accept': 'application/sparql-results+xml' } }" as="map(*)"/>
175175
<xsl:variable name="context" as="map(*)" select="
176176
map{
177177
'request': $request,
178178
'container': ../..,
179-
'base-uri': ac:absolute-path(ldh:base-uri(.))
179+
'base-uri': ac:absolute-path(ldh:base-uri(.)),
180+
'endpoint': sd:endpoint()
180181
}"/>
181-
<xsl:sequence select="ldh:load-block#3($context, ldh:view-blocks-self-thunk#1, ?)"/>
182+
<xsl:sequence select="ldh:load-block#3($context, ldh:ontology-view-self-thunk#1, ?)"/>
182183
</xsl:for-each>
183184
</xsl:template>
184185

@@ -524,38 +525,38 @@ exclude-result-prefixes="#all"
524525
"/>
525526
</xsl:function>
526527

527-
<!-- view-block injection: ontology query → per-URI RDF fetch → render via bs2:Row → insert + hydrate -->
528+
<!-- ontology-view block injection: ontology query (?property ldh:view ?block) → per-URI RDF fetch → render via bs2:Row → insert + hydrate -->
528529

529-
<xsl:function name="ldh:view-blocks-self-thunk" as="item()*" ixsl:updating="yes">
530+
<xsl:function name="ldh:ontology-view-self-thunk" as="item()*" ixsl:updating="yes">
530531
<xsl:param name="context" as="map(*)"/>
531532

532-
<xsl:message>ldh:view-blocks-self-thunk</xsl:message>
533+
<xsl:message>ldh:ontology-view-self-thunk</xsl:message>
533534

534535
<xsl:sequence select="
535536
ixsl:resolve($context) =>
536-
ixsl:then(ldh:view-blocks-query-thunk#1)
537+
ixsl:then(ldh:ontology-view-query-thunk#1)
537538
"/>
538539
</xsl:function>
539540

540-
<xsl:function name="ldh:view-blocks-query-thunk" as="item()*" ixsl:updating="yes">
541+
<xsl:function name="ldh:ontology-view-query-thunk" as="item()*" ixsl:updating="yes">
541542
<xsl:param name="context" as="map(*)"/>
542543

543-
<xsl:message>ldh:view-blocks-query-thunk</xsl:message>
544+
<xsl:message>ldh:ontology-view-query-thunk</xsl:message>
544545

545546
<xsl:sequence select="
546547
ixsl:http-request($context('request')) =>
547548
ixsl:then(ldh:rethread-response($context, ?)) =>
548549
ixsl:then(ldh:handle-response#1) =>
549-
ixsl:then(ldh:view-blocks-fetch-thunk#1)
550+
ixsl:then(ldh:ontology-view-fetch-thunk#1)
550551
"/>
551552
</xsl:function>
552553

553554
<!-- handle SPARQL XML response: fan out one HTTP fetch per view URI -->
554-
<xsl:function name="ldh:view-blocks-fetch-thunk" as="map(*)" ixsl:updating="yes">
555+
<xsl:function name="ldh:ontology-view-fetch-thunk" as="map(*)" ixsl:updating="yes">
555556
<xsl:param name="context" as="map(*)"/>
556557
<xsl:variable name="response" select="$context('response')" as="map(*)"/>
557558

558-
<xsl:message>ldh:view-blocks-fetch-thunk</xsl:message>
559+
<xsl:message>ldh:ontology-view-fetch-thunk</xsl:message>
559560

560561
<xsl:if test="$response?status = 200 and $response?media-type = 'application/sparql-results+xml'">
561562
<xsl:variable name="results" select="$response?body" as="document-node()"/>
@@ -571,7 +572,15 @@ exclude-result-prefixes="#all"
571572
ixsl:http-request($view-request) =>
572573
ixsl:then(ldh:rethread-response($view-context, ?)) =>
573574
ixsl:then(ldh:handle-response#1) =>
574-
ixsl:then(ldh:view-blocks-render-thunk#1)
575+
ixsl:then(ldh:load-object-metadata#1) =>
576+
ixsl:then(ldh:http-request-threaded(?, 'metadata-request', 'metadata-response')) =>
577+
ixsl:then(ldh:handle-response(?, 'metadata-response')) =>
578+
ixsl:then(ldh:set-object-metadata#1) =>
579+
ixsl:then(ldh:load-property-metadata#1) =>
580+
ixsl:then(ldh:http-request-threaded(?, 'property-metadata-request', 'property-metadata-response')) =>
581+
ixsl:then(ldh:handle-response(?, 'property-metadata-response')) =>
582+
ixsl:then(ldh:set-property-metadata#1) =>
583+
ixsl:then(ldh:ontology-view-render-thunk#1)
575584
"
576585
on-failure="ldh:promise-failure#1"/>
577586
</xsl:for-each>
@@ -581,15 +590,15 @@ exclude-result-prefixes="#all"
581590
</xsl:function>
582591

583592
<!-- render one view block from its loaded RDF, append into the wrapper's .span12 alongside the typed resource block, hydrate via existing ldh:RenderRow chain -->
584-
<xsl:function name="ldh:view-blocks-render-thunk" as="map(*)" ixsl:updating="yes">
593+
<xsl:function name="ldh:ontology-view-render-thunk" as="map(*)" ixsl:updating="yes">
585594
<xsl:param name="context" as="map(*)"/>
586595
<xsl:variable name="response" select="$context('response')" as="map(*)"/>
587596
<xsl:variable name="container" select="$context('container')" as="element()"/>
588597
<xsl:variable name="span12" select="$container/div[contains-token(@class, 'span12')]" as="element()"/>
589598
<xsl:variable name="view-uri" select="$context('view-uri')" as="xs:anyURI"/>
590599
<xsl:variable name="base-uri" select="$context('base-uri')" as="xs:anyURI"/>
591600

592-
<xsl:message>ldh:view-blocks-render-thunk</xsl:message>
601+
<xsl:message>ldh:ontology-view-render-thunk</xsl:message>
593602

594603
<xsl:if test="$response?status = 200 and $response?media-type = 'application/rdf+xml'">
595604
<xsl:variable name="view-rdf" select="$response?body" as="document-node()"/>
@@ -601,6 +610,8 @@ exclude-result-prefixes="#all"
601610
<xsl:apply-templates select="$view-resource" mode="bs2:Row">
602611
<xsl:with-param name="about" select="xs:anyURI($base-uri || $id)"/>
603612
<xsl:with-param name="id" select="$id"/>
613+
<xsl:with-param name="property-metadata" select="$context('property-metadata')" tunnel="yes"/>
614+
<xsl:with-param name="object-metadata" select="$context('object-metadata')" tunnel="yes"/>
604615
</xsl:apply-templates>
605616
</xsl:variable>
606617

0 commit comments

Comments
 (0)