<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xi="http://www.w3.org/2001/XInclude">
<head profile="http://www.w3.org/2003/g/data-view">
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>GRDDL Test Cases</title>
  <link rel="stylesheet" type="text/css"
  href="http://www.w3.org/StyleSheets/TR/base" />
  <link rel="transformation" href="http://www.w3.org/2001/10/trdoc2rdf" />
  <style type="text/css">
.example {
 margin-left:auto;
 margin-right:auto;
 padding-top:0.5em;
 padding-bottom:0.5em;
 width:85%;
 border-top:thin dashed black;
 border-bottom:thin dashed black;
}

  </style>
</head>

<body>

<div class="head">
<a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home"
alt="W3C" height="48" width="72" /> </a> 

<h1 id="title">GRDDL Test Cases</h1>

<h2>Editor's Draft March 13 2007</h2>
<dl>
  <dt>This version:</dt>
    <dd>...</dd>
  <dt>Latest version:</dt>
    <dd>...</dd>
  <dt>Editor:</dt>
    <dd>Chimezie Ogbuji, Cleveland Clinic Foundation, &lt;<a
      href="mailto:ogbujic@ccf.org">ogbujic@ccf.org</a>&gt;</dd>
  <dt>Authors:</dt>
    <dd>see <a href="#acknowledgements">Acknowledgments</a></dd>
</dl>

<p class="copyright"><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
© 2006-2007 <a href="http://www.w3.org/"><acronym
title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym
title="Massachusetts Institute of Technology">MIT</acronym></a>, <a
href="http://www.ercim.org/"><acronym
title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>
<hr />

<div>
<h2>Abstract</h2>

<p>This document describes and includes test cases for software agents that
extract RDF from XML source documents by following the set of mechanisms
outlined in the Gleaning Resource Description from Dialects of Language
(GRDDL) <a href="http://www.w3.org/TR/grddl/">specification</a>. They
demonstrate the expected behavior of a <a
href="http://www.w3.org/TR/grddl/#sec_agt">GRDDL-aware agent</a> by
specifying one (or more) RDF graph serializations which are the GRDDL results
associated with a single source document.</p>
</div>
<hr />

<div>
<!-- ____________________________________________ CONTENTS _________________________________________________ -->

<div>
<h2 id="toc">Table of Contents</h2>
<ul>
  <li><a href="#introduction">Introduction</a></li>
  <li><a href="#deliverables">Deliverables</a></li>
  <li><a href="#test-format">Test Manifest Format</a></li>
  <li><a href="#testft">Using the Test Driver</a></li>
  <li><a href="#earl-reporting">EARL Reporting</a></li>
  <li><a href="#protocol-tracing">Protocol Tracing</a></li>
  <li><a href="#policy">Local Policies, Faithful Rendition, and Conformance</a></li>
  <li><a href="#multiple-output">Tests with Multiple GRDDL Results</a></li>
  <li><a href="#normative">Normative Tests</a></li>
  <li><a href="#informative">Informative Tests</a></li>
  <li><a href="#references">References</a></li>
  <li><a href="#acknowledgements">Acknowledgements</a></li>
  <li><a href="#changelog">Change Log</a></li>
</ul>
</div>

<h2 id="introduction">Introduction</h2>

<p>A set of test cases is provided as part of the definition of GRDDL.  This 
  document presents those test cases.  They are intended to provide examples 
  for, and clarification of, the normative behavior of a GRDDL-aware agent.
  They should be used for testing the conformance of GRDDL-aware agents. The
normative tests cover behavior expected of a GRDDL-aware
agent.  The informative tests demonstrate other permitted behavior with respect to
the issues resolved by the Working Group.  This document itself has (as a GRDDL result) a manifest document
describing the test cases in RDF. </p>
</div>

<div>
<h2 id="deliverables">Deliverables</h2>
The deliverables included as part of the test case collection are: 
<ul>
  <li>A recommendation track document which normatively includes the tests</li>
  <li>A manifest RDF/XML document describing the collection of tests</li>
  <li>An example driver for use with testing a particular implementation</li>
  <li>A zip archive including: 
    <ul>
      <li>The input and output(s) for each test</li>
      <li>The manifest file</li>
      <li>The test driver</li>
    </ul>
  </li>  
