rdf-srx-003

Tests application/sparql-results+xml can be cast to text/plain.

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"/>
   <cx:sparql content-type="application/sparql-results+xml">
      <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="text/plain"/>
   <p:wrap-sequence wrapper="text"/>
</p:declare-step>

Result

<text xmlns:t="http://xproc.org/ns/testsuite/3.0">|---------------+---------------------------+-----------------|
| category      | name                      | locality        |
|---------------+---------------------------+-----------------|
| Restaurants   | Timo’s                    | San Francisco   |
| Restaurants   | Tamarine Restaurant       | Palo Alto       |
| Restaurants   | Patina                    | Los Angeles     |
| Restaurants   | Masa’s Restaurant         | San Francisco   |
| Restaurants   | Luka’s Taproom & Lounge   | Oakland         |
| Restaurants   | Le Papillon               | San Jose        |
| Restaurants   | Kabul Afghan Cuisine      | San Carlos      |
| Restaurants   | 71 Saint Peter            | San Jose        |
| Restaurants   | À Côté                    | Oakland         |
| Restaurants   | Amber Indian Restaurant   | Mountain View   |
| Restaurants   | Boulevard                 | San Francisco   |
| Restaurants   | Charles Nob Hill          | San Francisco   |
| Restaurants   | El Farolito               | San Francisco   |
|---------------+---------------------------+-----------------|
</text>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="text">The root is not text.</s:assert>
         <s:assert test="contains(text, 'Patina')">One of the expected results is missing.</s:assert>
         <s:assert test="count(tokenize(text, '
')) = 18">Wrong number of results: <s:value-of select="count(tokenize(text, '
'))"/>.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

15 Feb 2025, Norm Tovey-Walsh
Created test.