RDF Test Cases

W3C Working Draft 12 November 2002

This Version:
Latest Version:
Previous Version:
Jan Grant, (ILRT, University of Bristol)
Dave Beckett, (ILRT, University of Bristol)
Series editor:
Brian McBride (Hewlett Packard Labs)


This document describes the RDF Test Cases deliverable for the RDF Core Working Group as defined in the WG's Charter.

Status of this Document

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 Working Draft of the RDF Core Working Group, for review by W3C members and other interested parties. This document has been produced as part of the Semantic Web Activity (Activity Statement), and may eventually be advanced toward W3C Recommendation status.

This version primarily updates the N-Triples language to match working group needs and changes the test cases namespace (the URI of the test: namespace prefix). It does not include updated test cases after comments on earlier drafts. The test case repository will be updated in the light of feedback from this draft, incorporating earlier comments and issues. Detailed changes are recorded in Appendix A: ChangeLog.

Note: Due to time constraints, this version of the document has been published without Jan Grant reviewing it in its final form.

Being a Working Draft document, this specification may be updated, replaced, or obsoleted by other documents at any time. The test cases described and referred to in this document may also be updated, replaced or obsoleted at an any time. It is therefore inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". A list of current W3C working drafts can be found at http://www.w3.org/TR/.

This draft document will be considered by the W3C and its members according to W3C process. This document is made public for the purpose of receiving comments that inform the W3C membership and staff on issues likely to affect the implementation, acceptance, and adoption of RDF.

There are no known patent or IPR constraints associated with this Working Draft. The RDF Core Working Group Patent Disclosure page contains details, in conformance with W3C policy requirements.

Comments should be sent to www-rdf-comments@w3.org. This is the preferred method of providing feedback. Implementors are particularly encouraged to supply the results of running their toolsets against the test cases. Public comments and their responses can be accessed at http://lists.w3.org/Archives/Public/www-rdf-comments/. Alternatively, if you do not wish your comments to be made public, you can send your comments to w3t-semweb-review@w3.org.

Table of Contents

1. Introduction

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 will (when the test cases are completed) 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:

1.1. Scope

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.

1.2. RDF Errata

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.

2. Test Cases

NOTE: The test cases have not been updated in this version of the working draft, except to change the test: namespace URI.

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_20021112.zip (latest version) as well as Zip files of all Approved and Not Approved test cases in all_20021112.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.

2.1. Organization

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:

Positive Parser Tests
these tests consist of one (or more) input documents in RDF/XML as is revised in [RDF-SYNTAX]. The expected result is defined using the N-Triples syntax (Section 3). A parser is considered to pass the test if it produces a graph isomorphic with the graph described by the N-triples output document. Where the input document(s) are legal RDF/XML, but a warning may be generated, this is indicated in the test manifest.
<test:PositiveParserTest rdf:about="http://w3.example.org/test001">

   <test:issue rdf:resource="http://w3.example.org/rdf-tracking/#example1" />
   <test:approval rdf:resource="http://rdfcore.example.org/archives/001.html" />
	This is a simple positive parser test example.

      <test:RDF-XML-Document rdf:about="http://w3.example.org/test001.rdf" />

      <test:NT-Document rdf:about="http://w3.example.org/test001.nt" />

   <test:warning>Some parsers may produce a warning when running this test</test:warning>

Negative Parser Tests
These tests consist of one input document. The document is not legal RDF/XML. A parser is considered to pass the test if it correctly holds the input document to be in error.
<test:NegativeParserTest rdf:about="http://w3.example.org/error001">

   <test:issue rdf:resource="http://w3.example.org/rdf-tracking/#example1" />

      <test:RDF-XML-Document rdf:about="http://w3.example.org/error001.rdf" />

Positive Entailment Tests
These tests are specified by one or more premise documents (in RDF/XML or N-Triples) together with a single conclusion document. In addition, the rules used for determining entailment are specified by test:entailmentRules elements. If the following is present
 <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]. A premise document that contains a semantic error with respect to any constraints imposed by the entailment rules selected will cause this test to fail.
<test:PositiveEntailmentTest rdf:about="http://w3.example.org/rdfs-domain-and-range/conjunction-test">

	This test demonstrates the conjunctive nature of range and domain.

   <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:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test001.nt" />

      <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test002.nt" />

      <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test003.nt" />

      <test:NT-Document rdf:about="http://w3.example.org/rdfs-domain-and-range/test004.nt" />