</ul>
</div>

<div>
<h2 id="test-format">Test Manifest Format</h2>

<p>This test collection uses an RDF vocabulary for manifests developed for
the <a href="http://www.w3.org/TR/rdf-testcases/">RDF Test Cases</a>
Recommendation. A GRDDL-aware agent can extract the test collection and
automatically test compliance by attempting to reproduce the expected GRDDL
result(s) associated with each test case.  The output documents are read as if they were retrieved from the URL
of the input document.  Some input documents have multiple output documents, see <a href="#multiple-output">below</a></p>
</div>
<div>
<h2 id="testft">Using the Test Driver</h2>

<p>We provide testft.py, a test driver, written in <a href="http://www.python.org">Python</a> and based on <a
href="http://rdflib.net/2006/10/15/rdflib-2.3.3.tar.gz">rdflib 2.3.3</a>.
Run it a la:</p>

<p><code class="example">$ python testft.py --run your_grddl_impl
testlist1.rdf &gt;earl_out.rdf </code> <code class="example">All tests were
passed!</code> </p>

<p></p>

<p>It has options for --debug and such; invoke it with no arguments (or with
--help) for details:</p>
<pre>Options:
  -r, --run              path to a GRDDL implementation to use to process the 
                         source document (checking results)
  -u, --update           path to a GRDDL Implementation to use to process the 
                         source document
      --tester           The URI of an agent associated with the EARL test assertions.
                         A BNode is used if none is given                          
      --project          The URI of the EARL 'subject' (the implementation being tested).
                         A BNode is used if none is given</pre>

<p>The tests do not require the use of this driver</p>
</div>

<div>
<h2 id="earl-reporting">EARL Reporting</h2>

<p>In addition to writing various diagnostic messages to STDERR, the test
harness writes additional RDF data to STDOUT: an <a
href="http://www.w3.org/TR/EARL10-Schema/">EARL</a> assertion about each test
it runs.</p>

<p>To tell it about the person running the tests and the software project
being tested, point it to a tester (a URI in a FOAF RDF graph) and a test
subject (a URI in a DOAP RDF graph).</p>
</div>

<div>
<h2 id="protocol-tracing">Protocol Tracing</h2>

<p>We find <a href="http://hathawaymix.org/Software/TCPWatch">TCPWatch</a>
useful for debugging <a
href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">HTTP</a> protocol
interactions. If you start TCPWatch like so:</p>
<span class="example">$ python tcpwatch.py -p 6543 &amp;</span> 

<p>then you can use it as a proxy:</p>
<span class="example">$ http_proxy=http://127.0.0.1:6543 python testft.py
--run your_grddl_impl testharness.rdf</span> </div>

<div>
<h2 id="policy">Local Policies, Faithful Rendition, and Conformance</h2>

<p>The GRDDL specification states that any transformation identified by an
author of a GRDDL source document will provide a <a
href="http://www.w3.org/TR/grddl/#sec_rend">Faithful Rendition</a> of the
information expressed in the source document. The specification also grants a
GRDDL-aware agent the license to makes a determination of whether or not to
apply a particular transformation guided by user interaction, a local
security policy, or the agent's capabilities. However, for the purpose of
running these tests in order to determine compliance, a GRDDL-aware agent
with a security policy which does not prevent it from applying
transformations identified by each test will produce the GRDDL result
associated with each test.</p>
</div>

<div>
<h2 id="multiple-output">Tests with Multiple GRDDL Results</h2>

<p>Certain tests have multiple GRDDL results as a direct consequence of <a
href="http://www.w3.org/TR/grddl/#issue-faithful-infoset">Faithful
Infoset</a> considerations, information resources with <a
href="http://www.w3.org/TR/webarch/#pr-describe-resource">multiple
representations</a>, and seperate GRDDL mechanisms which produce distinct
GRDDL results. For such tests, A GRDDL-aware agent should output at least one
of the GRDDL results associated with the test case.</p>
</div>

<div>
<h2 id="normative">Normative Tests</h2>

<p>Each test has an input document and an output document.  the output document is an RDF/XML document and 
  represents a GRDDL result of the input document.</p>

</div>

<h3>Localized Tests</h3>

