# N-Triples tests

Copyright © 2004-2023 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.

## Abstract

This page describes W3C RDF 1.1 Working Group's test suite.

### Contributing Tests

The test manifests and entries are built automatically from manifest.ttl using a Rake task. Tests may be contributed via pull request to https://github.com/w3c/rdf-tests with suitable changes to the manifest.ttl and referenced files.

### Distribution

Distributed under both the W3C Test Suite License and the W3C 3-clause BSD License. To contribute to a W3C Test Suite, see the policies and contribution forms.

### Disclaimer

UNDER BOTH MUTUALLY EXCLUSIVE LICENSES, THIS DOCUMENT AND ALL DOCUMENTS, TESTS AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

## Test Descriptions

nt-syntax-file-01: nt-syntax-file-01

  Empty file

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-file-01.nt
nt-syntax-file-02: nt-syntax-file-02

  Only comment

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-file-02.nt
nt-syntax-file-03: nt-syntax-file-03

  One comment, one empty line

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-file-03.nt
nt-syntax-uri-01: nt-syntax-uri-01

  Only IRIs

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-uri-01.nt
nt-syntax-uri-02: nt-syntax-uri-02

  IRIs with Unicode escape

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-uri-02.nt
nt-syntax-uri-03: nt-syntax-uri-03

  IRIs with long Unicode escape

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-uri-03.nt
nt-syntax-uri-04: nt-syntax-uri-04

  Legal IRIs

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-uri-04.nt
nt-syntax-string-01: nt-syntax-string-01

  string literal

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-string-01.nt
nt-syntax-string-02: nt-syntax-string-02

  langString literal

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-string-02.nt
nt-syntax-string-03: nt-syntax-string-03

  langString literal with region

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-string-03.nt
nt-syntax-str-esc-01: nt-syntax-str-esc-01

  string literal with escaped newline

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-str-esc-01.nt
nt-syntax-str-esc-02: nt-syntax-str-esc-02

  string literal with Unicode escape

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-str-esc-02.nt
nt-syntax-str-esc-03: nt-syntax-str-esc-03

  string literal with long Unicode escape

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-str-esc-03.nt
nt-syntax-bnode-01: nt-syntax-bnode-01

  bnode subject

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-bnode-01.nt
nt-syntax-bnode-02: nt-syntax-bnode-02

  bnode object

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-bnode-02.nt
nt-syntax-bnode-03: nt-syntax-bnode-03

  Blank node labels may start with a digit

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-bnode-03.nt
nt-syntax-datatypes-01: nt-syntax-datatypes-01

  xsd:byte literal

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-datatypes-01.nt
nt-syntax-datatypes-02: nt-syntax-datatypes-02

  integer as xsd:string

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-datatypes-02.nt
nt-syntax-bad-uri-01: nt-syntax-bad-uri-01

  Bad IRI : space (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-01.nt
nt-syntax-bad-uri-02: nt-syntax-bad-uri-02

  Bad IRI : bad escape (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-02.nt
nt-syntax-bad-uri-03: nt-syntax-bad-uri-03

  Bad IRI : bad long escape (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-03.nt
nt-syntax-bad-uri-04: nt-syntax-bad-uri-04

  Bad IRI : character escapes not allowed (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-04.nt
nt-syntax-bad-uri-05: nt-syntax-bad-uri-05

  Bad IRI : character escapes not allowed (2) (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-05.nt
nt-syntax-bad-uri-06: nt-syntax-bad-uri-06

  Bad IRI : relative IRI not allowed in subject (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-06.nt
nt-syntax-bad-uri-07: nt-syntax-bad-uri-07

  Bad IRI : relative IRI not allowed in predicate (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-07.nt
nt-syntax-bad-uri-08: nt-syntax-bad-uri-08

  Bad IRI : relative IRI not allowed in object (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-08.nt
nt-syntax-bad-uri-09: nt-syntax-bad-uri-09

  Bad IRI : relative IRI not allowed in datatype (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-uri-09.nt
nt-syntax-bad-prefix-01: nt-syntax-bad-prefix-01

  @prefix not allowed in n-triples (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-prefix-01.nt
nt-syntax-bad-base-01: nt-syntax-bad-base-01

  @base not allowed in N-Triples (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-base-01.nt
nt-syntax-bad-bnode-01: nt-syntax-bad-bnode-01

  Colon in bnode label not allowed (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-bnode-01.nt
nt-syntax-bad-bnode-02: nt-syntax-bad-bnode-02

  Colon in bnode label not allowed (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-bnode-02.nt
nt-syntax-bad-struct-01: nt-syntax-bad-struct-01

  N-Triples does not have objectList (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-struct-01.nt
nt-syntax-bad-struct-02: nt-syntax-bad-struct-02

  N-Triples does not have predicateObjectList (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-struct-02.nt
nt-syntax-bad-lang-01: nt-syntax-bad-lang-01

  langString with bad lang (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-lang-01.nt
nt-syntax-bad-esc-01: nt-syntax-bad-esc-01

  Bad string escape (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-esc-01.nt
nt-syntax-bad-esc-02: nt-syntax-bad-esc-02

  Bad string escape (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-esc-02.nt
nt-syntax-bad-esc-03: nt-syntax-bad-esc-03

  Bad string escape (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-esc-03.nt
nt-syntax-bad-string-01: nt-syntax-bad-string-01

  mismatching string literal open/close (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-01.nt
nt-syntax-bad-string-02: nt-syntax-bad-string-02

  mismatching string literal open/close (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-02.nt
nt-syntax-bad-string-03: nt-syntax-bad-string-03

  single quotes (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-03.nt
nt-syntax-bad-string-04: nt-syntax-bad-string-04

  long single string literal (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-04.nt
nt-syntax-bad-string-05: nt-syntax-bad-string-05

  long double string literal (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-05.nt
nt-syntax-bad-string-06: nt-syntax-bad-string-06

  string literal with no end (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-06.nt
nt-syntax-bad-string-07: nt-syntax-bad-string-07

  string literal with no start (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-string-07.nt
nt-syntax-bad-num-01: nt-syntax-bad-num-01

  no numbers in N-Triples (integer) (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-num-01.nt
nt-syntax-bad-num-02: nt-syntax-bad-num-02

  no numbers in N-Triples (decimal) (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-num-02.nt
nt-syntax-bad-num-03: nt-syntax-bad-num-03

  no numbers in N-Triples (float) (negative test)

  type
    rdft:TestNTriplesNegativeSyntax
  approval
  action
    nt-syntax-bad-num-03.nt
nt-syntax-subm-01: nt-syntax-subm-01

  Submission test from Original RDF Test Cases

  type
    rdft:TestNTriplesPositiveSyntax
  approval
  action
    nt-syntax-subm-01.nt
comment_following_triple: comment_following_triple

  Tests comments after a triple

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    comment_following_triple.nt
literal: literal

  literal """x"""

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal.nt
literal_all_controls: literal_all_controls

  literal_all_controls '\x00\x01\x02\x03\x04…'

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Approved
  action
    literal_all_controls.nt
literal_all_punctuation: literal_all_punctuation

  literal_all_punctuation '!"#$%&()…'

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Approved
  action
    literal_all_punctuation.nt
literal_ascii_boundaries: literal_ascii_boundaries

  literal_ascii_boundaries '\x00\x26\x28…'

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_ascii_boundaries.nt
literal_with_2_dquotes: literal_with_2_dquotes

  literal with 2 dquotes """a""b"""

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_2_dquotes.nt
literal_with_2_squotes: literal_with_2_squotes

  literal with 2 squotes "x''y"

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_2_squotes.nt
literal_with_BACKSPACE: literal_with_BACKSPACE

  literal with BACKSPACE

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_BACKSPACE.nt
literal_with_CARRIAGE_RETURN: literal_with_CARRIAGE_RETURN

  literal with CARRIAGE RETURN

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_CARRIAGE_RETURN.nt
literal_with_CHARACTER_TABULATION: literal_with_CHARACTER_TABULATION

  literal with CHARACTER TABULATION

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_CHARACTER_TABULATION.nt
literal_with_dquote: literal_with_dquote

  literal with dquote "x"y"

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_dquote.nt
literal_with_FORM_FEED: literal_with_FORM_FEED

  literal with FORM FEED

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_FORM_FEED.nt
literal_with_LINE_FEED: literal_with_LINE_FEED

  literal with LINE FEED

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_LINE_FEED.nt
literal_with_numeric_escape4: literal_with_numeric_escape4

  literal with numeric escape4 \u

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_numeric_escape4.nt
literal_with_numeric_escape8: literal_with_numeric_escape8

  literal with numeric escape8 \U

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_numeric_escape8.nt
literal_with_REVERSE_SOLIDUS: literal_with_REVERSE_SOLIDUS

  literal with REVERSE SOLIDUS

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_REVERSE_SOLIDUS.nt
literal_with_REVERSE_SOLIDUS2: literal_with_REVERSE_SOLIDUS2

  REVERSE SOLIDUS at end of literal

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_REVERSE_SOLIDUS2.nt
literal_with_squote: literal_with_squote

  literal with squote "x'y"

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_squote.nt
literal_with_UTF8_boundaries: literal_with_UTF8_boundaries

  literal_with_UTF8_boundaries '\x80\x7ff\x800\xfff…'

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    literal_with_UTF8_boundaries.nt
langtagged_string: langtagged_string

  langtagged string "x"@en

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    langtagged_string.nt
lantag_with_subtag: lantag_with_subtag

  lantag with subtag "x"@en-us

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    lantag_with_subtag.nt
minimal_whitespace: minimal_whitespace

  tests absense of whitespace between subject, predicate, object and end-of-statement

  type
    rdft:TestNTriplesPositiveSyntax
  approval
    rdft:Proposed
  action
    minimal_whitespace.nt