Negative Entailment Tests
These tests are specified in exactly the same fashion as the Positive Entailment Tests. The test is considered to be passed if the entailment indicated is NOT drawn using the rules of RDF-Entailment or RDFS-entailment, as above. Should a premise document contain a semantic error with respect to any constraints imposed by the entailment rules selected, the entailment is treated as not holding; that is, the test will succeed.
<test:NegativeEntailmentTest rdf:about="http://w3.example.org/statement-entailment/test001">

   <test:approval rdf:resource="http://rdfcore.example.org/Archives/Public/w3c-rdfcore-wg/2002Feb/0476.html" />
     RDF Core WG RESOLVED that a reified statement was a stating, not a statement.
     The following entailment does not, therefore, hold.

   <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:NT-Document rdf:about="http://w3.example.org/statement-entailment/test001a.nt" />

      <test:NT-Document rdf:about="http://w3.example.org/statement-entailment/test001b.nt" />

Miscellaneous Tests
This manifest entry is used to describe test cases that do not fall into one of the earlier categories. It may have several associated files, indicated in <test:document> elements.
<test:MiscellaneousTest rdf:about="http://w3.example.org/misc001">

     A serializer asked to output the graph described in the test001
     document should raise an exception since it cannot be described using

      <test:NT-Document rdf:about="http://w3.example.org/nonserializable/test001.nt" />


In addition, each test case description may have the following common attributes:

2.2. Approved Test Cases

The test cases in the following table have been approved.

