rdf-jsonld-003
Tests application/ld+json can be queried.
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"/>
<p:load content-type="application/ld+json"
href="../documents/sample1.jsonld"/>
<cx:sparql>
<p:with-input port="query">
<p:document content-type="application/sparql-query"
href="../documents/query1.rq"/>
</p:with-input>
</cx:sparql>
</p:declare-step>
Result
<sparql xmlns="http://www.w3.org/2005/sparql-results#"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<head>
<variable name="document"/>
<variable name="title"/>
</head>
<results>
<result>
<binding name="document">
<uri>https://xproc.org/</uri>
</binding>
<binding name="title">
<literal datatype="http://www.w3.org/2001/XMLSchema#string">XProc</literal>
</binding>
</result>
<result>
<binding name="document">
<uri>https://spec.xproc.org/3.0/xproc/</uri>
</binding>
<binding name="title">
<literal datatype="http://www.w3.org/2001/XMLSchema#string">XProc 3.0: An XML Pipeline Language</literal>
</binding>
</result>
<result>
<binding name="document">
<uri>https://spec.xproc.org/3.0/steps/</uri>
</binding>
<binding name="title">
<literal datatype="http://www.w3.org/2001/XMLSchema#string">XProc 3.0: Standard Step Library</literal>
</binding>
</result>
</results>
</sparql>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:ns prefix="sr"
uri="http://www.w3.org/2005/sparql-results#"/>
<s:pattern>
<s:rule context="/">
<s:assert test="sr:sparql">The root is wrong.</s:assert>
</s:rule>
<s:rule context="/sr:sparql">
<s:assert test="sr:head">There’s no head</s:assert>
<s:assert test="sr:results">There are no results</s:assert>
</s:rule>
<s:rule context="/sr:sparql/sr:head">
<s:assert test="count(sr:variable) = 2">Wrong number of headers</s:assert>
</s:rule>
<s:rule context="/sr:sparql/sr:results">
<s:assert test="count(sr:result) = 3">Wrong number of results</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 13 Feb 2025, Norm Tovey-Walsh
- Created test.