Skip to content

Commit b7248c6

Browse files
committed
Add link to documentation for how to create an endpoint.
1 parent 6e0e514 commit b7248c6

2 files changed

Lines changed: 245 additions & 0 deletions

File tree

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ <h2>Overview</h2>
6161
<li>After running all tests, you can generate an <a href="">EARL Report</a> using the <button class='btn btn-primary btn-sm'>EARL Report</button> button.</li>
6262
</ul>
6363
<p>So that the test suite can access the processor to request resources, please be sure to add <code>Access-Control-Allow-Origin: *</code> to returned HTTP headers.</p>
64+
<p class="text-warning">Due to differences in how browsers implement XMLHTTPRequest, some tests may not run properly on browsers other than WebKit or Firefox.</p>
65+
<p>See <a href="{{ base_url }}/test-suite/suite-details">this page</a> for more information on the design of the test suite and how to create a processor end-point.</p>
6466
</div>
6567
<div class='row'>
6668
<h2>

suite-details.html

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
---
2+
layout: default
3+
title: "RDFa / Test Suite Endpoint"
4+
nav_index: 4
5+
---
6+
<div class="container">
7+
8+
<div class="row">
9+
<h1 id="rdfa_test_suite">RDFa Test Suite</h1>
10+
11+
<p>The RDFa Test Suite is a set of Web Services, markup and tests that can
12+
be used to verify RDFa Processor conformance to the set of specifications
13+
that constitute RDFa 1.1. The goal of the suite is to provide an easy and
14+
comprehensive RDFa testing solution for developers creating RDFa Processors.</p>
15+
16+
<h2 id="design">Design</h2>
17+
18+
<p>The RDFa Test suite allows developers to mix and match RDFa processor endpoints
19+
with different RDFa versions and Host Languages.</p>
20+
21+
<p>The RDFa Test Suite is an single-page HTML application driving the entire
22+
process.</p>
23+
24+
<p>The page is loaded with the complete lists of tests associated with different RDFa versions and host languages.
25+
To execute a test, the application uses the <code>processorUrl</code> and appends URI query parameters identifying the test source and other necessary parameters, upon which the processor will return the parsed RDF represented as either <a href="">N-Triples</a> or <a href="">Turtle</a>. As the processor executes in HTML, it is important that the processor return the header <code>Access-Control-Allow-Origin: *</code>.
26+
The application also fetches an associated SPARQL query, which
27+
uses an <em>ASK</em> form to return true or false.</p>
28+
29+
<p>The test-suite is implemented using <a href="https://en.wikipedia.org/wiki/JavaScript">JavaScript</a> and <a href="https://github.com/linkeddata/rdflib.js/">rdflib.js</a>.
30+
The user interface is implemented in JavaScript using
31+
<a href="http://twitter.github.com/bootstrap/">Bootstrap.js</a> and <a href="http://documentcloud.github.com/backbone/">Backbone.js</a>.</p>
32+
33+
<p>The test files are managed statically using <a href="https://jekyllrb.com">Jekyll</a> with a <a href="https://en.wikipedia.org/wiki/Rake_(software">Rake task</a>) used to build version- and language-specific test files.</p>
34+
35+
<p>The HTML application is implemented principally in JavaScript using <a href="http://documentcloud.github.com/backbone/">Backbone.js</a> as a model-viewer-controller, which downloads the test suite manifest and creates a simple user interface using <a href="http://twitter.github.com/bootstrap/">Bootstrap.js</a> to run tests, or get test details.</p>
36+
37+
<p>Processing happens in the following order:</p>
38+
39+
<pre><code>RDFa Test Suite | RDFa Website | RDFa Processor
40+
load webpage -&gt;
41+
&lt;- test scaffold
42+
load manifest -&gt;
43+
&lt;- JSON-LD manifest
44+
run test -&gt; Load SPARQL query.
45+
-&gt; Process referenced
46+
test document and
47+
return RDF with
48+
Content-Type indicating
49+
&lt;- format.
50+
SPARQL runs with
51+
returned document
52+
returning _true_
53+
or _false_.
54+
55+
display results
56+
</code></pre>
57+
58+
<h2 id="running_the_test_suite">Running the test suite</h2>
59+
60+
<p>You can view and run this test suite at the following URL:</p>
61+
62+
<p><a href="http://rdfa.info/test-suite">http://rdfa.info/test-suite</a></p>
63+
64+
<h2 id="how_to_add_a_unit_test">How to add a unit test</h2>
65+
66+
<p>In order to add a unit test, you must follow these steps:</p>
67+
68+
<ol>
69+
<li>Pick a new unit test number. For example - 250. To be consistent, please use
70+
the next available unit test number.</li>
71+
<li>Create a markup file in the tests/ directory with a .txt extension.
72+
For example: tests/250.txt</li>
73+
<li>Create a SPARQL query file in the tests/ directory with a .sparql extension.
74+
For example: tests/250.sparql</li>
75+
<li>Add your test to manifest.ttl and indicate the host language(s) and version(s) for which
76+
it applies. For example, if you would like your example to only apply to HTML4,
77+
you would specify <code>rdfatest:hostLanguage "html4";</code> in the test case entry.</li>
78+
</ol>
79+
80+
<p>There are three classifications for Unit Tests:</p>
81+
82+
<ul>
83+
<li>required - These are tests that are required for proper operation per the
84+
appropriate RDFa specification.</li>
85+
<li>optional - These are tests for optional features supported by some RDFa
86+
Processors.</li>
87+
<li>buggy - These are tests that are buggy or are not considered valid test
88+
cases by all RDFa processor maintainers.</li>
89+
</ul>
90+
91+
<p>The test suite is designed to empower RDFa processor maintainers to create
92+
and add tests as they see fit. This may mean that the test suite may become
93+
unstable from time to time, but this approach has been taken so that the
94+
long-term goal of having a comprehensive test suite for RDFa can be achieved
95+
by the RDFa community.</p>
96+
97+
<p>When running locally, after adding a unit test, run <code>rake cache:clear</code> to remove cached files and ensure that necessary HTTP resources are regenerated. For the deployed website, this happens automatically each time a Git commit is pushed to the server.</p>
98+
99+
<h2 id="how_to_create_a_processor_endpoint">How to create a processor endpoint.</h2>
100+
101+
<p>The Test Suite operates by making a call to a <em>processor endpoint</em> with a query parameter that indicates
102+
the URL of the test document to be processed. Within the test suite, a text box (upper right-hand corner)
103+
allows a processor endpoint to be selected or added manually. It is presumed that the endpoint URL ends
104+
with a query parameter to which a test URL can be appended. For example, the <em>pyrdfa</em> endpoint is
105+
defined as follows: <code>http://www.w3.org/2012/pyRdfa/extract?uri=</code>. When invoked, the URL of an actual
106+
test will be appended, such as the following:
107+
<code>http://www.w3.org/2012/pyRdfa/extract?uri=http://rdfa.info/test-suite/test-cases/xml/rdfa1.1/0001.xml</code>.</p>
108+
109+
<p>Everything required by a processor can be presumed from the content of the document provided, however
110+
the test suite will also set a <code>Content-Type</code> HTTP header appropriate for the document provided, these include
111+
* application/xhtml+xml,
112+
* application/xml,
113+
* image/svg+xml, and
114+
* text/html</p>
115+
116+
<p>The processor is called with HTTP Accept header indicating appropriate result formats (currently,
117+
<code>text/turtle</code> (indicating <a href="http://www.w3.org/TR/turtle/">Turtle</a>),
118+
<code>application/rdf+xml</code> (indicating <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a>), and
119+
<code>text/plain</code> (indicating <a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>)), and the processor may
120+
respond with an appropriate RDF format. Processors <em>SHOULD</em> set the HTTP <code>Content-Type</code> of the resulting
121+
document to the associated document Mime Type.</p>
122+
123+
<p>In some cases, the test suite may add additional query parameters to the endpoint URL to test different
124+
required or optional behaviors, these include <code>rdfagraph</code>, taking a value of <code>original</code>, <code>processor</code>, or
125+
<code>original,processor</code> to control the processor output
126+
(see <a href="http://www.w3.org/TR/rdfa-core/#accessing-the-processor-graph">RDFa Core 1.1 Section 7.6.1</a>).
127+
Also, <code>vocab_expansion</code> taking any value is used
128+
to control optional RDFa vocabulary expansion
129+
(see <a href="http://www.w3.org/TR/rdfa-core/#s_expansion_control">RDFa Core 1.1 Section 10.2</a>).</p>
130+
131+
<p>To add a processor to the test suite, add to the object definition in
132+
<code>processors.json</code> in alphabetical order. This is currently defined as follows:</p>
133+
134+
<pre><code>{
135+
"any23 (Java)": {
136+
"endpoint": "http://any23.org/turtle/",
137+
"doap": "http://any23.org/",
138+
"doap_url": "/earl-reports/any23-doap.ttl"
139+
},
140+
"clj-rdfa (Clojure)": {
141+
"endpoint": "http://clj-rdfa.herokuapp.com/extract.ttl?url=",
142+
"doap": "https://github.com/niklasl/clj-rdfa",
143+
"doap_url": "/earl-reports/clj-rdfa-doap.ttl"
144+
},
145+
"EasyRdf (PHP)": {
146+
"endpoint": "http://www.easyrdf.org/converter?input_format=rdfa&amp;raw=1&amp;uri=",
147+
"doap": "http://www.aelius.com/njh/easyrdf/",
148+
"doap_url": "/earl-reports/easyrdf-doap.ttl"
149+
},
150+
"Green Turtle (JavaScript)": {
151+
"doap": "https://code.google.com/p/green-turtle/",
152+
"doap_url": "/earl-reports/green-turtle-doap.ttl"
153+
},
154+
"java-rdfa (Java)": {
155+
"endpoint": "http://rdf-in-html.appspot.com/translate/?parser=XHTML&amp;uri=",
156+
"doap": "https://github.com/shellac/java-rdfa",
157+
"doap_url": "/earl-reports/java-rdfa-doap.ttl"
158+
},
159+
"librdfa (C)": {
160+
"endpoint": "http://librdfa.digitalbazaar.com/rdfa2rdf.py?uri=",
161+
"doap": "https://github.com/rdfa/librdfa",
162+
"doap_url": "/earl-reports/librdfa-doap.ttl"
163+
},
164+
"pyRdfa (Python)": {
165+
"endpoint": "http://www.w3.org/2012/pyRdfa/extract?uri=",
166+
"doap": "http://www.w3.org/2012/pyRdfa"
167+
},
168+
"RDF::RDFa (Ruby)": {
169+
"endpoint": "http://rdf.greggkellogg.net/distiller?raw=true&amp;in_fmt=rdfa&amp;uri=",
170+
"doap": "http://rubygems.org/gems/rdf-rdfa",
171+
"doap_url": "/earl-reports/rdf-rdfa-doap.ttl"
172+
},
173+
"RDF::RDFa::Parser (Perl)": {
174+
"endpoint": "http://buzzword.org.uk/2012/rdfa-distiller/?format=rdfxml&amp;url=",
175+
"doap": "http://purl.org/NET/cpan-uri/dist/RDF-RDFa-Parser/v_1-097",
176+
"doap_url": "/earl-reports/rdf-rdfa-parser-doap.ttl"
177+
},
178+
"Semargl (Java)": {
179+
"endpoint": "http://demo.semarglproject.org/process?uri=",
180+
"doap": "http://semarglproject.org"
181+
},
182+
"other": {
183+
"endpoint": "",
184+
"doap": ""
185+
}
186+
}
187+
</code></pre>
188+
189+
<p>The <code>doap</code> is the IRI defining the processor. It should be an information resource resulting in a
190+
<a href="https://github.com/edumbill/doap/wiki">DOAP</a> project description, and will be used when formatting reports.</p>
191+
192+
<p>If the DOAP project description location differs from the identifying IRI, set that location in <code>doap_url</code></p>
193+
194+
<h2 id="document_caching">Document caching</h2>
195+
196+
<p>Test cases are provided with HTTP ETag headers and expiration values.
197+
Processors <em>MAY</em> cache test case documents but <em>MUST</em> validate the document using HTTP HEAD or conditional GET
198+
operations.</p>
199+
200+
<h2 id="crazy_ivan">Crazy Ivan</h2>
201+
202+
<p>The test suite is termed <em>Crazy Ivan</em> because of an unusual maneuver popularized in <a href="http://www.imdb.com/title/tt0099810/quotes?qt=qt0458296">The Hunt for Red October</a>
203+
and <a href="http://www.youtube.com/watch?v=Oi6BLxusAM8">Firefly</a>. It is a term used to detect problems that are hiding, which is what the test suite.</p>
204+
205+
<blockquote>
206+
<p>Seaman Jones: Conn, sonar! Crazy Ivan!
207+
Capt. Bart Mancuso: All stop! Quick quiet! [the ships engines are shut down completely]
208+
Beaumont: What&#8217;s goin&#8217; on?
209+
Seaman Jones: Russian captains sometime turn suddenly to see if anyone&#8217;s behind them. We call it &#8220;Crazy Ivan.&#8221; The only thing you can do is go dead. Shut everything down and make like a hole in the water.
210+
Beaumont: So what&#8217;s the catch?
211+
Seaman Jones: The catch is, a boat this big doesn&#8217;t exactly stop on a dime&#8230; and if we&#8217;re too close, we&#8217;ll drift right into the back of him. </p>
212+
</blockquote>
213+
214+
<h1 id="contributing">Contributing</h1>
215+
216+
<p>If you would like to contribute a to the website, include an additional
217+
test suite processor endpoint, contribute a new test or to a fix to an existing test,
218+
please follow these steps:</p>
219+
220+
<ol>
221+
<li>Notify the RDFa mailing list, public-rdf-wg@w3.org,
222+
that you will be creating a new test or fix and the purpose of the
223+
change.</li>
224+
<li>Clone the git repository: <a href="https://github.com/rdfa/rdfa-website">git://github.com/rdfa/rdfa-website.git</a>.</li>
225+
<li>Make your changes and submit them via github, or via a &#8216;git format-patch&#8217;
226+
to the RDFa mailing list.</li>
227+
</ol>
228+
229+
<p>Optionally, you can ask for direct access to the repository and may make
230+
changes directly to the RDFa Website source code. All updates to the test
231+
suite go live within seconds of pushing changes to github via a WebHook call.</p>
232+
233+
<h2 id="caution_cached_assets">Caution: Cached assets</h2>
234+
235+
<p>The JavaScript and CSS files are minimized into cached assets. Any change to CSS or JavaScript files
236+
requires that the assets be re-compiled. This can be done as follows:</p>
237+
238+
<pre><code>rake assets:precompile
239+
</code></pre>
240+
241+
<p>Make sure to do this before committing changes that involve any CSS or JavaScript contained within <code>file:public/stylesheets</code> or <code>public/javascripts</code>.</p>
242+
</div>
243+
</div>

0 commit comments

Comments
 (0)