There are 14 issues containing 160 approved test cases, and 7 test cases without an associated issue. Relative URLs, where given, should be resolved against the base URI http://www.w3.org/2000/10/rdf-tests/rdfcore/
Test cases without an issue: 7 tests
Positive parser tests (test cases: 3)
Input files Output file Warning? Approved
amp-in-url/test001.rdf amp-in-url/test001.nt   RDFCore WG Telecon 2001-09-21
unrecognised-xml-attributes/test001.rdf unrecognised-xml-attributes/test001.nt   RDFCore WG Telecon 2002-01-18
unrecognised-xml-attributes/test002.rdf unrecognised-xml-attributes/test002.nt   RDFCore WG Telecon 2002-01-18
Negative RDF-Entailment tests (test cases: 2)
Premise files Conclusion file Warning? Approved
statement-entailment/test001a.nt statement-entailment/test001b.nt   RDFCore WG Telecon 2002-02-15
statement-entailment/test002a.nt statement-entailment/test002b.nt   RDFCore WG Telecon 2002-02-15
Negative RDFS-Entailment tests (test cases: 2)
Premise files Conclusion file Warning? Approved
statement-entailment/test001a.nt statement-entailment/test001b.nt   RDFCore WG Telecon 2002-02-15
statement-entailment/test002a.nt statement-entailment/test002b.nt   RDFCore WG Telecon 2002-02-15
Issue: rdf-charmod-literals has 3 tests
Positive parser tests (test cases: 1)
Input files Output file Warning? Approved
rdf-charmod-literals/test001.rdf rdf-charmod-literals/test001.nt   RDFCore WG Telecon 2002-04-05
Negative parser tests (test cases: 2)
Input file Approved
rdf-charmod-literals/error001.rdf RDFCore WG Telecon 2002-04-05
rdf-charmod-literals/error002.rdf RDFCore WG Telecon 2002-04-05
Issue: rdf-containers-syntax-vs-schema has 9 tests
Positive parser tests (test cases: 7)
Input files Output file Warning? Approved
rdf-containers-syntax-vs-schema/test001.rdf rdf-containers-syntax-vs-schema/test001.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test002.rdf rdf-containers-syntax-vs-schema/test002.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test003.rdf rdf-containers-syntax-vs-schema/test003.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test004.rdf rdf-containers-syntax-vs-schema/test004.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test006.rdf rdf-containers-syntax-vs-schema/test006.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test007.rdf rdf-containers-syntax-vs-schema/test007.nt   RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/test008.rdf rdf-containers-syntax-vs-schema/test008.nt   RDFCore WG Telecon 2001-06-29
Negative parser tests (test cases: 2)
Input file Approved
rdf-containers-syntax-vs-schema/error001.rdf RDFCore WG Telecon 2001-06-29
rdf-containers-syntax-vs-schema/error002.rdf RDFCore WG Telecon 2001-11-30
Issue: rdf-ns-prefix-confusion has 22 tests
Positive parser tests (test cases: 13)
Input files Output file Warning? Approved
rdf-ns-prefix-confusion/test0001.rdf rdf-ns-prefix-confusion/test0001.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0002.rdf rdf-ns-prefix-confusion/test0002.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0003.rdf rdf-ns-prefix-confusion/test0003.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0004.rdf rdf-ns-prefix-confusion/test0004.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0005.rdf rdf-ns-prefix-confusion/test0005.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0006.rdf rdf-ns-prefix-confusion/test0006.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0007.rdf rdf-ns-prefix-confusion/test0007.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0009.rdf rdf-ns-prefix-confusion/test0009.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0010.rdf rdf-ns-prefix-confusion/test0010.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0011.rdf rdf-ns-prefix-confusion/test0011.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0012.rdf rdf-ns-prefix-confusion/test0012.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0013.rdf rdf-ns-prefix-confusion/test0013.nt   RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/test0014.rdf rdf-ns-prefix-confusion/test0014.nt   RDFCore WG Telecon 2001-05-25
Negative parser tests (test cases: 9)
Input file Approved
rdf-ns-prefix-confusion/error0001.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0002.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0003.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0004.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0005.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0006.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0007.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0008.rdf RDFCore WG Telecon 2001-05-25
rdf-ns-prefix-confusion/error0009.rdf RDFCore WG Telecon 2001-05-25
Issue: rdfms-difference-between-ID-and-about has 2 tests
Positive parser tests (test cases: 1)
Input files Output file Warning? Approved
rdfms-difference-between-ID-and-about/test1.rdf rdfms-difference-between-ID-and-about/test1.nt   RDFCore WG Telecon 2001-12-14
Negative parser tests (test cases: 1)
Input file Approved
rdfms-difference-between-ID-and-about/error1.rdf RDFCore WG Telecon 2001-12-14
Issue: rdfms-empty-property-elements has 18 tests
Positive parser tests (test cases: 15)
Input files Output file Warning? Approved
rdfms-empty-property-elements/test001.rdf rdfms-empty-property-elements/test001.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test002.rdf rdfms-empty-property-elements/test002.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test003.rdf rdfms-empty-property-elements/test003.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test004.rdf rdfms-empty-property-elements/test004.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test005.rdf rdfms-empty-property-elements/test005.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test006.rdf rdfms-empty-property-elements/test006.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test007.rdf rdfms-empty-property-elements/test007.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test008.rdf rdfms-empty-property-elements/test008.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test009.rdf rdfms-empty-property-elements/test009.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test010.rdf rdfms-empty-property-elements/test010.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test011.rdf rdfms-empty-property-elements/test011.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test012.rdf rdfms-empty-property-elements/test012.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test013.rdf rdfms-empty-property-elements/test013.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test014.rdf rdfms-empty-property-elements/test014.nt   RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/test015.rdf rdfms-empty-property-elements/test015.nt   RDFCore WG Telecon 2001-05-25
Negative parser tests (test cases: 3)
Input file Approved
rdfms-empty-property-elements/error001.rdf RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/error002.rdf RDFCore WG Telecon 2001-05-25
rdfms-empty-property-elements/error003.rdf RDFCore WG Telecon 2001-05-25
Issue: rdfms-identity-anon-resources has 5 tests
Positive parser tests (test cases: 5)
Input files Output file Warning? Approved
rdfms-identity-anon-resources/test001.rdf rdfms-identity-anon-resources/test001.nt   RDFCore WG Telecon 2001-10-19
rdfms-identity-anon-resources/test002.rdf rdfms-identity-anon-resources/test002.nt   RDFCore WG Telecon 2001-10-19
rdfms-identity-anon-resources/test003.rdf rdfms-identity-anon-resources/test003.nt   RDFCore WG Telecon 2001-10-19
rdfms-identity-anon-resources/test004.rdf rdfms-identity-anon-resources/test004.nt   RDFCore WG Telecon 2001-10-19
rdfms-identity-anon-resources/test005.rdf rdfms-identity-anon-resources/test005.nt   RDFCore WG Telecon 2001-10-19
Issue: rdfms-nested-bagIDs has 15 tests
Positive parser tests (test cases: 15)
Input files Output file Warning? Approved
rdfms-nested-bagIDs/test001.rdf rdfms-nested-bagIDs/test001.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test002.rdf rdfms-nested-bagIDs/test002.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test003.rdf rdfms-nested-bagIDs/test003.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test004.rdf rdfms-nested-bagIDs/test004.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test005.rdf rdfms-nested-bagIDs/test005.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test006.rdf rdfms-nested-bagIDs/test006.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test007.rdf rdfms-nested-bagIDs/test007.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test008.rdf rdfms-nested-bagIDs/test008.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test009.rdf rdfms-nested-bagIDs/test009.nt   RDFCore WG Telecon 2002-03-15
Note: of the following six tests, only three can be expected to pass. See the test descriptions in the manifest for details.
rdfms-nested-bagIDs/test010.rdf rdfms-nested-bagIDs/test010a.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test010.rdf rdfms-nested-bagIDs/test010b.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test011.rdf rdfms-nested-bagIDs/test011a.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test011.rdf rdfms-nested-bagIDs/test011b.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test012.rdf rdfms-nested-bagIDs/test012a.nt   RDFCore WG Telecon 2002-03-15
rdfms-nested-bagIDs/test012.rdf rdfms-nested-bagIDs/test012b.nt   RDFCore WG Telecon 2002-03-15
Issue: rdfms-not-id-and-resource-attr has 5 tests
Positive parser tests (test cases: 5)
Input files Output file Warning? Approved
rdfms-not-id-and-resource-attr/test001.rdf rdfms-not-id-and-resource-attr/test001.nt   RDFCore WG Telecon 2002-03-15
rdfms-not-id-and-resource-attr/test002.rdf rdfms-not-id-and-resource-attr/test002.nt   RDFCore WG Telecon 2002-03-15
rdfms-not-id-and-resource-attr/test003.rdf rdfms-not-id-and-resource-attr/test003.nt   RDFCore WG Telecon 2002-03-15
rdfms-not-id-and-resource-attr/test004.rdf rdfms-not-id-and-resource-attr/test004.nt   RDFCore WG Telecon 2002-03-15
rdfms-not-id-and-resource-attr/test005.rdf rdfms-not-id-and-resource-attr/test005.nt   RDFCore WG Telecon 2002-03-15
Issue: rdfms-para196 has 1 tests
Positive parser tests (test cases: 1)
Input files Output file Warning? Approved
rdfms-para196/test001.rdf rdfms-para196/test001.nt   RDFCore WG Telecon 2002-01-11
Issue: rdfms-rdf-names-use has 60 tests
Positive parser tests (test cases: 40)
Input files Output file Warning? Approved
rdfms-rdf-names-use/test-001.rdf rdfms-rdf-names-use/test-001.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-002.rdf rdfms-rdf-names-use/test-002.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-003.rdf rdfms-rdf-names-use/test-003.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-004.rdf rdfms-rdf-names-use/test-004.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-005.rdf rdfms-rdf-names-use/test-005.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-006.rdf rdfms-rdf-names-use/test-006.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-007.rdf rdfms-rdf-names-use/test-007.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-008.rdf rdfms-rdf-names-use/test-008.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-009.rdf rdfms-rdf-names-use/test-009.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-010.rdf rdfms-rdf-names-use/test-010.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-011.rdf rdfms-rdf-names-use/test-011.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-012.rdf rdfms-rdf-names-use/test-012.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-013.rdf rdfms-rdf-names-use/test-013.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-014.rdf rdfms-rdf-names-use/test-014.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-015.rdf rdfms-rdf-names-use/test-015.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-016.rdf rdfms-rdf-names-use/test-016.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-017.rdf rdfms-rdf-names-use/test-017.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-018.rdf rdfms-rdf-names-use/test-018.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-019.rdf rdfms-rdf-names-use/test-019.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-020.rdf rdfms-rdf-names-use/test-020.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-021.rdf rdfms-rdf-names-use/test-021.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-022.rdf rdfms-rdf-names-use/test-022.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-023.rdf rdfms-rdf-names-use/test-023.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-024.rdf rdfms-rdf-names-use/test-024.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-025.rdf rdfms-rdf-names-use/test-025.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-026.rdf rdfms-rdf-names-use/test-026.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-027.rdf rdfms-rdf-names-use/test-027.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-028.rdf rdfms-rdf-names-use/test-028.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-029.rdf rdfms-rdf-names-use/test-029.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-030.rdf rdfms-rdf-names-use/test-030.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-031.rdf rdfms-rdf-names-use/test-031.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-032.rdf rdfms-rdf-names-use/test-032.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-033.rdf rdfms-rdf-names-use/test-033.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-034.rdf rdfms-rdf-names-use/test-034.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-035.rdf rdfms-rdf-names-use/test-035.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-036.rdf rdfms-rdf-names-use/test-036.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/test-037.rdf rdfms-rdf-names-use/test-037.nt   RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/warn-001.rdf rdfms-rdf-names-use/warn-001.nt allowed with warnings RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/warn-002.rdf rdfms-rdf-names-use/warn-002.nt allowed with warnings RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/warn-003.rdf rdfms-rdf-names-use/warn-003.nt allowed with warnings RDFCore WG Telecon 2001-11-30
Negative parser tests (test cases: 20)
Input file Approved
rdfms-rdf-names-use/error-001.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-002.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-003.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-004.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-005.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-006.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-007.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-008.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-009.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-010.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-011.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-012.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-013.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-014.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-015.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-016.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-017.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-018.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-019.rdf RDFCore WG Telecon 2001-11-30
rdfms-rdf-names-use/error-020.rdf RDFCore WG Telecon 2001-11-30
Issue: rdfms-xml-base has 16 tests
Positive parser tests (test cases: 16)
Input files Output file Warning? Approved
xmlbase/test001.rdf xmlbase/test001.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test002.rdf xmlbase/test002.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test003.rdf xmlbase/test003.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test004.rdf xmlbase/test004.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test005.rdf xmlbase/test005.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test006.rdf xmlbase/test006.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test007.rdf xmlbase/test007.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test008.rdf xmlbase/test008.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test009.rdf xmlbase/test009.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test010.rdf xmlbase/test010.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test011.rdf xmlbase/test011.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test012.rdf xmlbase/test012.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test013.rdf xmlbase/test013.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test014.rdf xmlbase/test014.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test015.rdf xmlbase/test015.nt   RDFCore WG Telecon 2002-03-15
xmlbase/test016.rdf xmlbase/test016.nt   RDFCore WG Telecon 2002-03-15
Issue: rdfs-domain-and-range has 2 tests
Positive parser tests (test cases: 2)
Input files Output file Warning? Approved
rdfs-domain-and-range/test001.rdf rdfs-domain-and-range/test001.nt   RDFCore WG Telecon 2001-10-19
rdfs-domain-and-range/test002.rdf rdfs-domain-and-range/test002.nt   RDFCore WG Telecon 2001-10-19
Issue: rdfs-no-cycles-in-subClassOf has 1 tests
Positive RDFS-Entailment tests (test cases: 1)
Premise files Conclusion file Warning? Approved
rdfs-no-cycles-in-subClassOf/test001.rdf rdfs-no-cycles-in-subClassOf/test001.nt   RDFCore WG Telecon 2001-10-12
Issue: rdfs-no-cycles-in-subPropertyOf has 1 tests
Positive RDFS-Entailment tests (test cases: 1)
Premise files Conclusion file Warning? Approved
rdfs-no-cycles-in-subPropertyOf/test001.rdf rdfs-no-cycles-in-subPropertyOf/test001.nt   RDFCore WG Telecon 2001-10-12

