rdf-rq-001
Tests that .rq loads as application/sparql-query and text.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0"
expand-text="false">
<p:import href="https://xmlcalabash.com/ext/library/rdf.xpl"/>
<p:output port="result"/>
<p:load name="load" href="../documents/query1.rq"/>
<p:identity>
<p:with-input select="exists(/text())"/>
</p:identity>
<p:cast-content-type content-type="text/plain"/>
<p:wrap-sequence name="first" wrapper="type"/>
<p:identity>
<p:with-input select="p:document-properties(.)"
pipe="@load"/>
</p:identity>
<p:cast-content-type name="second"
content-type="application/xml"/>
<p:wrap-sequence wrapper="wrapper">
<p:with-input pipe="@first @second"/>
</p:wrap-sequence>
</p:declare-step>
Result
<wrapper xmlns:t="http://xproc.org/ns/testsuite/3.0">
<type>true</type>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<string key="content-type">application/sparql-query</string>
<string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/query1.rq</string>
</map>
</wrapper>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:ns prefix="rdf"
uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<s:ns prefix="fn"
uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="wrapper">The root is not wrapper.</s:assert>
<s:assert test="wrapper/type">The type is missing.</s:assert>
<s:assert test="wrapper/type = 'true'">The type isn’t true.</s:assert>
<s:assert test="wrapper/fn:map">The properties map is missing.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper/fn:map">
<s:assert test="fn:string[@key='content-type'] = 'application/sparql-query'">The result content-type is incorrect.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 15 Feb 2025, Norm Tovey-Walsh
- Created test.