<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
  <t:info>
    <t:title>rdf-nq-002</t:title>
    <t:revision-history>
      <t:revision>
        <t:date>2025-02-15</t:date>
        <t:author>
          <t:name>Norm Tovey-Walsh</t:name>
        </t:author>
        <t:description xmlns="http://www.w3.org/1999/xhtml">
          <p>Created test.</p>
        </t:description>
      </t:revision>
    </t:revision-history>
  </t:info>
  <t:description xmlns="http://www.w3.org/1999/xhtml">
    <p>Tests that application/n-quads works in p:inline, p:document, and p:load.</p>
  </t:description>
  <t:pipeline>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                name="main" version="3.0">
  <p:import href="https://xmlcalabash.com/ext/library/rdf.xpl"/>
  <p:output port="result"/>

  <p:identity>
    <p:with-input>
      <p:inline content-type="application/n-quads"><![CDATA[
_:B94ae07267c8e3c98886cab4883da1595 <http://xmlns.com/foaf/0.1/name> "Norman Walsh" .
_:B94ae07267c8e3c98886cab4883da1595 <http://xmlns.com/foaf/0.1/homepage> <https://nwalsh.com/> .
_:B94ae07267c8e3c98886cab4883da1595 <http://xmlns.com/foaf/0.1/weblog> <https://so.nwalsh.com/> .
_:Bbd33373016dd022b2f2bdf1f9fe7ac1e <http://xmlns.com/foaf/0.1/name> "Achim Berndzen" .
_:Be24eef7b1839b67eaf3330831bee529d <http://xmlns.com/foaf/0.1/name> "Gerrit Imsieke" .
_:B09d6ddcf8fcacaf516dd3e5934dcf476 <http://xmlns.com/foaf/0.1/name> "Erik Siegel" .
<https://xproc.org/> <http://purl.org/dc/terms/title> "XProc" .
<https://xproc.org/> <http://purl.org/dc/terms/type> <http://purl.org/dc/dcmitype/Collection> .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/title> "XProc 3.0: An XML Pipeline Language" .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/date> "2022-09-12"^^<http://www.w3.org/2001/XMLSchema#date> .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/type> <http://purl.org/dc/dcmitype/Text> .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/hasVersion> "3.0" .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/isPartOf> <https://xproc.org/> .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/contributor> _:B94ae07267c8e3c98886cab4883da1595 .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/contributor> _:Bbd33373016dd022b2f2bdf1f9fe7ac1e .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/contributor> _:Be24eef7b1839b67eaf3330831bee529d .
<https://spec.xproc.org/3.0/xproc/> <http://purl.org/dc/terms/contributor> _:B09d6ddcf8fcacaf516dd3e5934dcf476 .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/title> "XProc 3.0: Standard Step Library" .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/date> "2022-09-12"^^<http://www.w3.org/2001/XMLSchema#date> .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/type> <http://purl.org/dc/dcmitype/Text> .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/hasVersion> "3.0" .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/isPartOf> <https://xproc.org/> .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/contributor> _:B94ae07267c8e3c98886cab4883da1595 .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/contributor> _:Bbd33373016dd022b2f2bdf1f9fe7ac1e .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/contributor> _:Be24eef7b1839b67eaf3330831bee529d .
<https://spec.xproc.org/3.0/steps/> <http://purl.org/dc/terms/contributor> _:B09d6ddcf8fcacaf516dd3e5934dcf476 .
      ]]></p:inline>
    </p:with-input>
  </p:identity>
  <p:cast-content-type name="first" content-type="application/rdf+xml"/>

  <p:identity>
    <p:with-input>
      <p:document content-type="application/n-quads" href="../documents/sample1.nq"/>
    </p:with-input>
  </p:identity>
  <p:cast-content-type name="second" content-type="application/rdf+xml"/>

  <p:load content-type="application/n-quads" href="../documents/sample1.nq"/>
  <p:cast-content-type name="third" content-type="application/rdf+xml"/>

  <p:wrap-sequence wrapper="wrapper">
    <p:with-input pipe="@first @second @third"/>
  </p:wrap-sequence>
</p:declare-step>
  </t:pipeline>
  <t:schematron>
    <s:schema queryBinding="xslt2"
              xmlns:s="http://purl.oclc.org/dsdl/schematron">
      <s:ns prefix="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
      <s:pattern>
        <s:rule context="/">
          <s:assert test="wrapper">The root is wrong.</s:assert>
          <s:assert test="count(wrapper/rdf:RDF) = 3">RDF output is incorrect.</s:assert>
        </s:rule>
      </s:pattern>
    </s:schema>
  </t:schematron>
</t:test>