2.3. Test Cases Not 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.

2.4. Running the test cases

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.

3. N-Triples

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].

3.1. Extended Backus-Naur Form (EBNF) Grammar

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 */

3.2 Strings

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:

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
\UHHHHHHHH 8 required hexadecimal digits HHHHHHHH encoding character

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.

3.3 URI References

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.

3.4. Example

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#"
  <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:title>World Wide Web Consortium</dc:title>
        <dc:source rdf:resource="http://www.w3.org/"/>

3.5. N-Triples Tests

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.

4 References

Normative References

Resource Description Framework (RDF) Model and Syntax Specification, O. Lassila and R. Swick, Editors, World Wide Web Consortium Recommendation. 22 February 1999. This version is http://www.w3.org/TR/1999/REC-rdf-syntax-19990222. The latest version of RDF M&S is available at http://www.w3.org/TR/REC-rdf-syntax.
Resource Description Framework (RDF) Schema Specification 1.0, Dan Brickley, R.V. Guha, Editors, World Wide Web Consortium Candidate Recommendation, 27 March 2000. This version is http://www.w3.org/TR/2000/CR-rdf-schema-20000327/. The latest version of RDF Schema is http://www.w3.org/TR/rdf-schema/.
The Unicode Standard, Version 3.0, Addison Wesley, Reading MA, 2000, ISBN: 0-201-61633-5. This document is http://www.unicode.org/unicode/standard/standard.html.
Character Model for the World Wide Web 1.0, M. Dürst, F. Yergeau, R. Ishida, M. Wolf, A. Freytag, T Texin, Editors, World Wide Web Consortium Working Draft, work in progress, 30 April 2002. This version of the Character Model is http://www.w3.org/TR/2002/WD-charmod-20020430/. The latest version of the Character Model is at http://www.w3.org/TR/charmod/.
RDF Model Theory, P. Hayes, Editor. World Wide Web Consortium, Working Draft, 29 April 2002. Work in progress. This version of the RDF Model Theory is http://www.w3.org/TR/2002/WD-rdf-mt-20020429/. The latest version of the RDF Model Theory is at http://www.w3.org/TR/rdf-mt/.
RDF/XML Syntax Specification (Revised), Dave Beckett, Editor, World Wide Web Consortium, Working Draft, 8 November 2002. Work in progress. This version of the RDF/XML Syntax is http://www.w3.org/TR/2002/WD-rdf-syntax-grammar-20021108/. The latest version of the RDF/XML Syntax is at http://www.w3.org/TR/rdf-syntax-grammar/.
[RFC 2396]
RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax, T. Berners-Lee, R. Fielding and L. Masinter, IETF, August 1998. This document is http://www.isi.edu/in-notes/rfc2396.txt.
[RFC 3066]
RFC 3066 - Tags for the Identification of Languages, H. Alvestrand, IETF, January 2001. This document is http://www.ietf.org/rfc/rfc3066.txt

