Difference between revisions of "RDF Test Suites"

From RDF Working Group Wiki
Jump to: navigation, search
(Put text at top pointing to the implementation report)
(Add definitions for N-Triples positive and negative syntax tests)
Line 71: Line 71:
 
== Turtle Syntax Test ==
 
== Turtle Syntax Test ==
  
This is an example of a synatx test:
+
This is an example of a syntax test:
  
 
  <nowiki> <#turtle-syntax-file-01> rdf:type rdft:TestTurtlePositiveSyntax ;
 
  <nowiki> <#turtle-syntax-file-01> rdf:type rdft:TestTurtlePositiveSyntax ;
Line 127: Line 127:
 
implementation design.  They are not violating the strict grammar of Turtle,
 
implementation design.  They are not violating the strict grammar of Turtle,
 
but some other feature required of a parser (e.g. valid IRIs).
 
but some other feature required of a parser (e.g. valid IRIs).
 +
 +
== N-Triples Syntax Test ==
 +
 +
This is an example of a syntax test:
 +
 +
<nowiki> <#nt-syntax-file-01> rdf:type rdft:TestNTriplesPositiveSyntax ;
 +
    mf:name    "nt-syntax-file-01" ;
 +
    mf:action  <nt-syntax-file-01.nt> ;
 +
    .</nowiki>
 +
 +
A test is passed if the system under test can parse the content at the URL identified by the
 +
object of the <code><nowiki>mf:action</nowiki></code> property as N-Triples.
 +
 +
== N-Triples Negative Syntax Test ==
 +
 +
<nowiki> <#nt-syntax-bad-uri-01> rdf:type rdft:TestNTriplesNegativeSyntax ;
 +
  mf:name    "nt-syntax-bad-uri-01" ;
 +
  mf:action  <nt-syntax-bad-uri-01.ttl> ;
 +
  .</nowiki>
 +
 +
A test is passed if the system under test raises an error when it parses the content
 +
at the URL identified by the object of the <code><nowiki>mf:action</nowiki></code>
 +
property as N-Triples.

Revision as of 21:37, 12 March 2013

See also the test reports:

and test suites (this organisation of the tests may change):


RDF Syntax Test Suites (Turtle family)

The RDF-WG produces test suites for the RDF syntaxes related to Turtle.

  • Turtle
  • N-Triples
  • TriG
  • N-Quads

A test suite consists of manifest file, which describes each test in the suite and also contains a list of the tests that are currently


See also:

Manifest File Format

The manifest file is written in RDF. The form consists of a header section, which lists the test included and then each test. It is possible to process the file as RDF but also exploit the regular to process with text processing tools.

There are syntax tests, negative syntax tests, evaluation tests and negative evaluation tests.

The following prefixes apply:

 @prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @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#> .

The assumed base URI for the tests is <http://example/base/> if needed.

Each test has a type, indicating what sort of test it is. It then has either an action given by the mf:action property, or an action and a result given by the mf:result property, (evaluation tests).

Triples may be produced during the running of a test; they are ignored except for evaluation tests, which specify the expected triples. Negative evaluation tests do not specify any expected output triples.

Manifest Header

The manifest header looks like:

 <>  rdf:type mf:Manifest ;
     rdfs:comment "Turtle tests" ;
     mf:entries
     (
     ....
     ) .

where .... is a list of links to test descriptions, one per line.

Turtle Syntax Test

This is an example of a syntax test:

 <#turtle-syntax-file-01> rdf:type rdft:TestTurtlePositiveSyntax ;
    mf:name    "turtle-syntax-file-01" ;
    mf:action  <turtle-syntax-file-01.ttl> ;
    .

A test is passed if the system under test can parse the content at the URL identified by the object of the mf:action property as Turtle.

Turtle Negative Syntax Test

 <#turtle-syntax-bad-uri-01> rdf:type rdft:TestTurtleNegativeSyntax ;
   mf:name    "turtle-syntax-bad-uri-01" ;
   mf:action  <turtle-syntax-bad-uri-01.ttl> ;
   .

A test is passed if the system under test raises an error when it parses the content at the URL identified by the object of the mf:action property as Turtle.

Turtle Evaluation Test

A Turtle evaluation test consists of an action and a result. The result is an N-triples file. The system under test is expected to parse the file given by the action and as a result produce the triples given in the result file (and no other triples).

The output of parsing should be compared to the N-triples result using blank node isomorphism. The two graphs, one from the Turtle file, one from the N-triples file are the same except for triple order and for consistently mapping blank nodes in one file to blank nodes in the other.

 <#turtle-eval-struct-01> rdf:type rdft:TestTurtleEval ;
   mf:name    "turtle-eval-struct-01" ;
   mf:action  <turtle-eval-struct-01.ttl> ;
   mf:result  <turtle-eval-struct-01.nt> ;
   .

Turtle Negative Evaluation Test

A negative evaluation test is passed if the system under test produces an error while processing the contents given by the action.

 <#turtle-eval-bad-01> rdf:type rdft:TestTurtleNegativeEval ;
   mf:name    "turtle-eval-bad-01" ;
   mf:action  <turtle-eval-bad-01.ttl> ;
   .

Note: passing a negative evaluation test may be generating a parse error or by some other indication of error in the file.

The test may be covering a feature that can be detected at parse time (e.g. a URI with a valid escape sequence for a bad IRI character) but may be detected in a later process stage, depending on implementation design. They are not violating the strict grammar of Turtle, but some other feature required of a parser (e.g. valid IRIs).

N-Triples Syntax Test

This is an example of a syntax test:

 <#nt-syntax-file-01> rdf:type rdft:TestNTriplesPositiveSyntax ;
    mf:name    "nt-syntax-file-01" ;
    mf:action  <nt-syntax-file-01.nt> ;
    .

A test is passed if the system under test can parse the content at the URL identified by the object of the mf:action property as N-Triples.

N-Triples Negative Syntax Test

 <#nt-syntax-bad-uri-01> rdf:type rdft:TestNTriplesNegativeSyntax ;
   mf:name    "nt-syntax-bad-uri-01" ;
   mf:action  <nt-syntax-bad-uri-01.ttl> ;
   .

A test is passed if the system under test raises an error when it parses the content at the URL identified by the object of the mf:action property as N-Triples.