Warning:
This wiki has been archived and is now read-only.

Shacl-test-suite

From RDF Data Shapes Working Group
Jump to: navigation, search

SHACL Test Suite

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

A manifest file can include other manifest files.

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.

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).

Manifest Header

The manifest header looks like:

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

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

Traits

sht:traits capture properties of SHACL tests:

  • triple patterns
    • algabraics
      • sht:EachOf
        <S1> { :p1 ., :p2 . }
      • sht:EachOf-unvisited
        <S1> { :p1 ., :notFound . }
      • sht:OneOf
        <S1> { :p1 . | :p2 . }
      • sht:SomeOf
        <S1> { :p1 . | :p2 . }
    • cardinality
      • sht:DotCardinality
        <S1> { :p1 .+ }
      • sht:NonDotCardinality
        <S1> { :p1 [1 2]+ }
    • evaluation mode
      • sht:Empty
        <S1> {  }
      • sht:Exhaustive
        <S1> { :p1 [1 2], :p2 [2 3] }
      • sht:Greedy
        <S1> { :p1 [1 2], :p2 [3] }
    • misc
      • sht:TriplePattern
        <S1> { :p1 . }
      • sht:Include
        <S1> { &<S2>, :p2 . }
  • value constraints (value set, pattern ...)
    • algabraics
      • sht:AndValueExpression
        <S1> { :p1 ., :p2 . }
      • sht:OrValueExpression
        <S1> { :p1 . | :p2 . }
    • node kinds
      • sht:LexicalBnode
        <S1> { :p1 BNODE LENGTH 5 } / { <s1> <p1> _:abcde }g
      • sht:NodeKind
        <S1> { :p1 IRI }
      • sht:ToldBNode
        _:S1 { :p1 ., :p2 . }
    • term equivalence
      • sht:BooleanEquivalence
        <S1> { :p1 [true] }
      • sht:DatatypedLiteralEquivalence
        <S1> { :p1 ['ab'^^my:bloodType] }
      • sht:IriEquivalence
        <S1> { :p1 [<o1>] }
      • sht:LanguageTagEquivalence
        <S1> { :p1 ['ab'@en-fr] }
      • sht:NumericEquivalence
        <S1> { :p1 [0] }
    • XSD facets
      • sht:ComparatorFacet
        <S1> { :p1 xsd:float MININCLUSIVE 5 }
      • sht:FractionDigitsFacet
        <S1> { :p1 LITERAL FRACTIONDIGITS 5 }
      • sht:LengthFacet
        <S1> { :p1 LITERAL LENGTH 5 }
      • sht:PaternFacet
        <S1> { :p1 LITERAL PATTERN \"^ab$\" }
      • sht:TotalDigitsFacet
        <S1> { :p1 LITERAL TOTALDIGITS 5 }
    • misc
      • sht:ValueSet
        <S1> { :p1 [1 2] }
      • sht:Datatype
        <S1> { :p1 <dt1> } / { <s> <p1> 'ab'^^<dt1> }
      • sht:ShapeReference
        <S1> { :p1 @<S2> }
      • sht:ValueReference
        $<vc1> = LITERAL MINLENGTH 5 <S1> { :p1 $<vc1> }
  • shape properties (closed, ...)
    • sht:Annotation
      <S1> { :p1 .; <annot> <IRIREF> }
    • sht:Closed
      <S1> CLOSED { :p1 . }
    • sht:Extra
      <S1> EXTRA :p1 { :p1 ., :p2 . } / { <s> <p1> <o1>, <o2> }
    • sht:VapidExtra
      <S1> EXTRA :p1 { :p1 . } / { <s> <p1> <o1> }
  • test expressivity
    • sht:ExternalSemanticAction
      <S1> { :p1 . %<Test>% }
    • sht:OrderedSemanticActions
      <S1> { :p1 . %<Test>{ print(s) %} %<Test>{ print(p) %} }
    • sht:SemanticAction
      <S1> { :p1 . %<Test>{ print(o) %} }
    • sht:Start
      start = <S1> <S1> { :p1 . }
    • sht:ErrorReport - test emitted errors