Copyright © 2003 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
This document describes the RDF Test Cases deliverable for the RDF Core Working Group as defined in the WG's Charter.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. The latest status of this document series is maintained at the W3C.
This is a W3C Last Call Working Draft of the RDF Core Working Group and has been produced as part of the W3C Semantic Web Activity (Activity Statement).
This document is in the Last Call review period, which ends on 21 February 2003. This document has been endorsed by the RDF Core Working Group.
This version includes the N-Triples language definition. The working group has approved the remaining test cases. The test case repository will be updated in the light of feedback from this draft. Detailed changes are recorded in Appendix A: ChangeLog.
This document is being released for review by W3C Members and other interested parties to encourage feedback and comments, especially with regard to how the changes made affect existing implementations and content.
In conformance with W3C policy requirements, known patent and IPR constraints associated with this Working Draft are detailed on the RDF Core Working Group Patent Disclosure page.
Comments on this document are invited and should be sent to the public mailing list [email protected]. An archive of comments is available at http://lists.w3.org/Archives/Public/www-rdf-comments/.
This is a public W3C Last Call Working Draft for review by W3C Members and other interested parties. This section describes the status of this document at the time of its publication. It is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite as other than "work in progress". A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR/.
One of the deliverables specified in Charter of the RDF Core Working Group is: a set of machine-processable test cases corresponding to technical issues addressed by the WG. This document describes the test cases that fulfill that deliverable but it does not contain the test cases themselves. The test cases are available at http://www.w3.org/2000/10/rdf-tests/rdfcore/.
The RDF Interest Group and other members of the RDF community have identified issues/ambiguities in the [RDFMS] Specification and the [RDF-SCHEMA] Candidate Recommendation. These issues have been collected and categorized in the RDF Core WG Issue Tracking document. The RDF Core Working Group uses this issue list to guide its work. The issues list is a working document; it is updated as new issues are identified. It is updated as the Working Group makes decisions as documented in the Attention Developers section of the document.
The complete specification of RDF consists of a number of documents:
A comprehensive and complete test suite for RDF should cover all of the rules in the Formal Grammar for RDF. The Working Group, however, is not chartered to deliver such a test suite but rather to create test cases for the issues the Working Group addresses (when applicable). Although the Working Group will not create test cases for some grammar rules (e.g. rule [6.1]), if such test cases are donated to the W3C the Consortium may add such test cases to this set of test cases.
The RDF Errata documents known errors in [RDFMS]. Since errata are considered normative changes to a W3C Specification and Working Group decisions are not normative until a specification is a W3C Recommendation, none of the decisions made by the RDF Core Working Group have (to date) been reflected in the errata.
The Test Case Repository is located at http://www.w3.org/2000/10/rdf-tests/rdfcore/. Each directory in the repository is devoted to a single issue. Most directories have a name that is identical to the related issue in the RDF Issue Tracking document. For example, the directory rdf-ns-prefix-confusion is identical to the rdf-ns-prefix-confusion issue. In the other cases, the directory does not have an associated issue in the issue list (e.g. amp-in-url). If a directory is empty, then no test cases have been created for the issue.
The Test Case Repository contains ZIP files of all Approved test cases in approved_20030117.zip ( latest version) as well as Zip files of all Approved and Not Approved test cases in all_20030117.zip (latest version).
The file http://www.w3.org/2000/10/rdf-tests/rdfcore/Manifest.rdf contains a machine-readable manifest of the test cases. The Manifest.rdf format is described below.
The file http://www.w3.org/2000/10/rdf-tests/rdfcore/Manifest.rdf contains a machine-readable description of the test cases in RDF/XML. Care has been taken to ensure that the Manifest.rdf file follows a simple format to assist in machine-processing the test cases.
The file consists of a simple header (see http://www.w3.org/2000/10/rdf-tests/rdfcore/skeleton/manifestHead.rdf), individual descriptions of the test cases, and a closing footer ( http://www.w3.org/2000/10/rdf-tests/rdfcore/skeleton/manifestTail.rdf).
The test cases are divided into the following categories:
<test:PositiveParserTest rdf:about="http://w3.example.org/test001"> <test:issue rdf:resource="http://w3.example.org/rdf-tracking/#example1" /> <test:status>APPROVED</test:status> <test:approval rdf:resource="http://rdfcore.example.org/archives/001.html" /> <test:description> This is a simple positive parser test example. </test:description> <test:inputDocument> <test:RDF-XML-Document rdf:about="http://w3.example.org/test001.rdf" /> </test:inputDocument> <test:outputDocument> <test:NT-Document rdf:about="http://w3.example.org/test001.nt" /> </test:outputDocument> <test:warning>Some parsers may produce a warning when running this test</test:warning> </test:PositiveParserTest>
<test:NegativeParserTest rdf:about="http://w3.example.org/error001"> <test:issue rdf:resource="http://w3.example.org/rdf-tracking/#example1" /> <test:status>APPROVED</test:status> <test:inputDocument> <test:RDF-XML-Document rdf:about="http://w3.example.org/error001.rdf" /> </test:inputDocument> </test:NegativeParserTest>
<test:entailmentRules rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#" />then the test succeeds if the entailment holds according to the rules of RDF-entailment as specified in [RDF-SEMANTICS]. If the following two elements are present
<test:entailmentRules rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#" /> <test:entailmentRules rdf:resource="http://www.w3.org/2000/01/rdf-schema#" />then the test succeeds if the entailment holds according to the rules of RDFS-entailment as specified in [RDF-SEMANTICS].
<test:PositiveEntailmentTest rdf:about="http://w3.example.org/rdfs-domain-and-range/conjunction-test"> <test:description> This test demonstrates the conjunctive nature of range and domain. </test:description> <test:entailmentRules rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#" /> <test:entailmentRules rdf:resource="http://www.w3.org/2000/01/rdf-schema#" /> <test:premiseDocument> <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test001.nt" /> </test:premiseDocument> <test:premiseDocument> <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test002.nt" /> </test:premiseDocument> <test:premiseDocument> <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test003.nt" /> </test:premiseDocument> <test:conclusionDocument> <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test004.nt" /> </test:conclusionDocument> </test:PositiveEntailmentTest>
According to [RDF-SEMANTICS], a premise document that contains a semantic error with respect to any constraints imposed by the entailment rules selected will come out false (and hence entail anything).
Support for such situations is provided by the manifest format by declaring an premise or conclusion pseudo-document as follows:
<test:conclusionDocument> <test:False-Document/> </test:conclusionDocument>
By convention, such a pseudo-document is said to come out false under any interpretation.
<test:NegativeEntailmentTest rdf:about="http://w3.example.org/statement-entailment/test001"> <test:status>PENDING</test:status> <test:approval rdf:resource="http://rdfcore.example.org/Archives/Public/w3c-rdfcore-wg/2002Feb/0476.html" /> <test:description> RDF Core WG RESOLVED that a reified statement was a stating, not a statement. The following entailment does not, therefore, hold. </test:description> <test:entailmentRules rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#" /> <test:entailmentRules rdf:resource="http://www.w3.org/2000/01/rdf-schema#" /> <test:premiseDocument> <test:NT-Document rdf:about="http://w3.example.org/statement-entailment/test001a.nt" /> </test:premiseDocument> <test:conclusionDocument> <test:NT-Document rdf:about="http://w3.example.org/statement-entailment/test001b.nt" /> </test:conclusionDocument> </test:NegativeEntailmentTest>
<test:entailmentRules rdf:resource="http://www.w3.org/2000/10/rdf-tests/rdfcore/datatypes#" /> <test:datatypeSupport rdf:resource="http://www.w3.org/2001/XMLSchema#integer" /> <test:datatypeSupport rdf:resource="http://dt.example.org/datatype#foo" />For the purposes of the test suite, if a test case requires datatype support for a set of datatypes, { T, U, V, ... } then the following three pieces of machinery are required:
<test:MiscellaneousTest rdf:about="http://w3.example.org/misc001"> <test:status>PENDING</test:status> <test:description> A serializer asked to output the graph described in the test001 document should raise an exception since it cannot be described using RDF/XML. </test:description> <test:document> <test:NT-Document rdf:about="http://w3.example.org/nonserializable/test001.nt" /> </test:document> </test:MiscellaneousTest>
In addition, each test case description may have the following common attributes:
<test:issue rdf:resource="http://www.w3.org/2000/03/rdf-tracking/#rdfs-no-cycles-in-subClassOf" />
<test:status>APPROVED</test:status>
<test:approval rdf:resource="http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2002Feb/0476.html" />
<test:discussion rdf:resource="http://rdfcore.example.org/" />
<test:description> Text describing the test case goes here. </test:description>
<test:warning> Text describing the warning goes here. </test:warning>
The test cases in the following table have been approved.
The test case repository contains test cases that have not been approved. Such test cases are not enumerated in this document but a list of them is available at http://www.w3.org/2000/10/rdf-tests/rdfcore/allTestCases.html.
The test case manifest format was deliberately chosen to be a simple, declarative description of the test cases. Parser tests can be run in conjunction with simple tools such as ntc[NTC]. A parser should pass all the positive parser tests, and reject all the negative parser tests. Tools like Euler have been used to run the entailment tests.
Due to the rules of entailment tests, a positive or negative entailment test case with an empty conclusion document can be used to illustrate semantic constraints associated with sets of entailment rules.
The test cases have been created to illustrate the resolution of particular issues on the RDF Issue Tracking list. Consequently, test case results should always be interpreted in conjunction with the resolution of the associated issue and the description (if any) attached to the test case in the manifest.
N-Triples is a line-based, plain text format for encoding an RDF graph. It was designed to be a fixed subset of N3[N3] [N3-Primer] and hence N3 tools such as cwm, n-triples2kif.pl and Euler can be used to read and process it. cwm can output this format when invoked as "cwm -ntriples".
It is recommended, but not required, that N-Triples content is stored in files with an '.nt' suffix to distinguish them from N3.
The Internet Media Type / MIME Type of N-Triples is text/plain and the character encoding is 7-bit US-ASCII.
NOTE: N-Triples is an RDF syntax intended for RDF Core WG testing purposes and checking RDF applications for conformance with the specifications. The recommended RDF exchange syntax is RDF/XML as defined in [RDF-SYNTAX].
An N-Triples document is a sequence of US-ASCII characters and is defined by the ntripleDoc grammar term below. Parsing it results in a sequence of RDF statements formed from the subject, predicate and object terms. The meaning of these terms are defined in the [RDF-SEMANTICS] being developed as part of the RDF Core WG activity.
This EBNF is the notation used in XML 1.0 second edition
ntripleDoc | ::= | line* | |
line | ::= | ws* ( comment | triple )? eoln | |
comment | ::= | '#' ( character - ( cr | lf ) )* | |
triple | ::= | subject ws predicate ws object ws* '.' ws* | |
subject | ::= | uriref | nodeID | |
predicate | ::= | uriref | |
object | ::= | uriref | nodeID | literal | |
uriref | ::= | '<' absoluteURI '>' | |
nodeID | ::= | '_:' name | |
literal | ::= | langString | datatypeString | |
langString | ::= | '"' string '"' ( '@' language )? | |
datatypeString | ::= | langString '^^' uriref | |
language | ::= | [a-z0-9] ('-' [a-z0-9] )? matching the production Language-Tag in Section 2.1 of [RFC 3066]. Note: This EBNF cannot perform the counting required by the Primary-subtag and Subtag productions. |
|
ws | ::= | space | tab | |
eoln | ::= | cr | lf | cr lf | |
space | ::= | #x20 /* US-ASCII space - decimal 32 */ | |
cr | ::= | #xD /* US-ASCII carriage return - decimal 13 */ | |
lf | ::= | #xA /* US-ASCII line feed - decimal 10 */ | |
tab | ::= | #x9 /* US-ASCII horizontal tab - decimal 9 */ | |
string | ::= | character* with escapes as defined in section Strings | |
name | ::= | [A-Za-z][A-Za-z0-9]* | |
absoluteURI | ::= | character with escapes as defined in section URI References | |
character | ::= | [#x20-#x7E] /* US-ASCII space to decimal 126 */ |
N-Triples strings are sequences of US-ASCII character productions encoding [UNICODE] character strings. The characters outside the US-ASCII range are made available by \-escape sequences as follows:
Escape sequence |
Encodes Unicode character |
---|---|
\\ | Backslash character (decimal 92, #X5C) |
\" | Double quote (decimal 34, #x22) |
\n | Line feed (decimal 10, #xA) - lf character |
\r | Carriage return (decimal 13, #xD) - cr character |
\t | Horizontal tab (decimal 9, #x9) - tab character |
\uHHHH | 4 required hexadecimal digits HHHH encoding
character [#x0-#x8],[#xB-#xC],[#xE-#x1F],[#x7F-#xFFFF] |
\UHHHHHHHH | 8 required hexadecimal digits HHHHHHHH encoding
character [#x10000-#x10FFFF] |
where H is a hexadecimal digit: [#x30-#x39],[#x41-#x46] (0-9, uppercase A-F).
This escaping satisfies the [CHARMOD] section Reference Processing Model on making the full Unicode character range U 0 to U 10FFFF available to applications and providing only one way to escape any character.
URI references are sequences of US-ASCII character productions as defined in [RFC 2396] for a URI character sequence. Where the original URI Reference contains characters not allowed in such a sequence, the standard escaping procedure described in [RFC 2396] using UTF-8 as the character encoding is applied, using UTF-8 as the character encoding.
Disallowed characters are represented in UTF-8 and then encoded using the %HH format, where HH is the byte value expressed using hexadecimal notation.
Characters above the US-ASCII range are made available by the \u or \U escapes as described in section Strings for ranges [#x80-#xFFFF] and [#x10000-#x10FFFF] respectively.
Characters [#x0-#x1F] and #x7F are forbidden in URI references.
The following N-Triples file:
<http://www.w3.org/2001/08/rdf-test/> <http://purl.org/dc/elements/1.1/creator> "Dave Beckett" . <http://www.w3.org/2001/08/rdf-test/> <http://purl.org/dc/elements/1.1/creator> "Jan Grant" . <http://www.w3.org/2001/08/rdf-test/> <http://purl.org/dc/elements/1.1/publisher> _:a . _:a <http://purl.org/dc/elements/1.1/title> "World Wide Web Consortium" . _:a <http://purl.org/dc/elements/1.1/source> <http://www.w3.org/> .
represents the same RDF graph as the following RDF/XML:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rdf:Description rdf:about="http://www.w3.org/2001/08/rdf-test/"> <dc:creator>Jan Grant</dc:creator> <dc:creator>Dave Beckett</dc:creator> <dc:publisher> <rdf:Description> <dc:title>World Wide Web Consortium</dc:title> <dc:source rdf:resource="http://www.w3.org/"/> </rdf:Description> </dc:publisher> </rdf:Description> </rdf:RDF>
The N-Triple test file at http://www.w3.org/2000/10/rdf-tests/rdfcore/ntriples/test.nt contains multiple tests of legal N-Triples.
Many thanks to Art Barstow (ex-W3C), former main editor of this document, for his sterling work on editing and managing the RDF test cases, which he had been doing well before the RDF Core WG started.
The editors would also like to thank Jos DeRoo, of AGFA, for his excellent work in the implementation of an RDF reasoner capable of running the entailment test cases.
Thanks are also due to the RDF parser implementers who took the time to run, and submit corrections to, our parser tests.
The following Working Group members have directly contributed to this document and/or contributed test cases.
This document is a product of extended deliberations by the RDF Core working group, whose members have included: Art Barstow (W3C) Dave Beckett (ILRT), Dan Brickley (W3C/ILRT), Dan Connolly (W3C), Jeremy Carroll (Hewlett Packard), Ron Daniel (Interwoven Inc), Bill dehOra (InterX), Jos De Roo (AGFA), Jan Grant (ILRT), Graham Klyne (Clearswift and Nine by Nine), Frank Manola (MITRE Corporation), Brian McBride (Hewlett Packard), Eric Miller (W3C), Stephen Petschulat (IBM), Patrick Stickler (Nokia), Aaron Swartz (HWG), Mike Dean (BBN Technologies / Verizon), R. V. Guha (Alpiri Inc), Pat Hayes (IHMC), Sergey Melnik (Stanford University), Martyn Horner (Profium Ltd).
This specification also draws upon an earlier RDF Model and Syntax document edited by Ora Lassilla and Ralph Swick, and RDF Schema edited by Dan Brickley and R. V. Guha. RDF and RDF Schema Working group members who contributed to this earlier work are: Nick Arnett (Verity), Tim Berners-Lee (W3C), Tim Bray (Textuality), Dan Brickley (ILRT / University of Bristol), Walter Chang (Adobe), Sailesh Chutani (Oracle), Dan Connolly (W3C), Ron Daniel (DATAFUSION), Charles Frankston (Microsoft), Patrick Gannon (CommerceNet), RV Guha (Epinions, previously of Netscape Communications), Tom Hill (Apple Computer), Arthur van Hoff (Marimba), Renato Iannella (DSTC), Sandeep Jain (Oracle), Kevin Jones, (InterMind), Emiko Kezuka (Digital Vision Laboratories), Joe Lapp (webMethods Inc.), Ora Lassila (Nokia Research Center), Andrew Layman (Microsoft), Ralph LeVan (OCLC), John McCarthy (Lawrence Berkeley National Laboratory), Chris McConnell (Microsoft), Murray Maloney (Grif), Michael Mealling (Network Solutions), Norbert Mikula (DataChannel), Eric Miller (OCLC), Jim Miller (W3C, emeritus), Frank Olken (Lawrence Berkeley National Laboratory), Jean Paoli (Microsoft), Sri Raghavan (Digital/Compaq), Lisa Rein (webMethods Inc.), Paul Resnick (University of Michigan), Bill Roberts (KnowledgeCite), Tsuyoshi Sakata (Digital Vision Laboratories), Bob Schloss (IBM), Leon Shklar (Pencom Web Works), David Singer (IBM), Wei (William) Song (SISU), Neel Sundaresan (IBM), Ralph Swick (W3C), Naohiko Uramoto (IBM), Charles Wicksteed (Reuters Ltd.), Misha Wolf (Reuters Ltd.), Lauren Wood (SoftQuad).
Entailment test definitions changed to actually test proper entailments, not pseudo-entailments.
Support for datatype-aware entailment tests in the manifest.
Pointer to RDF-CONCEPTS for the definition of graph isomorphism / equality.
Addition of the always false pseudo-document for entailment tests.
Updated the test case list in this document.
Test case names changed to fragment references into individual manifest documents.
Production language. Changed to match RFC 3066. Added [RFC 2396] to normative references.
3 N-Triples NOTE reworded. Point to RDF/XML as exchange syntax.
Production character: should be "to 126"
3.2 Strings Removed suggestion to use UTF-8 for apps.
Added 3.5. N-Triples Tests pointing at the http://www.w3.org/2000/10/rdf-tests/rdfcore/ntriples/test.nt test file.
Use uppercase hexadecimal digits. Define H and use it for \uHHHH, \uHHHHHHHH.
Removed xmlString.
Changed the N-Triples language separator token to @ in langString
Added RDF datatyping support using datatypeString using the form ^^<datatypeURI>
Updated 3.3 URI References to allow Unicode characters in URIs
Merged Future Work into Open Issues
Test case list expanded and reorganized to reflect additional approved test cases
New section 2 describing organization of parser tests, the types of tests and examples of manifest format that describes them.
Updated editors, added thanks to Art Barstow.
Changed literal to be langString | xmlString (now gone)
N-Triples remains an ASCII format for now - closed issue on UTF-8 encoding.
Update references to RDF Model Theory, Syntax WDs
Changed the Approved Test Cases table so that it includes links to related files and the Working Group decision.
Removed the Test Cases Not Approved table and added a link to the repository's list of the not approved test cases.
Added links to ZIP files of the repository's test cases.
Specify the Future Work and Contributors sections as Informative.
Renamed token bNode to nodeID.
Added RDF Model Theory reference.
Added URI Encoding section, pointing at Charmod rules and updated absoluteURI grammar rule to use it.
Removed references to Python literals, reason for \-escaping.
Added 4, 8 required digits for \u, \U string escapes.
Renamed section URIs to URI References.