Skip to content

Commit

Permalink
C14N tests (#111)
Browse files Browse the repository at this point in the history
* N-Triples canonicalization tests based on 1.1 syntax tests.
* Remove ending newline in C14N minimal whitespace tests.
* Adds tests with extra whitespace.
* Add canonicalization of literal with explicit xsd:string.
* Add ascii bounderas and double quotes tests.
* Template spelling correction.
* Update rdf/rdf12/rdf-n-triples/README.md

---------

Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: gkellogg <[email protected]>
  • Loading branch information
3 people authored Oct 19, 2023
1 parent a0b910e commit 59b0496
Show file tree
Hide file tree
Showing 86 changed files with 1,362 additions and 20 deletions.
10 changes: 10 additions & 0 deletions ns/rdftest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ rdft:TestEval a rdfs:Class;
rdfs:comment "Superclass of all RDF Evaluation Tests."@en;
rdfs:subClassOf rdft:Test .

rdft:TestC14N a rdfs:Class;
rdfs:label "Test Canonicalization"@en;
rdfs:comment "Superclass of all RDF Canonicalization Tests."@en;
rdfs:subClassOf rdft:Test .

rdft:TestNQuadsNegativeSyntax a rdfs:Class;
rdfs:label "N-Quads Negative Syntax"@en;
rdfs:comment "A negative N-Quads syntax test."@en;
Expand All @@ -69,6 +74,11 @@ rdft:TestNTriplesPositiveSyntax a rdfs:Class;
rdfs:comment "A positive N-Triples syntax test."@en;
rdfs:subClassOf rdft:TestSyntax .

rdft:TestNTriplesPositiveC14N a rdfs:Class;
rdfs:label "N-Triples Positive Canonicalization"@en;
rdfs:comment "A positive N-Triples canonicalization test."@en;
rdfs:subClassOf rdft:TestC14N .

rdft:TestSyntax a rdfs:Class;
rdfs:label "Test Syntax"@en;
rdfs:comment "Superclass of all RDF Syntax Tests."@en;
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/rdf-n-quads/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/rdf-n-triples/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/rdf-trig/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/rdf-turtle/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down
2 changes: 1 addition & 1 deletion rdf/rdf11/template.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!!! 5
%html{lang: :en, prefix: "mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#"}
/ This file is generated automatciallly from manifest.ttl, and should not be edited directly.
/ This file is generated automatically from manifest.ttl, and should not be edited directly.
%head
%meta{"http-equiv" => "Content-Type", content: "text/html;charset=utf-8"}
%meta{name: "viewport", content: "width=device-width, initial-scale=1.0"}
Expand Down
5 changes: 4 additions & 1 deletion rdf/rdf12/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang='en' prefix='mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# rdft: http://www.w3.org/ns/rdftest#'>
<!-- This file is generated automatciallly from manifest.ttl, and should not be edited directly. -->
<!-- This file is generated automatically from manifest.ttl, and should not be edited directly. -->
<head>
<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
Expand Down Expand Up @@ -81,6 +81,9 @@ <h2>
Referenced Manifests
</h2>
<ul>
<li>
<a href='rdf-n-triples/c14n/index.html' inlist='true' property='mf:include'>rdf-n-triples/c14n/</a>
</li>
<li>
<a href='rdf-n-triples/syntax/index.html' inlist='true' property='mf:include'>rdf-n-triples/syntax/</a>
</li>
Expand Down
1 change: 1 addition & 0 deletions rdf/rdf12/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ trs:manifest rdf:type mf:Manifest ;
along with the relevant RDF 1.1 tests.
""";
mf:include (
<rdf-n-triples/c14n/manifest.ttl>
<rdf-n-triples/syntax/manifest.ttl>
<rdf-semantics/manifest.ttl>
<rdf-turtle/syntax/manifest.ttl>
Expand Down
18 changes: 18 additions & 0 deletions rdf/rdf12/rdf-n-triples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This README is for the W3C RDF-star Working Group's N-Triples test suite.
This test suite contains three kinds of tests:

* Positive syntax (`rdft:TestNTriplesPositiveSyntax`) — an input N-Triples file with no syntax errors.
* Negative syntax (`rdft:TestNTriplesNegativeSyntax`) — an input N-Triples file with at least one syntax error.
* Positive canonicalization (`rdft:TestNTriplesPositiveC14N`) — an input N-Triples file with no syntax errors.

The `manifest.ttl` files in this directory lists tests in the RDF-star WG's N-Triples 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.
* An implementation passes a positive canonicalization test if it parses the
input, and generates the expected result (`mf:result`) compared as text when generating the canonical form of triples.

The home of the test suite is <https://w3c.github.io/rdf-tests/rdf/rdf12/rdf-n-triples/>.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> <http://example/o> .
2 changes: 2 additions & 0 deletions rdf/rdf12/rdf-n-triples/c14n/comment_following_triple.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# comment
<http://example/s> <http://example/p> <http://example/o> . # comment
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-01-c14n.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> <http://example/o> .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-01.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> <http://example/o> .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-02-c14n.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "Alice" .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-02.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "Alice" .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-03-c14n.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "Alice"@en .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-03.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "Alice" @en .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-04-c14n.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "2"^^<http://www.w3.org/2001/XMLSchema#integer> .
1 change: 1 addition & 0 deletions rdf/rdf12/rdf-n-triples/c14n/extra_whitespace-04.nt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://example/s> <http://example/p> "2" ^^ <http://www.w3.org/2001/XMLSchema#integer> .
Loading

0 comments on commit 59b0496

Please sign in to comment.