rdf-rj-001

Tests that .rj loads as application/rdf+json, JSON, and RDF.

Test rdf-rj-001.xml is expected to pass.

The pipeline

<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.rj"/>
   <p:identity>
      <p:with-input select=". instance of map(*)"/>
   </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>

Schematron validation

<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 are 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+json'">The result content-type is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

15 Feb 2025, Norm Tovey-Walsh

Created test.