Informative References

RDF Primer, F. Manola, E. Miller, Editors, World Wide Web Consortium W3C Working Draft, work in progress, 26 April 2002. This version of the RDF Primer is http://www.w3.org/TR/2002/WD-rdf-primer-20020426/. The latest version of the RDF Primer is at http://www.w3.org/TR/rdf-primer/.
RDF Vocabulary Description Language 1.0: RDF Schema, D. Brickley, R.V. Guha, Editors, World Wide Web Consortium W3C Working Draft, work in progress, 30 April 2002. This version of the RDF Vocabulary Description Language is http://www.w3.org/TR/2002/WD-rdf-schema-20020430/. The latest version of the RDF Vocabulary Description Language is at http://www.w3.org/TR/rdf-schema/.
RDF Concepts and Abstract Syntax, G. Klyne, J. Carroll, Editors, World Wide Web Consortium W3C Working Draft, work in progress, 8 November 2002. This version of the RDF Concepts and Abstract Syntax is http://www.w3.org/TR/2002/WD-rdf-concepts-20021108/. The latest version of the RDF Concepts and Abstract Syntax is at http://www.w3.org/TR/rdf-concepts/.
Notation 3, Tim Berners-Lee
Primer: Getting into RDF & Semantic Web using N3, Tim Berners-Lee
NTC: A simple N-Triples isomorphism test utility, Jan Grant

5 Acknowledgments (Informative)

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 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).

Appendix A: Change Log (Informative)

Changes since http://www.w3.org/TR/2002/WD-rdf-testcases-20020429/

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>

Changes since http://www.w3.org/TR/2001/WD-rdf-testcases-20011115/

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

Changes since http://www.w3.org/TR/2001/WD-rdf-testcases-20010912/

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.

Appendix B: Open Issues (Informative)