# N-Quads 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

nq-syntax-uri-01: nq-syntax-uri-01

  URI graph with URI triple

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-01.nq
nq-syntax-uri-02: nq-syntax-uri-02

  URI graph with BNode subject

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-02.nq
nq-syntax-uri-03: nq-syntax-uri-03

  URI graph with BNode object

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-03.nq
nq-syntax-uri-04: nq-syntax-uri-04

  URI graph with simple literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-04.nq
nq-syntax-uri-05: nq-syntax-uri-05

  URI graph with language tagged literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-05.nq
nq-syntax-uri-06: nq-syntax-uri-06

  URI graph with datatyped literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-uri-06.nq
nq-syntax-bnode-01: nq-syntax-bnode-01

  BNode graph with URI triple

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-01.nq
nq-syntax-bnode-02: nq-syntax-bnode-02

  BNode graph with BNode subject

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-02.nq
nq-syntax-bnode-03: nq-syntax-bnode-03

  BNode graph with BNode object

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-03.nq
nq-syntax-bnode-04: nq-syntax-bnode-04

  BNode graph with simple literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-04.nq
nq-syntax-bnode-05: nq-syntax-bnode-05

  BNode graph with language tagged literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-05.nq
nq-syntax-bnode-06: nq-syntax-bnode-06

  BNode graph with datatyped literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bnode-06.nq
