Skip to content

Commit

Permalink
~ migrate ShExR to top-level ShapeDecls
Browse files Browse the repository at this point in the history
per #50

test with:
  for f in $(ls schemas/*.ttl | grep -vE '(manifest|meta)\.ttl'); do echo $f && ~/checkouts/shexSpec/shex.js/packages/shex-cli/bin/validate -m '{FOCUS a sx:Schema}@sx:Schema' -x doc/ShExR.shex -d $f > /dev/null || echo $f; done

TODO:
* schemas/1valExprRefbnode-IV1.ttl
* schemas/1valExprRef-IV1.ttl
* schemas/2RefS1-Icirc.ttl
* schemas/2RefS1-IS2.ttl
* schemas/3circRefS12.ttl
* schemas/3circRefS1-Icirc.ttl
* schemas/3circRefS1-IS23.ttl
* schemas/3circRefS1-IS2-IS3-IS3.ttl
* schemas/3circRefS1-IS2-IS3.ttl
* schemas/3circRefS23.ttl
* schemas/3circRefS2-Icirc.ttl
* schemas/3circRefS2-IS3.ttl
* schemas/3circRefS3-Icirc.ttl
* schemas/3circRefS3-IS12.ttl
* schemas/3circRefS3.ttl
* schemas/start2RefS1-IstartS2.ttl
* schemas/start2RefS2-IstartS1.ttl
  • Loading branch information
Eric Prud'hommeaux committed Jun 14, 2022
1 parent 3df4a65 commit e689670
Show file tree
Hide file tree
Showing 422 changed files with 1,288 additions and 1,277 deletions.
206 changes: 103 additions & 103 deletions doc/ShExR.shex
Original file line number Diff line number Diff line change
@@ -1,205 +1,205 @@
PREFIX sx: <http://www.w3.org/ns/shex#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
BASE <http://www.w3.org/ns/shex#>
start=@<Schema>
BASE <http://www.w3.org/ns/shex>
start=@<#Schema>

<Schema> CLOSED {
<#Schema> CLOSED {
a [sx:Schema] ;
sx:imports @<IriList1Plus> ? ;
sx:startActs @<SemActList1Plus> ? ;
sx:start @<shapeExpr> ? ;
sx:shapes @<shapeDeclOrExprList1Plus> ?
sx:imports @<#IriList1Plus> ? ;
sx:startActs @<#SemActList1Plus> ? ;
sx:start @<#shapeDeclOrExpr> ? ;
sx:shapes @<#shapeDeclOrExprList1Plus> ?
}

# <shapeDeclOrExpr> is a shortcut for always requriing a ShapeDecl
<shapeDeclOrExpr> @<ShapeDecl> OR @<shapeExpr>
# <#shapeDeclOrExpr> is a shortcut for always requriing a ShapeDecl
<#shapeDeclOrExpr> @<#ShapeDecl> OR @<#shapeExpr>

<ShapeDecl> CLOSED {
<#ShapeDecl> CLOSED {
a [sx:ShapeDecl] ;
sx:abstract [true false]? ;
sx:shapeExpr @<shapeExpr>
sx:shapeExpr @<#shapeExpr>
}

<shapeExpr> @<ShapeOr> OR @<ShapeAnd> OR @<ShapeNot> OR @<NodeConstraint> OR @<Shape> OR @<ShapeExternal>
<#shapeExpr> @<#ShapeOr> OR @<#ShapeAnd> OR @<#ShapeNot> OR @<#NodeConstraint> OR @<#Shape> OR @<#ShapeExternal>

<ShapeOr> CLOSED {
<#ShapeOr> CLOSED {
a [sx:ShapeOr] ;
sx:shapeExprs @<shapeDeclOrExprList2Plus>
sx:shapeExprs @<#shapeDeclOrExprList2Plus>
}

<ShapeAnd> CLOSED {
<#ShapeAnd> CLOSED {
a [sx:ShapeAnd] ;
sx:shapeExprs @<shapeDeclOrExprList2Plus>
sx:shapeExprs @<#shapeDeclOrExprList2Plus>
}

<ShapeNot> CLOSED {
<#ShapeNot> CLOSED {
a [sx:ShapeNot] ;
sx:shapeExpr @<shapeDeclOrExpr>
sx:shapeExpr @<#shapeDeclOrExpr>
}

<NodeConstraint> CLOSED {
<#NodeConstraint> CLOSED {
a [sx:NodeConstraint] ;
sx:nodeKind [sx:iri sx:bnode sx:literal sx:nonliteral] ? ;
sx:datatype IRI ? ;
&<xsFacets> ;
sx:values @<valueSetValueList1Plus> ?
&<#xsFacets> ;
sx:values @<#valueSetValueList1Plus> ?
}

<Shape> CLOSED {
<#Shape> CLOSED {
a [sx:Shape] ;
sx:extends @<shapeDeclOrExprList1Plus>? ;
sx:extends @<#shapeDeclOrExprList1Plus>? ;
sx:closed [true false] ? ;
sx:extra IRI * ;
sx:expression @<tripleExpression> ? ;
sx:semActs @<SemActList1Plus> ? ;
sx:annotation @<AnnotationList1Plus> ?
sx:expression @<#tripleExpression> ? ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}

<ShapeExternal> CLOSED {
<#ShapeExternal> CLOSED {
a [sx:ShapeExternal]
}

<SemAct> CLOSED {
<#SemAct> CLOSED {
a [sx:SemAct] ;
sx:name IRI ;
sx:code xsd:string ?
}

<Annotation> CLOSED {
<#Annotation> CLOSED {
a [sx:Annotation] ;
sx:predicate IRI ;
sx:object @<objectValue>
sx:object @<#objectValue>
}

# <xsFacet> @<stringFacet> OR @<numericFacet>
<facet_holder> { # hold labeled productions
$<xsFacets> ( &<stringFacet> | &<numericFacet> ) * ;
$<stringFacet> (
# <#xsFacet> @<#stringFacet> OR @<#numericFacet>
<#facet_holder> { # hold labeled productions
$<#xsFacets> ( &<#stringFacet> | &<#numericFacet> ) * ;
$<#stringFacet> (
sx:length xsd:integer
| sx:minlength xsd:integer
| sx:maxlength xsd:integer
| sx:pattern xsd:string ; sx:flags xsd:string ?
) ;
$<numericFacet> (
sx:mininclusive @<numericLiteral>
| sx:minexclusive @<numericLiteral>
| sx:maxinclusive @<numericLiteral>
| sx:maxexclusive @<numericLiteral>
$<#numericFacet> (
sx:mininclusive @<#numericLiteral>
| sx:minexclusive @<#numericLiteral>
| sx:maxinclusive @<#numericLiteral>
| sx:maxexclusive @<#numericLiteral>
| sx:totaldigits xsd:integer
| sx:fractiondigits xsd:integer
)
}
<numericLiteral> xsd:integer OR xsd:decimal OR xsd:double
<#numericLiteral> xsd:integer OR xsd:decimal OR xsd:double

<valueSetValue> @<objectValue> OR @<IriStem> OR @<IriStemRange>
OR @<LiteralStem> OR @<LiteralStemRange>
OR @<Language> OR @<LanguageStem> OR @<LanguageStemRange>
<objectValue> IRI OR LITERAL # rdf:langString breaks on Annotation.object
<Language> CLOSED { a [sx:Language] ; sx:languageTag xsd:string }
<IriStem> CLOSED { a [sx:IriStem] ; sx:stem xsd:string }
<IriStemRange> CLOSED {
<#valueSetValue> @<#objectValue> OR @<#IriStem> OR @<#IriStemRange>
OR @<#LiteralStem> OR @<#LiteralStemRange>
OR @<#Language> OR @<#LanguageStem> OR @<#LanguageStemRange>
<#objectValue> IRI OR LITERAL # rdf:langString breaks on Annotation.object
<#Language> CLOSED { a [sx:Language] ; sx:languageTag xsd:string }
<#IriStem> CLOSED { a [sx:IriStem] ; sx:stem xsd:string }
<#IriStemRange> CLOSED {
a [sx:IriStemRange] ;
sx:stem xsd:string OR @<Wildcard> ;
sx:exclusion @<IriStemExclusionList1Plus>
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#IriStemExclusionList1Plus>
}
<LiteralStem> CLOSED { a [sx:LiteralStem] ; sx:stem xsd:string }
<LiteralStemRange> CLOSED {
<#LiteralStem> CLOSED { a [sx:LiteralStem] ; sx:stem xsd:string }
<#LiteralStemRange> CLOSED {
a [sx:LiteralStemRange] ;
sx:stem xsd:string OR @<Wildcard> ;
sx:exclusion @<LiteralStemExclusionList1Plus>
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#LiteralStemExclusionList1Plus>
}
<LanguageStem> CLOSED { a [sx:LanguageStem] ; sx:stem xsd:string }
<LanguageStemRange> CLOSED {
<#LanguageStem> CLOSED { a [sx:LanguageStem] ; sx:stem xsd:string }
<#LanguageStemRange> CLOSED {
a [sx:LanguageStemRange] ;
sx:stem xsd:string OR @<Wildcard> ;
sx:exclusion @<LanguageStemExclusionList1Plus>
sx:stem xsd:string OR @<#Wildcard> ;
sx:exclusion @<#LanguageStemExclusionList1Plus>
}
<Wildcard> BNODE CLOSED {
<#Wildcard> BNODE CLOSED {
a [sx:Wildcard]
}

<tripleExpression> @<TripleConstraint> OR @<OneOf> OR @<EachOf> OR CLOSED { }
<#tripleExpression> @<#TripleConstraint> OR @<#OneOf> OR @<#EachOf> OR CLOSED { }

<OneOf> CLOSED {
<#OneOf> CLOSED {
a [sx:OneOf] ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:expressions @<tripleExpressionList2Plus> ;
sx:semActs @<SemActList1Plus> ? ;
sx:annotation @<AnnotationList1Plus> ?
sx:expressions @<#tripleExpressionList2Plus> ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}

<EachOf> CLOSED {
<#EachOf> CLOSED {
a [sx:EachOf] ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:expressions @<tripleExpressionList2Plus> ;
sx:semActs @<SemActList1Plus> ? ;
sx:annotation @<AnnotationList1Plus> ?
sx:expressions @<#tripleExpressionList2Plus> ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}

<tripleExpressionList2Plus> CLOSED {
rdf:first @<tripleExpression> ;
rdf:rest @<tripleExpressionList1Plus>
<#tripleExpressionList2Plus> CLOSED {
rdf:first @<#tripleExpression> ;
rdf:rest @<#tripleExpressionList1Plus>
}
<tripleExpressionList1Plus> CLOSED {
rdf:first @<tripleExpression> ;
rdf:rest [rdf:nil] OR @<tripleExpressionList1Plus>
<#tripleExpressionList1Plus> CLOSED {
rdf:first @<#tripleExpression> ;
rdf:rest [rdf:nil] OR @<#tripleExpressionList1Plus>
}

<TripleConstraint> CLOSED {
<#TripleConstraint> CLOSED {
a [sx:TripleConstraint] ;
sx:inverse [true false] ? ;
sx:negated [true false] ? ;
sx:min xsd:integer ? ;
sx:max xsd:integer ? ;
sx:predicate IRI ;
sx:valueExpr @<shapeDeclOrExpr> ? ;
sx:semActs @<SemActList1Plus> ? ;
sx:annotation @<AnnotationList1Plus> ?
sx:valueExpr @<#shapeDeclOrExpr> ? ;
sx:semActs @<#SemActList1Plus> ? ;
sx:annotation @<#AnnotationList1Plus> ?
}

<IriList1Plus> CLOSED {
<#IriList1Plus> CLOSED {
rdf:first IRI ;
rdf:rest [rdf:nil] OR @<IriList1Plus>
rdf:rest [rdf:nil] OR @<#IriList1Plus>
}

<SemActList1Plus> CLOSED {
rdf:first @<SemAct> ;
rdf:rest [rdf:nil] OR @<SemActList1Plus>
<#SemActList1Plus> CLOSED {
rdf:first @<#SemAct> ;
rdf:rest [rdf:nil] OR @<#SemActList1Plus>
}

<shapeDeclOrExprList2Plus> CLOSED {
rdf:first @<shapeDeclOrExpr> ;
rdf:rest @<shapeDeclOrExprList1Plus>
<#shapeDeclOrExprList2Plus> CLOSED {
rdf:first @<#shapeDeclOrExpr> ;
rdf:rest @<#shapeDeclOrExprList1Plus>
}
<shapeDeclOrExprList1Plus> CLOSED {
rdf:first @<shapeDeclOrExpr> ;
rdf:rest [rdf:nil] OR @<shapeDeclOrExprList1Plus>
<#shapeDeclOrExprList1Plus> CLOSED {
rdf:first @<#shapeDeclOrExpr> ;
rdf:rest [rdf:nil] OR @<#shapeDeclOrExprList1Plus>
}

<valueSetValueList1Plus> CLOSED {
rdf:first @<valueSetValue> ;
rdf:rest [rdf:nil] OR @<valueSetValueList1Plus>
<#valueSetValueList1Plus> CLOSED {
rdf:first @<#valueSetValue> ;
rdf:rest [rdf:nil] OR @<#valueSetValueList1Plus>
}

<AnnotationList1Plus> CLOSED {
rdf:first @<Annotation> ;
rdf:rest [rdf:nil] OR @<AnnotationList1Plus>
<#AnnotationList1Plus> CLOSED {
rdf:first @<#Annotation> ;
rdf:rest [rdf:nil] OR @<#AnnotationList1Plus>
}

<IriStemExclusionList1Plus> CLOSED {
rdf:first IRI OR @<IriStem> ;
rdf:rest [rdf:nil] OR @<IriStemExclusionList1Plus>
<#IriStemExclusionList1Plus> CLOSED {
rdf:first IRI OR @<#IriStem> ;
rdf:rest [rdf:nil] OR @<#IriStemExclusionList1Plus>
}

<LiteralStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<LiteralStem> ;
rdf:rest [rdf:nil] OR @<LiteralStemExclusionList1Plus>
<#LiteralStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<#LiteralStem> ;
rdf:rest [rdf:nil] OR @<#LiteralStemExclusionList1Plus>
}

<LanguageStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<LanguageStem> ;
rdf:rest [rdf:nil] OR @<LanguageStemExclusionList1Plus>
<#LanguageStemExclusionList1Plus> CLOSED {
rdf:first xsd:string OR @<#LanguageStem> ;
rdf:rest [rdf:nil] OR @<#LanguageStemExclusionList1Plus>
}
2 changes: 1 addition & 1 deletion schemas/0.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:Shape .
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ] .

6 changes: 3 additions & 3 deletions schemas/0Extends1.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1> <http://a.example/S2>) .

<http://a.example/S1> a sx:Shape ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate <http://a.example/p1> ] .
sx:predicate <http://a.example/p1> ] ] .

<http://a.example/S2> a sx:Shape ; sx:extends (<http://a.example/S1>) .
<http://a.example/S2> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ; sx:extends (<http://a.example/S1>) ] .

4 changes: 2 additions & 2 deletions schemas/0focusBNODE.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:ShapeAnd ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:ShapeAnd ;
sx:shapeExprs (
[ a sx:NodeConstraint ; sx:nodeKind sx:bnode ]
[ a sx:Shape ]
).
)] .
4 changes: 2 additions & 2 deletions schemas/0focusIRI.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:ShapeAnd ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:ShapeAnd ;
sx:shapeExprs (
[ a sx:NodeConstraint ; sx:nodeKind sx:iri ]
[ a sx:Shape ]
).
)] .
4 changes: 2 additions & 2 deletions schemas/1Adot.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:Shape ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ] .
sx:predicate rdf:type ] ] .

4 changes: 2 additions & 2 deletions schemas/1IRIInline0.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:Shape ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ;
sx:expression
[ a sx:TripleConstraint ;
sx:predicate <http://a.example/p1> ;
Expand All @@ -17,5 +17,5 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[ a sx:Shape ]
)
]
] .
] ] .

4 changes: 2 additions & 2 deletions schemas/1IRI_with_UCHAR.1dot.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:Shape ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate <http://a.example/p1> ] .
sx:predicate <http://a.example/p1> ] ] .

4 changes: 2 additions & 2 deletions schemas/1IRI_with_all_punctuationdot.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
[] a sx:Schema ;
sx:shapes (<http://a.example/S1>) .

<http://a.example/S1> a sx:Shape ;
<http://a.example/S1> a sx:ShapeDecl ; sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate <scheme:!$%25&amp;'()*+,-./0123456789:/@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~?#> ] .
sx:predicate <scheme:!$%25&amp;'()*+,-./0123456789:/@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~?#> ] ] .

Loading

0 comments on commit e689670

Please sign in to comment.