Tests that cx:sparql can produce application/sparql-results+json.
Test rdf-srj-002.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0" expand-text="false">
<p:import href="https://xmlcalabash.com/ext/library/rdf.xpl"/>
<p:output port="result"/>
<cx:sparql content-type="application/sparql-results+json">
<p:with-input port="source" href="../documents/address-book.rdf"/>
<p:with-input port="query" href="../documents/query2.rq"/>
</cx:sparql>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="fn:map">The root is not a map.</s:assert>
<s:assert test="fn:map/fn:map[@key='head']">There is no head</s:assert>
<s:assert test="fn:map/fn:map[@key='results']">There are no results</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="fn:map/fn:map[@key='head']">
<s:assert test="fn:array">The head isn’t an array</s:assert>
<s:assert test="count(fn:array/fn:string) = 3">Wrong number of columns</s:assert>
<s:assert test="fn:array/fn:string = 'category'">No category.</s:assert>
<s:assert test="fn:array/fn:string = 'name'">No name.</s:assert>
<s:assert test="fn:array/fn:string = 'locality'">No locality.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="fn:map/fn:map[@key='results']">
<s:assert test="fn:array">The results isn’t an array</s:assert>
<s:assert test="count(fn:array/fn:map) = 13">Wrong number of columns</s:assert>
<s:assert test="fn:array/fn:map/fn:map/fn:string = 'Patina'">One of the expected results is missing.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.