<p>For the sake of convenience, this first set of normative tests cover
scenarios where neither <a
href="http://www.w3.org/TR/grddl/#ns-bind">namespace documents</a> nor
absolute URIs are used. Such tests can run offline rather easily.</p>
<ul class="TestList" xml:base="">
  <xi:include href="../td/testlist1.html" xpointer="/html/body/ul[@class='TestList']/li[@id='xmlWithGrddlAttribute']"/>
  <xi:include href="../td/testlist1.html" xpointer="/html/body/ul[@class='TestList']/li[@id='projectsSpreadsheet']"/>
  <xi:include href="../td/testlist1.html" xpointer="/html/body/ul[@class='TestList']/li[@id='rdfa1']"/>
  <xi:include href="../td/testlist1.html" xpointer="/html/body/ul[@class='TestList']/li[@id='inline']"/>
  <xi:include href="../td/testlist1.html" xpointer="/html/body/ul[@class='TestList']/li[@id='base-param']"/>
</ul>

<h3>Namespace Documents and Absolute Locations</h3>

<p>These tests include the use of namespace documents and absolute URIs and
are more difficult to run offline.</p>
<ul class="TestList">
  <li id="title_author"><b>#title_author: example for GRDDL/XML rules</b> 

    <div>
    <a href="titleauthor.html">input</a>, <a
    href="titleauthor-output.rdf">output</a></div>
  </li>
  <li id="hcard1"><b>#hcard1: test an hcard profile</b> 

    <div>
    <a href="card.html">input</a>, <a href="card-output.rdf">output</a>
    (@@something is funky with the fax field)</div>
  </li>
  <li id="multiprofile"><b>#multiprofile: 2 profiles: eRDF and hCard</b> 

    <div>
    <a href="multiprofile.html">input</a>, <a
    href="multiprofile-output.rdf">output</a> </div>
  </li>
  <li id="sq1"><b>squirrel test 1 re namespace documents and media types</b>
    <a href="sq1.xml">input</a> <a href="sq1-output.rdf">output</a> </li>
  <li id="sq2"><b>squirrel test 2 re namespace documents and media types</b>
    <a href="sq2.xml">input</a> <a href="sq2-output.rdf">output</a> 
    <p>@@Why (?nsDoc grddl:namspaceTransformation
    &lt;http://dev.w3.org/cvsweb/~checkout~/2005/grddl-ts/sq1t.xsl&gt;) -
    i.e., absolute URI?</p>
  </li>
  <li id="multipleRepresenations"><b>#multipleRepresentations: Check that the
    transform associated with the correct representation is used. </b> 

    <div>
    <a href="multipleRepresentations">input</a>, <a
    href="multipleRepresentations.rdf">output</a></div>
  </li>
</ul>

<div>

<div>
<h3>Ambiguos Infosets and Representations</h3>

<p>These tests help check for robustness of implementations in the face of
various odd cases.</p>
<ul
xmlns:g="http://www.w3.org/2001/sw/grddl-wg/td/alternative-test-results.rdfs#"
 xmlns:xlink="http://www.w3.org/1999/xlink" class="TestList">
  <li id="loop"><b>a loop in the namespace names</b> <a
    href="loop.xml">input</a> <a href="loop-output.rdf">output</a> 
    <p>@@ACK: thanks Gokhan Soydan</p>
  </li>
  <li id="xslt_literal_result"><b>xslt_literal_result</b> <a
    href="litres.xml">input</a> <a href="empty.rdf">output</a> is empty; is
    that right??@@ 
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="xinclude"><b>Testing GRDDL when XInclude processing is enabled</b>
    <a href="xinclude1.html">input</a> <a href="xinclude1.rdf">output</a> 
    <p>@@Does this work on Xalan and Saxon??@@</p>
    <p>In this test case, the input file uses <a
    href="http://www.w3.org/TR/xinclude/">XInclude</a> to include <a
    href="xinclude2.xml">xinclude2.xml</a>, and that the output has only one
    triple unless the XML Processor of the GRDDL implementation implements
    XInclude. The output for this case assumes that the processor
    <em>does</em> resolve XIncludes. Note, however, that this test case
    subsumes the XInclude disabled test case, which assumes that the GRDDL
    implementation has disabled XInclude processing.</p>
    <p>See also <a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a>.</p>
  </li>
  <li id="noxinclude"><b>Testing GRDDL when XInclude processing is
    disabled</b> <a href="xinclude1.html">input</a> <a
    href="noxinclude1.rdf">output</a> 
    <p>This test case is an alternative to <a href="#xinclude">the XInclude
    enabled test case</a>. The output for this case assumes that the
    processor <em>does not</em> resolve XIncludes, which may lead to a
    different GRDDL result.</p>
  </li>
  <li id="grddlonrdf1"><b>Testing GRDDL attributes on RDF documents (1 of
    3)</b> <a href="grddlonrdf.rdf">input</a> <a
    href="grddlonrdf-output1.rdf">output</a> 
    <p>Note that the input is a RDF document with a GRDDL transformation, and
    that according to the rules given by the <a
    href="http://www.w3.org/TR/grddl/">GRDDL Specification</a>, there are
    <i>three distinct and equally valid output graphs for this test</i> for
    this document. <i>An implementation only has to produce one of these
    three</i>. This <a href="grddlonrdf-output1.rdf">output</a> is the result
    of the transformation without merging it with the graph of the source
    document.</p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="grddlonrdf2"><b>Testing GRDDL attributes on RDF documents (2 of
    3)</b> <a href="grddlonrdf.rdf">input</a> <a
    href="grddlonrdf-output2.rdf">output</a> 
    <p>See <a href="grddlonrdf1">the explanation</a> of having <i>three valid
    outputs</i> for this test case. This <a
    href="grddlonrdf-output1.rdf">output</a> is a graph that is identical
    with the graph given by the input document.</p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="grddlonrdf3"><b>Testing GRDDL attributes on RDF documents (3 of
    3)</b> <a href="grddlonrdf.rdf">input</a> <a
    href="grddlonrdf-output3.rdf">output</a> 
    <p>See <a href="grddlonrdf1">the explanation</a> of having <i>three valid
    outputs</i> for this test case. This <a
    href="grddlonrdf-output1.rdf">output</a> is a graph that is merge of the
    graph given by the source document with the graph given by the result of
    the GRDDL transformation.</p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="grddlonrdf-xmlmediatype1"><b>Testing GRDDL attributes on RDF
    documents with XML media type(1 of 3)</b> <a
    href="grddlonrdf-xmlmediatype.rdf">input</a> <a
    href="grddlonrdf-xmlmediatype-output1.rdf">output</a> 
    <p>See <a href="grddlonrdf1">the explanation</a> of having <i>three valid
    outputs</i> for this test case. This differs from that test case in that
    the RDF file is served (not best practice, but rather common) as
    media-type "application/xml". The <a
    href="grddlonrdf-xmlmediatype-output1.rdf">output</a> is the result of
    the transformation without merging it with the graph of the source
    document.</p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="grddlonrdf-xmlmediatype2"><b>Testing GRDDL attributes on RDF
    documents with XML media type(2 of 3)</b> <a
    href="grddlonrdf-xmlmediatype.rdf">input</a> <a
    href="grddlonrdf-xmlmediatype-output2.rdf">output</a> 
    <p>See <a href="grddlonrdf1">the explanation</a> of having <i>three valid
    outputs</i> for this test case. This differs from that test case in that
    the RDF file is served (not best practice, but rather common) as
    media-type "application/xml". The <a
    href="grddlonrdf-xmlmediatype-output2.rdf">output</a> is a graph that is
    identical with the graph given by the input document.</p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="grddlonrdf-xmlmediatype3"><b>Testing GRDDL attributes on RDF
    documents with XML media type(3 of 3)</b> <a
    href="grddlonrdf-xmlmediatype.rdf">input</a> <a
    href="grddlonrdf-xmlmediatype-output3.rdf">output</a> 
    <p>See <a href="grddlonrdf1">the explanation</a> of having <i>three valid
    outputs</i> for this test case. This differs from that test case in that
    the RDF file is served (not best practice, but rather common) as
    media-type "application/xml". The <a
    href="grddlonrdf-xmlmediatype-output3.rdf">output</a> is a graph that is
    merge of the graph given by the source document with the graph given by
    the result of the GRDDL transformation </p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
</ul>
</div>

<h2 id="informative">Informative Tests</h2>

<p>These tests cover features not mandated explicitely by the GRDDL
specification, but demonstrate behavior expected of a GRDDL-aware agent in
the context of Web Architecture best practices (@@Appropriate [WEBARCH]
link?). They also cover behavior suggested by the Working Group as a result
of resolving certain issues.</p>

<p>@@TODO: How to reconcile current (approved but informative) status of the
Atom / Turtle test? - There was appreciable consensus on mentioning RDF
graphs not RDF/XML documents</p>
<ul
xmlns:g="http://www.w3.org/2001/sw/grddl-wg/td/alternative-test-results.rdfs#"
 xmlns:xlink="http://www.w3.org/1999/xlink" class="TestList">
  <li id="atomttl1"><b>#atomttl1: re issue <a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-output-formats">issue-output-formats</a>
    yes, transformations may produce serializations other than RDF/XML</b>;
    see <a
    href="http://lists.w3.org/Archives/Public/public-grddl-wg/2006Nov/0104.html">26
    Nov from Danny and Henry</a> <a href="atom-grddl.xml">input</a>, <a
    href="atom-grddl-output.rdf">output</a>. 
    <p>Note the transformation, <a
    href="atom2turtle_xslt-1.0.xsl">atom2turtle_xslt-1.0.xsl</a>, gives an
    RDF graph using turtle rather than RDF/XML. This test uses the
    <tt>text/rdf+n3</tt> media type, which should appear in the <a
    href="http://www.iana.org/assignments/media-types/text/">IANA list of
    text media types</a> in due course. See also the <a
    href="http://www.w3.org/2001/sw/DataAccess/crq349">SPARQL CR request</a>
    of Apr 2006.</p>
    <p>See also: <a
    href="http://djpowell.net/blog/entries/Atom-RDF.html">Atom/RDF</a> in
    progress Aug 2006 by David Powell.</p>
    <p>APPROVED in <a
    href="http://lists.w3.org/Archives/Public/public-grddl-wg/2007Jan/att-0072/GRDDL_WG_Weekly_--_24_Jan_2007.html#item06">24
    Jan discussion of #issue-output-formats</a></p>
  </li>
  <li id="langconneg1"><b>Content Negotiation with GRDDL (1 of 2)</b> <a
    href="conneg.html">input</a> <a href="conneg-en.rdf">output</a> 
    <p>This test exists to bring attention to developers to issues of
    <i>content negotiation</i>, in particular, content negotiation over
    language as described and implemented by W3C QA. There <i>are two valid
    resulting GRDDL results</i> of running this GRDDL transformation
    depending on what language the GRDDL-aware agent uses, and an
    implementation of a GRDDL-aware agent only needs to retrieve the one that
    is appropriate for its HTTP header request. This result follows from
    retrieving a English version of the HTML representation and thus having
    the GRDDL result produce a result with English-language content. </p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="langconneg2"><b>Content Negotiation with GRDDL (2 of 2)</b> <a
    href="conneg.html">input</a> <a href="conneg-de.rdf">output</a> 
    <p>See <a href="langconneg1">the explanation</a> of having <i>two valid
    outputs</i> for this test case. This result follows from retrieving a
    German version of the HTML representation and thus having the GRDDL
    result produce a result with German-language content. </p>
    <p><a
    href="http://www.w3.org/2004/01/rdxh/spec#issue-mt-ns">issue-mt-ns</a></p>
  </li>
  <li id="httpHeaders"><b>#httpHeaders: test the use http headers to define a
    transform </b> by jjc, uploaded by bwm Feb 19, 2007. Note that a
    .htaccess file is used to generate the required headers. 

    <div>
    <a href="httpHeaders.xml">input</a>, <a href="httpHeaders.rdf">output</a> 
    <p>@@What is the status of this scenario?</p>
    </div>
  </li>
</ul>

<h2 id="acknowledgements">References</h2>

<p>@@Need references</p>

<h3>Normative</h3>

<h3>Informative</h3>
</div>

<h2 id="acknowledgements">Acknowledgements</h2>

<p>@@Need comprehensive list of acknowledgements</p>
  
<h2 id="changelog">Change Log</h2>
$Log: grddl-tests-xincluded.xml,v $
Revision 1.1  2007/03/19 12:57:36  cogbuji
initial WD push.  moved content from grddl-wg/td to grddl-wg/doc50

</body>
</html>

