diff --git a/sparql/sparql12/manifest.ttl b/sparql/sparql12/manifest.ttl index 394dc857..30101171 100644 --- a/sparql/sparql12/manifest.ttl +++ b/sparql/sparql12/manifest.ttl @@ -33,6 +33,7 @@ trs:manifest rdf:type mf:Manifest ; """; mf:include ( + diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-01.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-01.rq new file mode 100644 index 00000000..514546eb --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-01.rq @@ -0,0 +1,3 @@ +\u0041\u0053\u004B\u0020\u007B\u007D + +# The query `ASK {}` entirely encoded using codepoint escapes. diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-02.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-02.rq new file mode 100644 index 00000000..8343b436 --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-02.rq @@ -0,0 +1,8 @@ +PREFIX ns: +SELECT * WHERE { + ?s ?p ns:id\u005c=123 +} + +# the escape here produces '\' REVERSE SOLIDUS (U+5C) +# its unescaping must lead to a Prefixed Name ns:id\=123 using an escaped +# equals sign (U+3D), representing the IRI . diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-04.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-04.rq new file mode 100644 index 00000000..b856b471 --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-04.rq @@ -0,0 +1,5 @@ +SELECT * WHERE { + ?s ?p "\\u0074" +} +# Legal codepoint escape of LATIN SMALL LETTER T (U+74), resulting in a +# valid backslash escape \t for CHARACTER TABULATION (U+9). diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-05.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-05.rq new file mode 100644 index 00000000..0408b8bb --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-05.rq @@ -0,0 +1,5 @@ +SELECT * WHERE { + ?s ?p "\u005C\u005Cn" +} +# Two legal codepoint escapes of REVERSE SOLIDUS (U+5C), resulting in a +# valid backslash escape \\ for REVERSE SOLIDUS (U+5C) followed by 'n'. diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-06.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-06.rq new file mode 100644 index 00000000..5989bc9a --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-06.rq @@ -0,0 +1,8 @@ +PREFIX og: +SELECT * WHERE { + ?page og:audio\u00253Atitle ?title +} + +# the escape here produces '%' PERCENT SIGN (U+25) +# its unescaping must lead to a Prefixed Name og:audio%3Atitle which includes +# the percent-encoding %3A (COLON). diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-07.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-07.rq new file mode 100644 index 00000000..75cb86fc --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-07.rq @@ -0,0 +1,7 @@ +SELECT\u0020*\U00000009WHERE { + ?s ?p "value" +} + +# the escapes here produce whitespace -- SPACESPACE (U+20) and +# CHARACTER TABULATION (U+9) -- surrounding the `*` token in the +# SELECT projection. diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-08.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-08.rq new file mode 100644 index 00000000..0fb5b5dd --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-08.rq @@ -0,0 +1,6 @@ +SELECT * WHERE { + ?s ?p \u0022value" +} + +# the escape here produces QUOTATION MARK (U+22) +# its unescaping must lead to the literal 'value'. diff --git a/sparql/sparql12/syntax-escaping/codepoint-esc-bad-03.rq b/sparql/sparql12/syntax-escaping/codepoint-esc-bad-03.rq new file mode 100644 index 00000000..bde52385 --- /dev/null +++ b/sparql/sparql12/syntax-escaping/codepoint-esc-bad-03.rq @@ -0,0 +1,5 @@ +SELECT * WHERE { + ?s ?p "\\u0041" +} +# Legal codepoint escape of LATIN CAPITAL LETTER A (U+41), resulting in an +# invalid backslash escape \A. diff --git a/sparql/sparql12/syntax-escaping/manifest.ttl b/sparql/sparql12/syntax-escaping/manifest.ttl new file mode 100644 index 00000000..5bf49e56 --- /dev/null +++ b/sparql/sparql12/syntax-escaping/manifest.ttl @@ -0,0 +1,68 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . + +:manifest rdf:type mf:Manifest ; + rdfs:label "SPARQL Codepoint-Escaping Tests" ; + mf:entries + ( + :codepoint-esc-01 + :codepoint-esc-02 + :codepoint-esc-bad-03 + :codepoint-esc-04 + :codepoint-esc-05 + :codepoint-esc-06 + :codepoint-esc-07 + :codepoint-esc-08 + ) . + + +:codepoint-esc-01 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-01.rq" ; + mf:action . + +:codepoint-esc-02 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-02.rq" ; + rdfs:comment "codepoint escape for the backslash of a PN_LOCAL_ESC in the PN_LOCAL part of a PrefixedName" ; + mf:action . + +:codepoint-esc-bad-03 rdf:type mf:NegativeSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-bad-03.rq" ; + rdfs:comment "codepoint escape that results in an invalid backslash escape (requires handling codepoint escaping before backslash escaping)" ; + mf:action . + +:codepoint-esc-04 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-04.rq" ; + rdfs:comment "codepoint escape that results in a valid backslash escape" ; + mf:action . + +:codepoint-esc-05 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-05.rq" ; + mf:action . + +:codepoint-esc-06 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-06.rq" ; + rdfs:comment "codepoint escape for the percent sign in the PL_LOCAL part of a PrefixedName" ; + mf:action . + +:codepoint-esc-07 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-07.rq" ; + rdfs:comment "codepoint escape for whitespace separating the projection tokens: SELECT * WHERE" ; + mf:action . + +:codepoint-esc-08 rdf:type mf:PositiveSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "codepoint-esc-08.rq" ; + rdfs:comment "codepoint escape for the starting double-quote of a literal" ; + mf:action . +