diff options
97 files changed, 1123 insertions, 45 deletions
@@ -1,4 +1,4 @@ -Copyright 2011-2016 David Robillard <http://drobilla.net> +Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -1,3 +1,9 @@ +serd (0.25.0) unstable; + + * Add support for NQuads + + -- David Robillard <d@drobilla.net> Thu, 05 Jan 2017 16:20:09 -0500 + serd (0.24.0) stable; * Add serd_node_new_relative_uri() diff --git a/doc/serdi.1 b/doc/serdi.1 index 6b5a3a75..2bf42084 100644 --- a/doc/serdi.1 +++ b/doc/serdi.1 @@ -1,4 +1,4 @@ -.TH SERDI 1 "08 May 2012" +.TH SERDI 1 "05 Jan 2017" .SH NAME .B serdi \- Read and write RDF syntax @@ -34,7 +34,7 @@ Print the command line options. .TP \fB\-i SYNTAX\fR -Read input in SYNTAX (`turtle' or `ntriples'). +Read input in SYNTAX (turtle, ntriples, or nquads). .TP \fB\-l\fR @@ -42,7 +42,7 @@ Lax (non-strict) parsing. .TP \fB\-o SYNTAX\fR -Write output in SYNTAX (`turtle' or `ntriples'). +Write output in SYNTAX (turtle, ntriples, or nquads). .TP \fB\-p PREFIX\fR @@ -68,7 +68,7 @@ Display version information and exit. Serdi was written by David Robillard <d@drobilla.net> .SH COPYRIGHT -Copyright \(co 2011-2016 David Robillard. +Copyright \(co 2011-2017 David Robillard. .br License: <http://www.opensource.org/licenses/isc> .br diff --git a/serd/serd.h b/serd/serd.h index 9e48e7da..3402d576 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard <http://drobilla.net> + Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -110,7 +110,13 @@ typedef enum { NTriples - Line-based RDF triples (ASCII). @see <a href="http://www.w3.org/TR/rdf-testcases#ntriples">NTriples</a> */ - SERD_NTRIPLES = 2 + SERD_NTRIPLES = 2, + + /** + NQuads - Line-based RDF quads (UTF-8). + @see <a href="https://www.w3.org/TR/n-quads/">NQuads</a> + */ + SERD_NQUADS = 3 } SerdSyntax; /** diff --git a/src/reader.c b/src/reader.c index 0cfa1575..ddb8551b 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard <http://drobilla.net> + Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -55,6 +55,9 @@ typedef struct { Ref graph; Ref subject; Ref predicate; + Ref object; + Ref datatype; + Ref language; SerdStatementFlags* flags; } ReadContext; @@ -95,6 +98,18 @@ struct SerdReaderImpl { #endif }; +static inline bool +supports_fancy_literals(const SerdReader* reader) +{ + return reader->syntax == SERD_TURTLE; +} + +static inline bool +supports_relative_iris(const SerdReader* reader) +{ + return reader->syntax == SERD_TURTLE; +} + static int r_err(SerdReader* reader, SerdStatus st, const char* fmt, ...) { @@ -618,6 +633,11 @@ read_String(SerdReader* reader, SerdNodeFlags* flags) return push_node(reader, SERD_LITERAL, "", 0); } + if (!supports_fancy_literals(reader)) { + return r_err(reader, SERD_ERR_BAD_SYNTAX, + "syntax does not support long literals\n"); + } + eat_byte_safe(reader, q3); return read_STRING_LITERAL_LONG(reader, flags, q1); } @@ -781,14 +801,35 @@ read_LANGTAG(SerdReader* reader) return ref; } +typedef enum { PREFIX, GOOD, BAD} SchemeState; + +static inline bool +check_scheme(SerdReader* reader, uint8_t c, SchemeState* state) +{ + if (!supports_relative_iris(reader) && *state == PREFIX) { + if (c == ':') { + *state = GOOD; + } else if (!isalpha(c)) { + *state = BAD; + return r_err(reader, SERD_ERR_BAD_SYNTAX, + "syntax does not support relative IRIs\n"); + } + } + return true; +} + static Ref read_IRIREF(SerdReader* reader) { TRY_RET(eat_byte_check(reader, '<')); - Ref ref = push_node(reader, SERD_URI, "", 0); - uint32_t code; + Ref ref = push_node(reader, SERD_URI, "", 0); + SchemeState scheme = PREFIX; + uint32_t code; while (true) { const uint8_t c = peek_byte(reader); + if (!check_scheme(reader, c, &scheme)) { + return pop_node(reader, ref); + } switch (c) { case '"': case '<': case '^': case '`': case '{': case '|': case '}': r_err(reader, SERD_ERR_BAD_SYNTAX, @@ -1141,10 +1182,11 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest) return (eat_byte_check(reader, ']') == ']'); } -// Recurses, calling statement_sink for every statement encountered. -// Leaves stack in original calling state (i.e. pops everything it pushes). +/* If emit is true: recurses, calling statement_sink for every statement + encountered, and leaves stack in original calling state (i.e. pops + everything it pushes). */ static bool -read_object(SerdReader* reader, ReadContext ctx, bool* ate_dot) +read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot) { static const char* const XSD_BOOLEAN = NS_XSD "boolean"; static const size_t XSD_BOOLEAN_LEN = 40; @@ -1154,24 +1196,31 @@ read_object(SerdReader* reader, ReadContext ctx, bool* ate_dot) #endif bool ret = false; - bool emit = (ctx.subject != 0); + bool simple = (ctx->subject != 0); SerdNode* node = NULL; Ref o = 0; Ref datatype = 0; Ref lang = 0; uint32_t flags = 0; const uint8_t c = peek_byte(reader); + if (!supports_fancy_literals(reader)) { + switch (c) { + case '"': case ':': case '<': case '_': break; + default: return r_err(reader, SERD_ERR_BAD_SYNTAX, + "expected: ':', '<', or '_'\n"); + } + } switch (c) { case '\0': case ')': return false; case '[': - emit = false; - TRY_THROW(ret = read_anon(reader, ctx, false, &o)); + simple = false; + TRY_THROW(ret = read_anon(reader, *ctx, false, &o)); break; case '(': - emit = false; - TRY_THROW(ret = read_collection(reader, ctx, &o)); + simple = false; + TRY_THROW(ret = read_collection(reader, *ctx, &o)); break; case '_': TRY_THROW(ret = (o = read_BLANK_NODE_LABEL(reader, ate_dot))); @@ -1206,9 +1255,17 @@ read_object(SerdReader* reader, ReadContext ctx, bool* ate_dot) } } - if (ret && emit) { + if (simple) { deref(reader, o)->flags = flags; - ret = emit_statement(reader, ctx, o, datatype, lang); + } + + if (ret && emit && simple) { + ret = emit_statement(reader, *ctx, o, datatype, lang); + } else if (ret && !emit) { + ctx->object = o; + ctx->datatype = datatype; + ctx->language = lang; + return true; } except: @@ -1224,9 +1281,9 @@ except: static bool read_objectList(SerdReader* reader, ReadContext ctx, bool* ate_dot) { - TRY_RET(read_object(reader, ctx, ate_dot)); + TRY_RET(read_object(reader, &ctx, true, ate_dot)); while (!*ate_dot && eat_delim(reader, ',')) { - TRY_RET(read_object(reader, ctx, ate_dot)); + TRY_RET(read_object(reader, &ctx, true, ate_dot)); } return true; } @@ -1311,7 +1368,7 @@ read_collection(SerdReader* reader, ReadContext ctx, Ref* dest) // _:node rdf:first object ctx.predicate = reader->rdf_first; bool ate_dot = false; - if (!read_object(reader, ctx, &ate_dot) || ate_dot) { + if (!read_object(reader, &ctx, true, &ate_dot) || ate_dot) { return end_collection(reader, ctx, n1, n2, false); } @@ -1454,7 +1511,7 @@ static bool read_statement(SerdReader* reader) { SerdStatementFlags flags = 0; - ReadContext ctx = { 0, 0, 0, &flags }; + ReadContext ctx = { 0, 0, 0, 0, 0, 0, &flags }; read_ws_star(reader); bool ate_dot = false; switch (peek_byte(reader)) { @@ -1489,6 +1546,75 @@ read_turtleDoc(SerdReader* reader) return !reader->error; } +static bool +read_nquadsDoc(SerdReader* reader) +{ + while (!reader->eof) { + SerdStatementFlags flags = 0; + ReadContext ctx = { 0, 0, 0, 0, 0, 0, &flags }; + bool ate_dot = false; + bool nested = false; + read_ws_star(reader); + if (peek_byte(reader) == '\0') { + reader->eof = true; + return !reader->error; + } + + // subject + if (!(ctx.subject = read_subject(reader, ctx, &nested))) { + return false; + } + + // predicate + TRY_RET(read_ws_star(reader)); + if (!(ctx.predicate = read_IRIREF(reader))) { + return false; + } + + // object + TRY_RET(read_ws_star(reader)); + if (!read_object(reader, &ctx, false, &ate_dot)) { + return false; + } + + if (!ate_dot) { + // graphLabel? + TRY_RET(read_ws_star(reader)); + switch (peek_byte(reader)) { + case '.': + break; + case '_': + ctx.graph = read_BLANK_NODE_LABEL(reader, &ate_dot); + break; + default: + if (!(ctx.graph = read_IRIREF(reader))) { + return false; + } + } + + // Terminating '.' + TRY_RET(read_ws_star(reader)); + eat_byte_check(reader, '.'); + } + + TRY_RET(emit_statement(reader, ctx, ctx.object, ctx.datatype, ctx.language)); + pop_node(reader, ctx.graph); + pop_node(reader, ctx.language); + pop_node(reader, ctx.datatype); + pop_node(reader, ctx.object); + } + return !reader->error; +} + +static bool +read_doc(SerdReader* reader) +{ + switch (reader->syntax) { + case SERD_NQUADS: return read_nquadsDoc(reader); + default: return read_turtleDoc(reader); + } +} + SERD_API SerdReader* serd_reader_new(SerdSyntax syntax, @@ -1686,7 +1812,7 @@ serd_reader_read_file_handle(SerdReader* me, FILE* file, const uint8_t* name) { SerdStatus st = serd_reader_start_stream(me, file, name, true); if (!st) { - st = read_turtleDoc(me) ? SERD_SUCCESS : SERD_ERR_UNKNOWN; + st = read_doc(me) ? SERD_SUCCESS : SERD_ERR_UNKNOWN; serd_reader_end_stream(me); } return st; @@ -1706,7 +1832,7 @@ serd_reader_read_string(SerdReader* me, const uint8_t* utf8) me->eof = false; skip_bom(me); - const bool ret = read_turtleDoc(me); + const bool ret = read_doc(me); me->read_buf = NULL; return ret ? SERD_SUCCESS : SERD_ERR_UNKNOWN; diff --git a/src/serdi.c b/src/serdi.c index 953a3c0c..be52587c 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard <http://drobilla.net> + Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -33,7 +33,7 @@ static int print_version(void) { printf("serdi " SERD_VERSION " <http://drobilla.net/software/serd>\n"); - printf("Copyright 2011-2016 David Robillard <http://drobilla.net>.\n" + printf("Copyright 2011-2017 David Robillard <http://drobilla.net>.\n" "License: <http://www.opensource.org/licenses/isc>\n" "This is free software; you are free to change and redistribute it." "\nThere is NO WARRANTY, to the extent permitted by law.\n"); @@ -53,9 +53,9 @@ print_usage(const char* name, bool error) fprintf(os, " -e Eat input one character at a time.\n"); fprintf(os, " -f Keep full URIs in input (don't qualify).\n"); fprintf(os, " -h Display this help and exit.\n"); - fprintf(os, " -i SYNTAX Input syntax (`turtle' or `ntriples').\n"); + fprintf(os, " -i SYNTAX Input syntax (turtle, ntriples, or nquads).\n"); fprintf(os, " -l Lax (non-strict) parsing.\n"); - fprintf(os, " -o SYNTAX Output syntax (`turtle' or `ntriples').\n"); + fprintf(os, " -o SYNTAX Output syntax (turtle, ntriples, or nquads).\n"); fprintf(os, " -p PREFIX Add PREFIX to blank node IDs.\n"); fprintf(os, " -q Suppress all output except data.\n"); fprintf(os, " -r ROOT_URI Keep relative URIs within ROOT_URI.\n"); @@ -71,6 +71,8 @@ set_syntax(SerdSyntax* syntax, const char* name) *syntax = SERD_TURTLE; } else if (!strcmp(name, "ntriples")) { *syntax = SERD_NTRIPLES; + } else if (!strcmp(name, "nquads")) { + *syntax = SERD_NQUADS; } else { SERDI_ERRORF("unknown syntax `%s'\n", name); return false; diff --git a/src/writer.c b/src/writer.c index 0d1ebded..59c05420 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard <http://drobilla.net> + Copyright 2011-2017 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -431,7 +431,8 @@ typedef enum { FIELD_NONE, FIELD_SUBJECT, FIELD_PREDICATE, - FIELD_OBJECT + FIELD_OBJECT, + FIELD_GRAPH } Field; static bool @@ -491,6 +492,7 @@ write_node(SerdWriter* writer, case SERD_CURIE: switch (writer->syntax) { case SERD_NTRIPLES: + case SERD_NQUADS: if (serd_env_expand(writer->env, node, &uri_prefix, &suffix)) { w_err(writer, SERD_ERR_BAD_CURIE, "undefined namespace prefix `%s'\n", node->buf); @@ -661,11 +663,16 @@ serd_writer_write_statement(SerdWriter* writer, switch (writer->syntax) { case SERD_NTRIPLES: + case SERD_NQUADS: TRY(write_node(writer, subject, NULL, NULL, FIELD_SUBJECT, flags)); sink(" ", 1, writer); TRY(write_node(writer, predicate, NULL, NULL, FIELD_PREDICATE, flags)); sink(" ", 1, writer); TRY(write_node(writer, object, datatype, lang, FIELD_OBJECT, flags)); + if (writer->syntax == SERD_NQUADS && graph) { + sink(" ", 1, writer); + TRY(write_node(writer, graph, datatype, lang, FIELD_GRAPH, flags)); + } sink(" .\n", 3, writer); return SERD_SUCCESS; default: diff --git a/tests/NQuadsTests/README b/tests/NQuadsTests/README new file mode 100644 index 00000000..7aef79dd --- /dev/null +++ b/tests/NQuadsTests/README @@ -0,0 +1,25 @@ +This README is for the W3C RDF Working Group's N-Quads test suite. +This test suite contains two kinds of tests: + + Positive syntax (rdft:TestNQuadsPositiveSyntax) - an input N-Quads + file with no syntax errors. + + Negative syntax (rdft:TestNQuadsNegativeSyntax) - an input N-Quads + file with at least one syntax error. + +The manifest.ttl file in this directory lists tests in the +RDF WG's N-Quads test suite. All +tests have a name (mf:name) and an input (mf:action). + +• An implementation passes a positive syntax test if it parses the + input. + +• An implementation passes a negative syntax test if it fails to parse + the input. + +The home of the test suite is <http://www.w3.org/2013/NQuadsTests/>. + +See http://www.w3.org/2011/rdf-wg/wiki/RDF_Test_Suites for more details. + +Eric Prud'hommeaux <eric+turtle@w3.org> - 11 June 2013. +Gregg Kellogg <gregg@greggkellogg.net> - 26 June 2013. diff --git a/tests/NQuadsTests/comment_following_triple.nq b/tests/NQuadsTests/comment_following_triple.nq new file mode 100644 index 00000000..5619459a --- /dev/null +++ b/tests/NQuadsTests/comment_following_triple.nq @@ -0,0 +1,5 @@ +<http://example/s> <http://example/p> <http://example/o> . # comment +<http://example/s> <http://example/p> _:o . # comment +<http://example/s> <http://example/p> "o" . # comment +<http://example/s> <http://example/p> "o"^^<http://example/dt> . # comment +<http://example/s> <http://example/p> "o"@en . # comment diff --git a/tests/NQuadsTests/langtagged_string.nq b/tests/NQuadsTests/langtagged_string.nq new file mode 100644 index 00000000..1bddb04e --- /dev/null +++ b/tests/NQuadsTests/langtagged_string.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "chat"@en . diff --git a/tests/NQuadsTests/lantag_with_subtag.nq b/tests/NQuadsTests/lantag_with_subtag.nq new file mode 100644 index 00000000..629cbf42 --- /dev/null +++ b/tests/NQuadsTests/lantag_with_subtag.nq @@ -0,0 +1 @@ +<http://example.org/ex#a> <http://example.org/ex#b> "Cheers"@en-UK . diff --git a/tests/NQuadsTests/literal.nq b/tests/NQuadsTests/literal.nq new file mode 100644 index 00000000..3aba89e4 --- /dev/null +++ b/tests/NQuadsTests/literal.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "x" . diff --git a/tests/NQuadsTests/literal_all_controls.nq b/tests/NQuadsTests/literal_all_controls.nq new file mode 100644 index 00000000..91c8af14 --- /dev/null +++ b/tests/NQuadsTests/literal_all_controls.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\t\u000B\u000C\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" . diff --git a/tests/NQuadsTests/literal_all_punctuation.nq b/tests/NQuadsTests/literal_all_punctuation.nq new file mode 100644 index 00000000..c25d818f --- /dev/null +++ b/tests/NQuadsTests/literal_all_punctuation.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> " !\"#$%&():;<=>?@[]^_`{|}~" . diff --git a/tests/NQuadsTests/literal_ascii_boundaries.nq b/tests/NQuadsTests/literal_ascii_boundaries.nq Binary files differnew file mode 100644 index 00000000..7a4dc717 --- /dev/null +++ b/tests/NQuadsTests/literal_ascii_boundaries.nq diff --git a/tests/NQuadsTests/literal_false.nq b/tests/NQuadsTests/literal_false.nq new file mode 100644 index 00000000..5bbbae84 --- /dev/null +++ b/tests/NQuadsTests/literal_false.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> . diff --git a/tests/NQuadsTests/literal_true.nq b/tests/NQuadsTests/literal_true.nq new file mode 100644 index 00000000..054b229f --- /dev/null +++ b/tests/NQuadsTests/literal_true.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . diff --git a/tests/NQuadsTests/literal_with_2_dquotes.nq b/tests/NQuadsTests/literal_with_2_dquotes.nq new file mode 100644 index 00000000..3e69dc10 --- /dev/null +++ b/tests/NQuadsTests/literal_with_2_dquotes.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "x\"\"y" . diff --git a/tests/NQuadsTests/literal_with_2_squotes.nq b/tests/NQuadsTests/literal_with_2_squotes.nq new file mode 100644 index 00000000..8ddc52e8 --- /dev/null +++ b/tests/NQuadsTests/literal_with_2_squotes.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "x''y" . diff --git a/tests/NQuadsTests/literal_with_BACKSPACE.nq b/tests/NQuadsTests/literal_with_BACKSPACE.nq new file mode 100644 index 00000000..339013df --- /dev/null +++ b/tests/NQuadsTests/literal_with_BACKSPACE.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\b" . diff --git a/tests/NQuadsTests/literal_with_CARRIAGE_RETURN.nq b/tests/NQuadsTests/literal_with_CARRIAGE_RETURN.nq new file mode 100644 index 00000000..91b85c89 --- /dev/null +++ b/tests/NQuadsTests/literal_with_CARRIAGE_RETURN.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\r" . diff --git a/tests/NQuadsTests/literal_with_CHARACTER_TABULATION.nq b/tests/NQuadsTests/literal_with_CHARACTER_TABULATION.nq new file mode 100644 index 00000000..a6a9d9f0 --- /dev/null +++ b/tests/NQuadsTests/literal_with_CHARACTER_TABULATION.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\t" . diff --git a/tests/NQuadsTests/literal_with_FORM_FEED.nq b/tests/NQuadsTests/literal_with_FORM_FEED.nq new file mode 100644 index 00000000..10d2c6d7 --- /dev/null +++ b/tests/NQuadsTests/literal_with_FORM_FEED.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\f" . diff --git a/tests/NQuadsTests/literal_with_LINE_FEED.nq b/tests/NQuadsTests/literal_with_LINE_FEED.nq new file mode 100644 index 00000000..462f97ac --- /dev/null +++ b/tests/NQuadsTests/literal_with_LINE_FEED.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\n" . diff --git a/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS.nq b/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS.nq new file mode 100644 index 00000000..ebc846ed --- /dev/null +++ b/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\\" . diff --git a/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS2.nq b/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS2.nq new file mode 100644 index 00000000..586e364d --- /dev/null +++ b/tests/NQuadsTests/literal_with_REVERSE_SOLIDUS2.nq @@ -0,0 +1 @@ +<http://example.org/ns#s> <http://example.org/ns#p1> "test-\\" . diff --git a/tests/NQuadsTests/literal_with_UTF8_boundaries.nq b/tests/NQuadsTests/literal_with_UTF8_boundaries.nq new file mode 100644 index 00000000..0e1616db --- /dev/null +++ b/tests/NQuadsTests/literal_with_UTF8_boundaries.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "߿ࠀက쿿퀀�𐀀" . diff --git a/tests/NQuadsTests/literal_with_dquote.nq b/tests/NQuadsTests/literal_with_dquote.nq new file mode 100644 index 00000000..05a1fd3a --- /dev/null +++ b/tests/NQuadsTests/literal_with_dquote.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "x\"y" . diff --git a/tests/NQuadsTests/literal_with_numeric_escape4.nq b/tests/NQuadsTests/literal_with_numeric_escape4.nq new file mode 100644 index 00000000..16f0a036 --- /dev/null +++ b/tests/NQuadsTests/literal_with_numeric_escape4.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\u006F" . diff --git a/tests/NQuadsTests/literal_with_numeric_escape8.nq b/tests/NQuadsTests/literal_with_numeric_escape8.nq new file mode 100644 index 00000000..e909a79d --- /dev/null +++ b/tests/NQuadsTests/literal_with_numeric_escape8.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "\U0000006F" . diff --git a/tests/NQuadsTests/literal_with_squote.nq b/tests/NQuadsTests/literal_with_squote.nq new file mode 100644 index 00000000..acf7f58f --- /dev/null +++ b/tests/NQuadsTests/literal_with_squote.nq @@ -0,0 +1 @@ +<http://a.example/s> <http://a.example/p> "x'y" . diff --git a/tests/NQuadsTests/manifest.ttl b/tests/NQuadsTests/manifest.ttl new file mode 100644 index 00000000..eb5f5508 --- /dev/null +++ b/tests/NQuadsTests/manifest.ttl @@ -0,0 +1,695 @@ +# N-Quads Syntax tests + +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . +@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> . + +@prefix rdft: <http://www.w3.org/ns/rdftest#> . + +<> a mf:Manifest ; + mf:name "N-Quads tests" ; + mf:entries + ( + <#nq-syntax-uri-01> + <#nq-syntax-uri-02> + <#nq-syntax-uri-03> + <#nq-syntax-uri-04> + <#nq-syntax-uri-05> + <#nq-syntax-uri-06> + <#nq-syntax-bnode-01> + <#nq-syntax-bnode-02> + <#nq-syntax-bnode-03> + <#nq-syntax-bnode-04> + <#nq-syntax-bnode-05> + <#nq-syntax-bnode-06> + <#nq-syntax-bad-literal-01> + <#nq-syntax-bad-literal-02> + <#nq-syntax-bad-literal-03> + <#nq-syntax-bad-uri-01> + <#nq-syntax-bad-quint-01> + <#nt-syntax-file-01> + <#nt-syntax-file-02> + <#nt-syntax-file-03> + <#nt-syntax-uri-01> + <#nt-syntax-uri-02> + <#nt-syntax-uri-03> + <#nt-syntax-uri-04> + <#nt-syntax-string-01> + <#nt-syntax-string-02> + <#nt-syntax-string-03> + <#nt-syntax-str-esc-01> + <#nt-syntax-str-esc-02> + <#nt-syntax-str-esc-03> + <#nt-syntax-bnode-01> + <#nt-syntax-bnode-02> + <#nt-syntax-bnode-03> + <#nt-syntax-datatypes-01> + <#nt-syntax-datatypes-02> + <#nt-syntax-bad-uri-01> + <#nt-syntax-bad-uri-02> + <#nt-syntax-bad-uri-03> + <#nt-syntax-bad-uri-04> + <#nt-syntax-bad-uri-05> + <#nt-syntax-bad-uri-06> + <#nt-syntax-bad-uri-07> + <#nt-syntax-bad-uri-08> + <#nt-syntax-bad-uri-09> + <#nt-syntax-bad-prefix-01> + <#nt-syntax-bad-base-01> + <#nt-syntax-bad-struct-01> + <#nt-syntax-bad-struct-02> + <#nt-syntax-bad-lang-01> + <#nt-syntax-bad-esc-01> + <#nt-syntax-bad-esc-02> + <#nt-syntax-bad-esc-03> + <#nt-syntax-bad-string-01> + <#nt-syntax-bad-string-02> + <#nt-syntax-bad-string-03> + <#nt-syntax-bad-string-04> + <#nt-syntax-bad-string-05> + <#nt-syntax-bad-string-06> + <#nt-syntax-bad-string-07> + <#nt-syntax-bad-num-01> + <#nt-syntax-bad-num-02> + <#nt-syntax-bad-num-03> + <#nt-syntax-subm-01> + <#comment_following_triple> + <#literal> + <#literal_all_controls> + <#literal_all_punctuation> + <#literal_ascii_boundaries> + <#literal_with_2_dquotes> + <#literal_with_2_squotes> + <#literal_with_BACKSPACE> + <#literal_with_CARRIAGE_RETURN> + <#literal_with_CHARACTER_TABULATION> + <#literal_with_dquote> + <#literal_with_FORM_FEED> + <#literal_with_LINE_FEED> + <#literal_with_numeric_escape4> + <#literal_with_numeric_escape8> + <#literal_with_REVERSE_SOLIDUS> + <#literal_with_REVERSE_SOLIDUS2> + <#literal_with_squote> + <#literal_with_UTF8_boundaries> + <#langtagged_string> + <#lantag_with_subtag> + <#minimal_whitespace> + ) . + +<#nq-syntax-uri-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-01" ; + rdfs:comment "URI graph with URI triple" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-01.nq> ; + . + +<#nq-syntax-uri-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-02" ; + rdfs:comment "URI graph with BNode subject" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-02.nq> ; + . + +<#nq-syntax-uri-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-03" ; + rdfs:comment "URI graph with BNode object" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-03.nq> ; + . + +<#nq-syntax-uri-04> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-04" ; + rdfs:comment "URI graph with simple literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-04.nq> ; + . + +<#nq-syntax-uri-05> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-05" ; + rdfs:comment "URI graph with language tagged literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-05.nq> ; + . + +<#nq-syntax-uri-06> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-uri-06" ; + rdfs:comment "URI graph with datatyped literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-uri-06.nq> ; + . + +<#nq-syntax-bnode-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-01" ; + rdfs:comment "BNode graph with URI triple" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-01.nq> ; + . + +<#nq-syntax-bnode-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-02" ; + rdfs:comment "BNode graph with BNode subject" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-02.nq> ; + . + +<#nq-syntax-bnode-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-03" ; + rdfs:comment "BNode graph with BNode object" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-03.nq> ; + . + +<#nq-syntax-bnode-04> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-04" ; + rdfs:comment "BNode graph with simple literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-04.nq> ; + . + +<#nq-syntax-bnode-05> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-05" ; + rdfs:comment "BNode graph with language tagged literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-05.nq> ; + . + +<#nq-syntax-bnode-06> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nq-syntax-bnode-06" ; + rdfs:comment "BNode graph with datatyped literal" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bnode-06.nq> ; + . + +<#nq-syntax-bad-literal-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nq-syntax-bad-literal-01" ; + rdfs:comment "Graph name may not be a simple literal (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bad-literal-01.nq> ; + . + +<#nq-syntax-bad-literal-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nq-syntax-bad-literal-02" ; + rdfs:comment "Graph name may not be a language tagged literal (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bad-literal-02.nq> ; + . + +<#nq-syntax-bad-literal-03> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nq-syntax-bad-literal-03" ; + rdfs:comment "Graph name may not be a datatyped literal (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bad-literal-03.nq> ; + . + +<#nq-syntax-bad-uri-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nq-syntax-bad-uri-01" ; + rdfs:comment "Graph name URI must be absolute (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bad-uri-01.nq> ; + . + +<#nq-syntax-bad-quint-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nq-syntax-bad-quint-01" ; + rdfs:comment "N-Quads does not have a fifth element (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nq-syntax-bad-quint-01.nq> ; + . + +<#nt-syntax-file-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-file-01" ; + rdfs:comment "Empty file" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-file-01.nq> ; + . + +<#nt-syntax-file-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-file-02" ; + rdfs:comment "Only comment" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-file-02.nq> ; + . + +<#nt-syntax-file-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-file-03" ; + rdfs:comment "One comment, one empty line" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-file-03.nq> ; + . + +<#nt-syntax-uri-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-uri-01" ; + rdfs:comment "Only IRIs" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-uri-01.nq> ; + . + +<#nt-syntax-uri-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-uri-02" ; + rdfs:comment "IRIs with Unicode escape" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-uri-02.nq> ; + . + +<#nt-syntax-uri-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-uri-03" ; + rdfs:comment "IRIs with long Unicode escape" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-uri-03.nq> ; + . + +<#nt-syntax-uri-04> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-uri-04" ; + rdfs:comment "Legal IRIs" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-uri-04.nq> ; + . + +<#nt-syntax-string-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-string-01" ; + rdfs:comment "string literal" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-string-01.nq> ; + . + +<#nt-syntax-string-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-string-02" ; + rdfs:comment "langString literal" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-string-02.nq> ; + . + +<#nt-syntax-string-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-string-03" ; + rdfs:comment "langString literal with region" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-string-03.nq> ; + . + +<#nt-syntax-str-esc-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-str-esc-01" ; + rdfs:comment "string literal with escaped newline" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-str-esc-01.nq> ; + . + +<#nt-syntax-str-esc-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-str-esc-02" ; + rdfs:comment "string literal with Unicode escape" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-str-esc-02.nq> ; + . + +<#nt-syntax-str-esc-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-str-esc-03" ; + rdfs:comment "string literal with long Unicode escape" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-str-esc-03.nq> ; + . + +<#nt-syntax-bnode-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-bnode-01" ; + rdfs:comment "bnode subject" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bnode-01.nq> ; + . + +<#nt-syntax-bnode-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-bnode-02" ; + rdfs:comment "bnode object" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bnode-02.nq> ; + . + +<#nt-syntax-bnode-03> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-bnode-03" ; + rdfs:comment "Blank node labels may start with a digit" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bnode-03.nq> ; + . + +<#nt-syntax-datatypes-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-datatypes-01" ; + rdfs:comment "xsd:byte literal" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-datatypes-01.nq> ; + . + +<#nt-syntax-datatypes-02> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-datatypes-02" ; + rdfs:comment "integer as xsd:string" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-datatypes-02.nq> ; + . + +<#nt-syntax-bad-uri-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-01" ; + rdfs:comment "Bad IRI : space (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-01.nq> ; + . + +<#nt-syntax-bad-uri-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-02" ; + rdfs:comment "Bad IRI : bad escape (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-02.nq> ; + . + +<#nt-syntax-bad-uri-03> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-03" ; + rdfs:comment "Bad IRI : bad long escape (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-03.nq> ; + . + +<#nt-syntax-bad-uri-04> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-04" ; + rdfs:comment "Bad IRI : character escapes not allowed (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-04.nq> ; + . + +<#nt-syntax-bad-uri-05> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-05" ; + rdfs:comment "Bad IRI : character escapes not allowed (2) (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-05.nq> ; + . + +<#nt-syntax-bad-uri-06> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-06" ; + rdfs:comment "Bad IRI : relative IRI not allowed in subject (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-06.nq> ; + . + +<#nt-syntax-bad-uri-07> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-07" ; + rdfs:comment "Bad IRI : relative IRI not allowed in predicate (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-07.nq> ; + . + +<#nt-syntax-bad-uri-08> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-08" ; + rdfs:comment "Bad IRI : relative IRI not allowed in object (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-08.nq> ; + . + +<#nt-syntax-bad-uri-09> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-uri-09" ; + rdfs:comment "Bad IRI : relative IRI not allowed in datatype (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-uri-09.nq> ; + . + +<#nt-syntax-bad-prefix-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-prefix-01" ; + rdfs:comment "@prefix not allowed in n-triples (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-prefix-01.nq> ; + . + +<#nt-syntax-bad-base-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-base-01" ; + rdfs:comment "@base not allowed in N-Triples (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-base-01.nq> ; + . + +<#nt-syntax-bad-struct-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-struct-01" ; + rdfs:comment "N-Triples does not have objectList (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-struct-01.nq> ; + . + +<#nt-syntax-bad-struct-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-struct-02" ; + rdfs:comment "N-Triples does not have predicateObjectList (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-struct-02.nq> ; + . + +<#nt-syntax-bad-lang-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-lang-01" ; + rdfs:comment "langString with bad lang (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-lang-01.nq> ; + . + +<#nt-syntax-bad-esc-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-esc-01" ; + rdfs:comment "Bad string escape (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-esc-01.nq> ; + . + +<#nt-syntax-bad-esc-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-esc-02" ; + rdfs:comment "Bad string escape (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-esc-02.nq> ; + . + +<#nt-syntax-bad-esc-03> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-esc-03" ; + rdfs:comment "Bad string escape (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-esc-03.nq> ; + . + +<#nt-syntax-bad-string-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-01" ; + rdfs:comment "mismatching string literal open/close (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-01.nq> ; + . + +<#nt-syntax-bad-string-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-02" ; + rdfs:comment "mismatching string literal open/close (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-02.nq> ; + . + +<#nt-syntax-bad-string-03> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-03" ; + rdfs:comment "single quotes (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-03.nq> ; + . + +<#nt-syntax-bad-string-04> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-04" ; + rdfs:comment "long single string literal (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-04.nq> ; + . + +<#nt-syntax-bad-string-05> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-05" ; + rdfs:comment "long double string literal (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-05.nq> ; + . + +<#nt-syntax-bad-string-06> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-06" ; + rdfs:comment "string literal with no end (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-06.nq> ; + . + +<#nt-syntax-bad-string-07> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-string-07" ; + rdfs:comment "string literal with no start (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-string-07.nq> ; + . + +<#nt-syntax-bad-num-01> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-num-01" ; + rdfs:comment "no numbers in N-Triples (integer) (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-num-01.nq> ; + . + +<#nt-syntax-bad-num-02> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-num-02" ; + rdfs:comment "no numbers in N-Triples (decimal) (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-num-02.nq> ; + . + +<#nt-syntax-bad-num-03> a rdft:TestNQuadsNegativeSyntax ; + mf:name "nt-syntax-bad-num-03" ; + rdfs:comment "no numbers in N-Triples (float) (negative test)" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-bad-num-03.nq> ; + . + +<#nt-syntax-subm-01> a rdft:TestNQuadsPositiveSyntax ; + mf:name "nt-syntax-subm-01" ; + rdfs:comment "Submission test from Original RDF Test Cases" ; + rdft:approval rdft:Approved ; + mf:action <nt-syntax-subm-01.nq> ; + . + +<#comment_following_triple> a rdft:TestNQuadsPositiveSyntax ; + mf:name "comment_following_triple" ; + rdfs:comment "Tests comments after a triple" ; + rdft:approval rdft:Approved ; + mf:action <comment_following_triple.nq> ; + . + +<#literal_ascii_boundaries> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_ascii_boundaries" ; + rdfs:comment "literal_ascii_boundaries '\\x00\\x26\\x28...'" ; + rdft:approval rdft:Approved ; + mf:action <literal_ascii_boundaries.nq> ; + . + +<#literal_with_UTF8_boundaries> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_UTF8_boundaries" ; + rdfs:comment "literal_with_UTF8_boundaries '\\x80\\x7ff\\x800\\xfff...'" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_UTF8_boundaries.nq> ; + . + +<#literal_all_controls> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_all_controls" ; + rdfs:comment "literal_all_controls '\\x00\\x01\\x02\\x03\\x04...'" ; + rdft:approval rdft:Approved ; + rdft:approval rdft:Approved ; + mf:action <literal_all_controls.nq> ; + . + +<#literal_all_punctuation> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_all_punctuation" ; + rdfs:comment "literal_all_punctuation '!\"#$%&()...'" ; + rdft:approval rdft:Approved ; + rdft:approval rdft:Approved ; + mf:action <literal_all_punctuation.nq> ; + . + +<#literal_with_squote> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_squote" ; + rdfs:comment "literal with squote \"x'y\"" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_squote.nq> ; + . + +<#literal_with_2_squotes> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_2_squotes" ; + rdfs:comment "literal with 2 squotes \"x''y\"" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_2_squotes.nq> ; + . + +<#literal> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal" ; + rdfs:comment "literal \"\"\"x\"\"\"" ; + rdft:approval rdft:Approved ; + mf:action <literal.nq> ; + . + +<#literal_with_dquote> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_dquote" ; + rdfs:comment "literal with dquote \"x\"y\"" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_dquote.nq> ; + . + +<#literal_with_2_dquotes> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_2_dquotes" ; + rdfs:comment "literal with 2 squotes \"\"\"a\"\"b\"\"\"" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_2_dquotes.nq> ; + . + +<#literal_with_REVERSE_SOLIDUS2> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_REVERSE_SOLIDUS2" ; + rdfs:comment "REVERSE SOLIDUS at end of literal" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_REVERSE_SOLIDUS2.nq> ; + . + +<#literal_with_CHARACTER_TABULATION> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_CHARACTER_TABULATION" ; + rdfs:comment "literal with CHARACTER TABULATION" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_CHARACTER_TABULATION.nq> ; + . + +<#literal_with_BACKSPACE> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_BACKSPACE" ; + rdfs:comment "literal with BACKSPACE" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_BACKSPACE.nq> ; + . + +<#literal_with_LINE_FEED> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_LINE_FEED" ; + rdfs:comment "literal with LINE FEED" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_LINE_FEED.nq> ; + . + +<#literal_with_CARRIAGE_RETURN> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_CARRIAGE_RETURN" ; + rdfs:comment "literal with CARRIAGE RETURN" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_CARRIAGE_RETURN.nq> ; + . + +<#literal_with_FORM_FEED> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_FORM_FEED" ; + rdfs:comment "literal with FORM FEED" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_FORM_FEED.nq> ; + . + +<#literal_with_REVERSE_SOLIDUS> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_REVERSE_SOLIDUS" ; + rdfs:comment "literal with REVERSE SOLIDUS" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_REVERSE_SOLIDUS.nq> ; + . + +<#literal_with_numeric_escape4> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_numeric_escape4" ; + rdfs:comment "literal with numeric escape4 \\u" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_numeric_escape4.nq> ; + . + +<#literal_with_numeric_escape8> a rdft:TestNQuadsPositiveSyntax ; + mf:name "literal_with_numeric_escape8" ; + rdfs:comment "literal with numeric escape8 \\U" ; + rdft:approval rdft:Approved ; + mf:action <literal_with_numeric_escape8.nq> ; + . + +<#langtagged_string> a rdft:TestNQuadsPositiveSyntax ; + mf:name "langtagged_string" ; + rdfs:comment "langtagged string \"x\"@en" ; + rdft:approval rdft:Approved ; + mf:action <langtagged_string.nq> ; + . + +<#lantag_with_subtag> a rdft:TestNQuadsPositiveSyntax ; + mf:name "lantag_with_subtag" ; + rdfs:comment "lantag with subtag \"x\"@en-us" ; + rdft:approval rdft:Approved ; + mf:action <lantag_with_subtag.nq> ; + . + +<#minimal_whitespace> a rdft:TestNQuadsPositiveSyntax ; + mf:name "minimal_whitespace" ; + rdfs:comment "tests absense of whitespace between subject, predicate, object and end-of-statement" ; + rdft:approval rdft:Approved ; + mf:action <minimal_whitespace.nq> ; + . diff --git a/tests/NQuadsTests/minimal_whitespace.nq b/tests/NQuadsTests/minimal_whitespace.nq new file mode 100644 index 00000000..e9e3a801 --- /dev/null +++ b/tests/NQuadsTests/minimal_whitespace.nq @@ -0,0 +1,6 @@ +<http://example/s><http://example/p><http://example/o>. +<http://example/s><http://example/p>"Alice". +<http://example/s><http://example/p>_:o. +_:s<http://example/p><http://example/o>. +_:s<http://example/p>"Alice". +_:s<http://example/p>_:bnode1. diff --git a/tests/NQuadsTests/nq-syntax-bad-literal-01.nq b/tests/NQuadsTests/nq-syntax-bad-literal-01.nq new file mode 100644 index 00000000..bb17eb37 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bad-literal-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> "o" .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bad-literal-02.nq b/tests/NQuadsTests/nq-syntax-bad-literal-02.nq new file mode 100644 index 00000000..ea303b28 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bad-literal-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> "o"@en .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bad-literal-03.nq b/tests/NQuadsTests/nq-syntax-bad-literal-03.nq new file mode 100644 index 00000000..854b867f --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bad-literal-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> "o"^^<http://www.w3.org/2001/XMLSchema#string> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bad-quint-01.nq b/tests/NQuadsTests/nq-syntax-bad-quint-01.nq new file mode 100644 index 00000000..52b7581e --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bad-quint-01.nq @@ -0,0 +1,2 @@ +# N-Quads rejects a quint +<http://example/s> <http://example/p> <http://example/o> <http://example/g> <http://example/n> . diff --git a/tests/NQuadsTests/nq-syntax-bad-uri-01.nq b/tests/NQuadsTests/nq-syntax-bad-uri-01.nq new file mode 100644 index 00000000..3bf4dbd0 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bad-uri-01.nq @@ -0,0 +1,2 @@ +# No relative IRIs in N-Quads +<http://example/s> <http://example/p> <http://example/o> <g>. diff --git a/tests/NQuadsTests/nq-syntax-bnode-01.nq b/tests/NQuadsTests/nq-syntax-bnode-01.nq new file mode 100644 index 00000000..b7acbd5c --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bnode-02.nq b/tests/NQuadsTests/nq-syntax-bnode-02.nq new file mode 100644 index 00000000..07c92637 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-02.nq @@ -0,0 +1 @@ +_:s <http://example/p> <http://example/o> _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bnode-03.nq b/tests/NQuadsTests/nq-syntax-bnode-03.nq new file mode 100644 index 00000000..5f89bd96 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> _:o _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bnode-04.nq b/tests/NQuadsTests/nq-syntax-bnode-04.nq new file mode 100644 index 00000000..f89ca814 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-04.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o" _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bnode-05.nq b/tests/NQuadsTests/nq-syntax-bnode-05.nq new file mode 100644 index 00000000..9bb45ce6 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-05.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o"@en _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-bnode-06.nq b/tests/NQuadsTests/nq-syntax-bnode-06.nq new file mode 100644 index 00000000..194ffdc2 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-bnode-06.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o"^^<http://www.w3.org/2001/XMLSchema#string> _:g .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-01.nq b/tests/NQuadsTests/nq-syntax-uri-01.nq new file mode 100644 index 00000000..3026e122 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-02.nq b/tests/NQuadsTests/nq-syntax-uri-02.nq new file mode 100644 index 00000000..1590ab94 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-02.nq @@ -0,0 +1 @@ +_:s <http://example/p> <http://example/o> <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-03.nq b/tests/NQuadsTests/nq-syntax-uri-03.nq new file mode 100644 index 00000000..4592edcb --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> _:o <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-04.nq b/tests/NQuadsTests/nq-syntax-uri-04.nq new file mode 100644 index 00000000..f7b834ab --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-04.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o" <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-05.nq b/tests/NQuadsTests/nq-syntax-uri-05.nq new file mode 100644 index 00000000..cf5a0ee2 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-05.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o"@en <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nq-syntax-uri-06.nq b/tests/NQuadsTests/nq-syntax-uri-06.nq new file mode 100644 index 00000000..65e77033 --- /dev/null +++ b/tests/NQuadsTests/nq-syntax-uri-06.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "o"^^<http://www.w3.org/2001/XMLSchema#string> <http://example/g> .
\ No newline at end of file diff --git a/tests/NQuadsTests/nt-syntax-bad-base-01.nq b/tests/NQuadsTests/nt-syntax-bad-base-01.nq new file mode 100644 index 00000000..dff1b3b4 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-base-01.nq @@ -0,0 +1 @@ +@base <http://example/> . diff --git a/tests/NQuadsTests/nt-syntax-bad-esc-01.nq b/tests/NQuadsTests/nt-syntax-bad-esc-01.nq new file mode 100644 index 00000000..f7a88add --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-esc-01.nq @@ -0,0 +1,2 @@ +# Bad string escape +<http://example/s> <http://example/p> "a\zb" . diff --git a/tests/NQuadsTests/nt-syntax-bad-esc-02.nq b/tests/NQuadsTests/nt-syntax-bad-esc-02.nq new file mode 100644 index 00000000..72711d49 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-esc-02.nq @@ -0,0 +1,2 @@ +# Bad string escape +<http://example/s> <http://example/p> "\uWXYZ" . diff --git a/tests/NQuadsTests/nt-syntax-bad-esc-03.nq b/tests/NQuadsTests/nt-syntax-bad-esc-03.nq new file mode 100644 index 00000000..3a4522fc --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-esc-03.nq @@ -0,0 +1,2 @@ +# Bad string escape +<http://example/s> <http://example/p> "\U0000WXYZ" . diff --git a/tests/NQuadsTests/nt-syntax-bad-lang-01.nq b/tests/NQuadsTests/nt-syntax-bad-lang-01.nq new file mode 100644 index 00000000..a4d952c8 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-lang-01.nq @@ -0,0 +1,2 @@ +# Bad lang tag +<http://example/s> <http://example/p> "string"@1 . diff --git a/tests/NQuadsTests/nt-syntax-bad-num-01.nq b/tests/NQuadsTests/nt-syntax-bad-num-01.nq new file mode 100644 index 00000000..2be6f516 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-num-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> 1 . diff --git a/tests/NQuadsTests/nt-syntax-bad-num-02.nq b/tests/NQuadsTests/nt-syntax-bad-num-02.nq new file mode 100644 index 00000000..e1d5b06c --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-num-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> 1.0 . diff --git a/tests/NQuadsTests/nt-syntax-bad-num-03.nq b/tests/NQuadsTests/nt-syntax-bad-num-03.nq new file mode 100644 index 00000000..a9be82fc --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-num-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> 1.0e0 . diff --git a/tests/NQuadsTests/nt-syntax-bad-prefix-01.nq b/tests/NQuadsTests/nt-syntax-bad-prefix-01.nq new file mode 100644 index 00000000..89e08cc7 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-prefix-01.nq @@ -0,0 +1 @@ +@prefix : <http://example/> . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-01.nq b/tests/NQuadsTests/nt-syntax-bad-string-01.nq new file mode 100644 index 00000000..988af87a --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "abc' . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-02.nq b/tests/NQuadsTests/nt-syntax-bad-string-02.nq new file mode 100644 index 00000000..e1d5b06c --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> 1.0 . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-03.nq b/tests/NQuadsTests/nt-syntax-bad-string-03.nq new file mode 100644 index 00000000..64d343da --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> 1.0e1 . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-04.nq b/tests/NQuadsTests/nt-syntax-bad-string-04.nq new file mode 100644 index 00000000..af4ff28f --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-04.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> '''abc''' . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-05.nq b/tests/NQuadsTests/nt-syntax-bad-string-05.nq new file mode 100644 index 00000000..75ad4b2b --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-05.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> """abc""" . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-06.nq b/tests/NQuadsTests/nt-syntax-bad-string-06.nq new file mode 100644 index 00000000..56dcbc60 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-06.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "abc . diff --git a/tests/NQuadsTests/nt-syntax-bad-string-07.nq b/tests/NQuadsTests/nt-syntax-bad-string-07.nq new file mode 100644 index 00000000..7f1ee800 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-string-07.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> abc" . diff --git a/tests/NQuadsTests/nt-syntax-bad-struct-01.nq b/tests/NQuadsTests/nt-syntax-bad-struct-01.nq new file mode 100644 index 00000000..d546d564 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-struct-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o>, <http://example/o2> . diff --git a/tests/NQuadsTests/nt-syntax-bad-struct-02.nq b/tests/NQuadsTests/nt-syntax-bad-struct-02.nq new file mode 100644 index 00000000..1f388c6e --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-struct-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o>; <http://example/p2>, <http://example/o2> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-01.nq b/tests/NQuadsTests/nt-syntax-bad-uri-01.nq new file mode 100644 index 00000000..0e69dc0c --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-01.nq @@ -0,0 +1,2 @@ +# Bad IRI : space. +<http://example/ space> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-02.nq b/tests/NQuadsTests/nt-syntax-bad-uri-02.nq new file mode 100644 index 00000000..36d91af9 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-02.nq @@ -0,0 +1,2 @@ +# Bad IRI : bad escape +<http://example/\u00ZZ11> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-03.nq b/tests/NQuadsTests/nt-syntax-bad-uri-03.nq new file mode 100644 index 00000000..f512345f --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-03.nq @@ -0,0 +1,2 @@ +# Bad IRI : bad escape +<http://example/\U00ZZ1111> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-04.nq b/tests/NQuadsTests/nt-syntax-bad-uri-04.nq new file mode 100644 index 00000000..5cab062c --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-04.nq @@ -0,0 +1,2 @@ +# Bad IRI : character escapes not allowed. +<http://example/\n> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-05.nq b/tests/NQuadsTests/nt-syntax-bad-uri-05.nq new file mode 100644 index 00000000..be0a21e0 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-05.nq @@ -0,0 +1,2 @@ +# Bad IRI : character escapes not allowed. +<http://example/\/> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-06.nq b/tests/NQuadsTests/nt-syntax-bad-uri-06.nq new file mode 100644 index 00000000..b4e64592 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-06.nq @@ -0,0 +1,2 @@ +# No relative IRIs in N-Triples +<s> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-07.nq b/tests/NQuadsTests/nt-syntax-bad-uri-07.nq new file mode 100644 index 00000000..74534dde --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-07.nq @@ -0,0 +1,2 @@ +# No relative IRIs in N-Triples +<http://example/s> <p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-08.nq b/tests/NQuadsTests/nt-syntax-bad-uri-08.nq new file mode 100644 index 00000000..41a953d4 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-08.nq @@ -0,0 +1,2 @@ +# No relative IRIs in N-Triples +<http://example/s> <http://example/p> <o> . diff --git a/tests/NQuadsTests/nt-syntax-bad-uri-09.nq b/tests/NQuadsTests/nt-syntax-bad-uri-09.nq new file mode 100644 index 00000000..58821da8 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bad-uri-09.nq @@ -0,0 +1,2 @@ +# No relative IRIs in N-Triples +<http://example/s> <http://example/p> "foo"^^<dt> . diff --git a/tests/NQuadsTests/nt-syntax-bnode-01.nq b/tests/NQuadsTests/nt-syntax-bnode-01.nq new file mode 100644 index 00000000..5fb0d0f9 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bnode-01.nq @@ -0,0 +1 @@ +_:a <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bnode-02.nq b/tests/NQuadsTests/nt-syntax-bnode-02.nq new file mode 100644 index 00000000..737e81b4 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bnode-02.nq @@ -0,0 +1,2 @@ +<http://example/s> <http://example/p> _:a . +_:a <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-bnode-03.nq b/tests/NQuadsTests/nt-syntax-bnode-03.nq new file mode 100644 index 00000000..1a1f1c9f --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-bnode-03.nq @@ -0,0 +1,2 @@ +<http://example/s> <http://example/p> _:1a . +_:1a <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-datatypes-01.nq b/tests/NQuadsTests/nt-syntax-datatypes-01.nq new file mode 100644 index 00000000..91263091 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-datatypes-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "123"^^<http://www.w3.org/2001/XMLSchema#byte> . diff --git a/tests/NQuadsTests/nt-syntax-datatypes-02.nq b/tests/NQuadsTests/nt-syntax-datatypes-02.nq new file mode 100644 index 00000000..d49cc27d --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-datatypes-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "123"^^<http://www.w3.org/2001/XMLSchema#string> . diff --git a/tests/NQuadsTests/nt-syntax-file-01.nq b/tests/NQuadsTests/nt-syntax-file-01.nq new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-file-01.nq diff --git a/tests/NQuadsTests/nt-syntax-file-02.nq b/tests/NQuadsTests/nt-syntax-file-02.nq new file mode 100644 index 00000000..e6d327d5 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-file-02.nq @@ -0,0 +1 @@ +#Empty file. diff --git a/tests/NQuadsTests/nt-syntax-file-03.nq b/tests/NQuadsTests/nt-syntax-file-03.nq new file mode 100644 index 00000000..a9ca0358 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-file-03.nq @@ -0,0 +1,2 @@ +#One comment, one empty line. + diff --git a/tests/NQuadsTests/nt-syntax-str-esc-01.nq b/tests/NQuadsTests/nt-syntax-str-esc-01.nq new file mode 100644 index 00000000..3925f2ec --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-str-esc-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "a\n" . diff --git a/tests/NQuadsTests/nt-syntax-str-esc-02.nq b/tests/NQuadsTests/nt-syntax-str-esc-02.nq new file mode 100644 index 00000000..e7d032f0 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-str-esc-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "a\u0020b" . diff --git a/tests/NQuadsTests/nt-syntax-str-esc-03.nq b/tests/NQuadsTests/nt-syntax-str-esc-03.nq new file mode 100644 index 00000000..b8588c79 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-str-esc-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "a\U00000020b" . diff --git a/tests/NQuadsTests/nt-syntax-string-01.nq b/tests/NQuadsTests/nt-syntax-string-01.nq new file mode 100644 index 00000000..5333aefe --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-string-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "string" . diff --git a/tests/NQuadsTests/nt-syntax-string-02.nq b/tests/NQuadsTests/nt-syntax-string-02.nq new file mode 100644 index 00000000..1ab55a33 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-string-02.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "string"@en . diff --git a/tests/NQuadsTests/nt-syntax-string-03.nq b/tests/NQuadsTests/nt-syntax-string-03.nq new file mode 100644 index 00000000..b34ca0f6 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-string-03.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> "string"@en-uk . diff --git a/tests/NQuadsTests/nt-syntax-subm-01.nq b/tests/NQuadsTests/nt-syntax-subm-01.nq new file mode 100644 index 00000000..91b49889 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-subm-01.nq @@ -0,0 +1,79 @@ +# +# Copyright World Wide Web Consortium, (Massachusetts Institute of +# Technology, Institut National de Recherche en Informatique et en +# Automatique, Keio University). +# +# All Rights Reserved. +# +# Please see the full Copyright clause at +# <http://www.w3.org/Consortium/Legal/copyright-software.html> +# +# Test file with a variety of legal N-Triples +# +# Dave Beckett - http://purl.org/net/dajobe/ +# +# $Id: test.nt,v 1.7 2003/10/06 15:52:19 dbeckett2 Exp $ +# +##################################################################### + +# comment lines + # comment line after whitespace +# empty blank line, then one with spaces and tabs + + +<http://example.org/resource1> <http://example.org/property> <http://example.org/resource2> . +_:anon <http://example.org/property> <http://example.org/resource2> . +<http://example.org/resource2> <http://example.org/property> _:anon . +# spaces and tabs throughout: + <http://example.org/resource3> <http://example.org/property> <http://example.org/resource2> . + +# line ending with CR NL (ASCII 13, ASCII 10) +<http://example.org/resource4> <http://example.org/property> <http://example.org/resource2> . + +# 2 statement lines separated by single CR (ASCII 10) +<http://example.org/resource5> <http://example.org/property> <http://example.org/resource2> . +<http://example.org/resource6> <http://example.org/property> <http://example.org/resource2> . + + +# All literal escapes +<http://example.org/resource7> <http://example.org/property> "simple literal" . +<http://example.org/resource8> <http://example.org/property> "backslash:\\" . +<http://example.org/resource9> <http://example.org/property> "dquote:\"" . +<http://example.org/resource10> <http://example.org/property> "newline:\n" . +<http://example.org/resource11> <http://example.org/property> "return\r" . +<http://example.org/resource12> <http://example.org/property> "tab:\t" . + +# Space is optional before final . +<http://example.org/resource13> <http://example.org/property> <http://example.org/resource2>. +<http://example.org/resource14> <http://example.org/property> "x". +<http://example.org/resource15> <http://example.org/property> _:anon. + +# \u and \U escapes +# latin small letter e with acute symbol \u00E9 - 3 UTF-8 bytes #xC3 #A9 +<http://example.org/resource16> <http://example.org/property> "\u00E9" . +# Euro symbol \u20ac - 3 UTF-8 bytes #xE2 #x82 #xAC +<http://example.org/resource17> <http://example.org/property> "\u20AC" . +# resource18 test removed +# resource19 test removed +# resource20 test removed + +# XML Literals as Datatyped Literals +<http://example.org/resource21> <http://example.org/property> ""^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource22> <http://example.org/property> " "^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource23> <http://example.org/property> "x"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource23> <http://example.org/property> "\""^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource24> <http://example.org/property> "<a></a>"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource25> <http://example.org/property> "a <b></b>"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource26> <http://example.org/property> "a <b></b> c"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource26> <http://example.org/property> "a\n<b></b>\nc"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +<http://example.org/resource27> <http://example.org/property> "chat"^^<http://www.w3.org/2000/01/rdf-schema#XMLLiteral> . +# resource28 test removed 2003-08-03 +# resource29 test removed 2003-08-03 + +# Plain literals with languages +<http://example.org/resource30> <http://example.org/property> "chat"@fr . +<http://example.org/resource31> <http://example.org/property> "chat"@en . + +# Typed Literals +<http://example.org/resource32> <http://example.org/property> "abc"^^<http://example.org/datatype1> . +# resource33 test removed 2003-08-03 diff --git a/tests/NQuadsTests/nt-syntax-uri-01.nq b/tests/NQuadsTests/nt-syntax-uri-01.nq new file mode 100644 index 00000000..02e6ba98 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-uri-01.nq @@ -0,0 +1 @@ +<http://example/s> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-uri-02.nq b/tests/NQuadsTests/nt-syntax-uri-02.nq new file mode 100644 index 00000000..664feea1 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-uri-02.nq @@ -0,0 +1,2 @@ +# x53 is capital S +<http://example/\u0053> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-uri-03.nq b/tests/NQuadsTests/nt-syntax-uri-03.nq new file mode 100644 index 00000000..b5aeb26e --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-uri-03.nq @@ -0,0 +1,2 @@ +# x53 is capital S +<http://example/\U00000053> <http://example/p> <http://example/o> . diff --git a/tests/NQuadsTests/nt-syntax-uri-04.nq b/tests/NQuadsTests/nt-syntax-uri-04.nq new file mode 100644 index 00000000..49bacca7 --- /dev/null +++ b/tests/NQuadsTests/nt-syntax-uri-04.nq @@ -0,0 +1,2 @@ +# IRI with all chars in it. +<http://example/s> <http://example/p> <scheme:!$%25&'()*+,-./0123456789:/@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~?#> . @@ -11,7 +11,7 @@ import waflib.extras.autowaf as autowaf # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -SERD_VERSION = '0.24.0' +SERD_VERSION = '0.25.0' SERD_MAJOR_VERSION = '0' # Mandatory waf variables @@ -314,20 +314,22 @@ def test_thru(ctx, base, path, check_filename, flags): else: Logs.pprint('RED', 'FAIL: error running %s' % command) -def test_manifest(ctx, srcdir, testdir, report, base_uri): +def test_manifest(ctx, srcdir, testdir, report, base_uri, isyntax, osyntax, test_runs): import rdflib import urlparse rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#') mf = rdflib.Namespace('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#') - rdft = rdflib.Namespace('http://www.w3.org/ns/rdftest#') earl = rdflib.Namespace('http://www.w3.org/ns/earl#') model = rdflib.ConjunctiveGraph() - model.parse(os.path.join(srcdir, 'tests', testdir, 'manifest.ttl'), - rdflib.URIRef(base_uri + 'manifest.ttl'), - format='n3') + try: + model.parse(os.path.join(srcdir, 'tests', testdir, 'manifest.ttl'), + rdflib.URIRef(base_uri + 'manifest.ttl'), + format='n3') + except Exception as e: + print("Error: %s" % e) asserter = '' if os.getenv('USER') == 'drobilla': @@ -337,7 +339,8 @@ def test_manifest(ctx, srcdir, testdir, report, base_uri): output = os.path.join('tests', testdir, action_node + '.out') action = os.path.join(srcdir, 'tests', testdir, action_node) rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir)) - command = 'serdi_static -f "%s" "%s" > %s' % (action, base_uri + rel, output) + command = 'serdi_static -i %s -o %s -f "%s" "%s" > %s' % ( + isyntax, osyntax, action, base_uri + rel, output) return autowaf.run_test(ctx, APPNAME, command, expected_return, name=str(action)) @@ -361,14 +364,12 @@ def test_manifest(ctx, srcdir, testdir, report, base_uri): report.write(earl_assertion(test, passed, asserter)) autowaf.end_tests(ctx, APPNAME, str(test_class)) - run_tests(rdft.TestTurtlePositiveSyntax, 0) - run_tests(rdft.TestTurtleNegativeSyntax, 1) - run_tests(rdft.TestTurtleNegativeEval, 1) - run_tests(rdft.TestTurtleEval, 0, True) + for i in test_runs: + run_tests(i[0], i[1], i[2]) def test(ctx): blddir = autowaf.build_dir(APPNAME, 'tests') - for i in ['', 'bad', 'good', 'new', 'TurtleTests', 'extra']: + for i in ['', 'bad', 'good', 'new', 'TurtleTests', 'NQuadsTests', 'extra']: try: os.makedirs(os.path.join(blddir, i)) except: @@ -506,6 +507,10 @@ def test(ctx): # New manifest-driven tests try: + import rdflib + rdft = rdflib.Namespace('http://www.w3.org/ns/rdftest#') + + # Start test report with serd information report = open('earl.ttl', 'w') report.write('''@prefix earl: <http://www.w3.org/ns/earl#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n''') @@ -514,8 +519,21 @@ def test(ctx): for line in serd_ttl: report.write(line) serd_ttl.close() + + # Run tests and append to report turtle_tests = 'http://www.w3.org/2013/TurtleTests/' - test_manifest(ctx, srcdir, 'TurtleTests', report, turtle_tests) + test_manifest(ctx, srcdir, 'TurtleTests', report, turtle_tests, 'turtle', 'ntriples', + [[rdft.TestTurtlePositiveSyntax, 0, False], + [rdft.TestTurtleNegativeSyntax, 1, False], + [rdft.TestTurtleNegativeEval, 1, False], + [rdft.TestTurtleEval, 0, True]]) + + nquads_tests = 'http://www.w3.org/2013/NQuadsTests/' + test_manifest(ctx, srcdir, 'NQuadsTests', report, nquads_tests, 'nquads', 'nquads', + [[rdft.TestNQuadsPositiveSyntax, 0, False], + [rdft.TestNQuadsNegativeSyntax, 1, False], + [rdft.TestNQuadsNegativeEval, 1, False], + [rdft.TestNQuadsEval, 0, True]]) report.close() except: |