nq-syntax-bad-literal-01: nq-syntax-bad-literal-01

  Graph name may not be a simple literal (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bad-literal-01.nq
nq-syntax-bad-literal-02: nq-syntax-bad-literal-02

  Graph name may not be a language tagged literal (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bad-literal-02.nq
nq-syntax-bad-literal-03: nq-syntax-bad-literal-03

  Graph name may not be a datatyped literal (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bad-literal-03.nq
nq-syntax-bad-uri-01: nq-syntax-bad-uri-01

  Graph name URI must be absolute (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bad-uri-01.nq
nq-syntax-bad-quint-01: nq-syntax-bad-quint-01

  N-Quads does not have a fifth element (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nq-syntax-bad-quint-01.nq
nt-syntax-file-01: nt-syntax-file-01

  Empty file

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-file-01.nq
nt-syntax-file-02: nt-syntax-file-02

  Only comment

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-file-02.nq
nt-syntax-file-03: nt-syntax-file-03

  One comment, one empty line

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-file-03.nq
nt-syntax-uri-01: nt-syntax-uri-01

  Only IRIs

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-uri-01.nq
nt-syntax-uri-02: nt-syntax-uri-02

  IRIs with Unicode escape

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-uri-02.nq
nt-syntax-uri-03: nt-syntax-uri-03

  IRIs with long Unicode escape

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-uri-03.nq
nt-syntax-uri-04: nt-syntax-uri-04

  Legal IRIs

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-uri-04.nq
nt-syntax-string-01: nt-syntax-string-01

  string literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-string-01.nq
nt-syntax-string-02: nt-syntax-string-02

  langString literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-string-02.nq
nt-syntax-string-03: nt-syntax-string-03

  langString literal with region

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-string-03.nq
nt-syntax-str-esc-01: nt-syntax-str-esc-01

  string literal with escaped newline

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-str-esc-01.nq
nt-syntax-str-esc-02: nt-syntax-str-esc-02

  string literal with Unicode escape

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-str-esc-02.nq
nt-syntax-str-esc-03: nt-syntax-str-esc-03

  string literal with long Unicode escape

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-str-esc-03.nq
nt-syntax-bnode-01: nt-syntax-bnode-01

  bnode subject

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bnode-01.nq
nt-syntax-bnode-02: nt-syntax-bnode-02

  bnode object

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bnode-02.nq
nt-syntax-bnode-03: nt-syntax-bnode-03

  Blank node labels may start with a digit

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bnode-03.nq
nt-syntax-datatypes-01: nt-syntax-datatypes-01

  xsd:byte literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-datatypes-01.nq
nt-syntax-datatypes-02: nt-syntax-datatypes-02

  integer as xsd:string

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-datatypes-02.nq
nt-syntax-bad-uri-01: nt-syntax-bad-uri-01

  Bad IRI : space (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-01.nq
nt-syntax-bad-uri-02: nt-syntax-bad-uri-02

  Bad IRI : bad escape (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-02.nq
nt-syntax-bad-uri-03: nt-syntax-bad-uri-03

  Bad IRI : bad long escape (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-03.nq
nt-syntax-bad-uri-04: nt-syntax-bad-uri-04

  Bad IRI : character escapes not allowed (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-04.nq
nt-syntax-bad-uri-05: nt-syntax-bad-uri-05

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-05.nq
nt-syntax-bad-uri-06: nt-syntax-bad-uri-06

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-06.nq
nt-syntax-bad-uri-07: nt-syntax-bad-uri-07

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-07.nq
nt-syntax-bad-uri-08: nt-syntax-bad-uri-08

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-08.nq
nt-syntax-bad-uri-09: nt-syntax-bad-uri-09

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-uri-09.nq
nt-syntax-bad-prefix-01: nt-syntax-bad-prefix-01

  @prefix not allowed in N-Quads (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-prefix-01.nq
nt-syntax-bad-base-01: nt-syntax-bad-base-01

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-base-01.nq
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.nq
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.nq
nt-syntax-bad-struct-01: nt-syntax-bad-struct-01

  N-Quads does not have objectList (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-struct-01.nq
nt-syntax-bad-struct-02: nt-syntax-bad-struct-02

  N-Quads does not have predicateObjectList (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-struct-02.nq
nt-syntax-bad-lang-01: nt-syntax-bad-lang-01

  langString with bad lang (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-lang-01.nq
nt-syntax-bad-esc-01: nt-syntax-bad-esc-01

  Bad string escape (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-esc-01.nq
nt-syntax-bad-esc-02: nt-syntax-bad-esc-02

  Bad string escape (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-esc-02.nq
nt-syntax-bad-esc-03: nt-syntax-bad-esc-03

  Bad string escape (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-esc-03.nq
nt-syntax-bad-string-01: nt-syntax-bad-string-01

  mismatching string literal open/close (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-01.nq
nt-syntax-bad-string-02: nt-syntax-bad-string-02

  mismatching string literal open/close (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-02.nq
nt-syntax-bad-string-03: nt-syntax-bad-string-03

  single quotes (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-03.nq
nt-syntax-bad-string-04: nt-syntax-bad-string-04

  long single string literal (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-04.nq
nt-syntax-bad-string-05: nt-syntax-bad-string-05

  long double string literal (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-05.nq
nt-syntax-bad-string-06: nt-syntax-bad-string-06

  string literal with no end (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-06.nq
nt-syntax-bad-string-07: nt-syntax-bad-string-07

  string literal with no start (negative test)

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-string-07.nq
nt-syntax-bad-num-01: nt-syntax-bad-num-01

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-num-01.nq
nt-syntax-bad-num-02: nt-syntax-bad-num-02

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-num-02.nq
nt-syntax-bad-num-03: nt-syntax-bad-num-03

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

  type
    rdft:TestNQuadsNegativeSyntax
  approval
    rdft:Approved
  action
    nt-syntax-bad-num-03.nq
nt-syntax-subm-01: nt-syntax-subm-01

  Submission test from Original RDF Test Cases

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    nt-syntax-subm-01.nq
comment_following_triple: comment_following_triple

  Tests comments after a triple

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    comment_following_triple.nq
literal: literal

  literal """x"""

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal.nq
literal_all_controls: literal_all_controls

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

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_all_controls.nq
literal_all_punctuation: literal_all_punctuation

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

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_all_punctuation.nq
literal_ascii_boundaries: literal_ascii_boundaries

  literal_ascii_boundaries '\x00\x26\x28…'

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_ascii_boundaries.nq
literal_with_2_dquotes: literal_with_2_dquotes

  literal with 2 squotes """a""b"""

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_2_dquotes.nq
literal_with_2_squotes: literal_with_2_squotes

  literal with 2 squotes "x''y"

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_2_squotes.nq
literal_with_BACKSPACE: literal_with_BACKSPACE

  literal with BACKSPACE

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_BACKSPACE.nq
literal_with_CARRIAGE_RETURN: literal_with_CARRIAGE_RETURN

  literal with CARRIAGE RETURN

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_CARRIAGE_RETURN.nq
literal_with_CHARACTER_TABULATION: literal_with_CHARACTER_TABULATION

  literal with CHARACTER TABULATION

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_CHARACTER_TABULATION.nq
literal_with_dquote: literal_with_dquote

  literal with dquote "x"y"

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_dquote.nq
literal_with_FORM_FEED: literal_with_FORM_FEED

  literal with FORM FEED

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_FORM_FEED.nq
literal_with_LINE_FEED: literal_with_LINE_FEED

  literal with LINE FEED

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_LINE_FEED.nq
literal_with_numeric_escape4: literal_with_numeric_escape4

  literal with numeric escape4 \u

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_numeric_escape4.nq
literal_with_numeric_escape8: literal_with_numeric_escape8

  literal with numeric escape8 \U

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_numeric_escape8.nq
literal_with_REVERSE_SOLIDUS: literal_with_REVERSE_SOLIDUS

  literal with REVERSE SOLIDUS

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_REVERSE_SOLIDUS.nq
literal_with_REVERSE_SOLIDUS2: literal_with_REVERSE_SOLIDUS2

  REVERSE SOLIDUS at end of literal

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_REVERSE_SOLIDUS2.nq
literal_with_squote: literal_with_squote

  literal with squote "x'y"

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_squote.nq
literal_with_UTF8_boundaries: literal_with_UTF8_boundaries

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

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    literal_with_UTF8_boundaries.nq
langtagged_string: langtagged_string

  langtagged string "x"@en

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    langtagged_string.nq
lantag_with_subtag: lantag_with_subtag

  lantag with subtag "x"@en-us

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    lantag_with_subtag.nq
minimal_whitespace: minimal_whitespace

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

  type
    rdft:TestNQuadsPositiveSyntax
  approval
    rdft:Approved
  action
    minimal_whitespace.nq