Tests that .rdf loads as application/rdf+xml, XML, and RDF.
Test rdf-rdf-001.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"/>
<p:load name="load" href="../documents/sample1.rdf"/>
<p:identity>
<p:with-input xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" select="exists(/rdf:RDF)"/>
</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:cast-content-type name="third" content-type="application/rdf+xml">
<p:with-input pipe="@load"/>
</p:cast-content-type>
<p:wrap-sequence wrapper="wrapper">
<p:with-input pipe="@first @second @third"/>
</p:wrap-sequence>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" 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:assert test="wrapper/rdf:RDF">The result isn’t RDF.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper/fn:map">
<s:assert test="fn:string[@key='content-type'] = 'application/rdf+xml'">The result content-type is incorrect.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.