From d2d7cc32f97952008994b996aca2c752019d428e Mon Sep 17 00:00:00 2001 From: Eric Prud'hommeaux Date: Thu, 16 Jun 2022 19:51:02 +0200 Subject: [PATCH] ~ fix associated examples --- packages/shex-cli/test/cli/1dotOr2dot.json | 4 +- packages/shex-webapp/doc/ShExRSchema.js | 255 +++++++++++---------- packages/shex-webapp/examples/ClinObs.json | 12 +- packages/shex-webapp/examples/ClinObs.ttl | 8 +- 4 files changed, 147 insertions(+), 132 deletions(-) diff --git a/packages/shex-cli/test/cli/1dotOr2dot.json b/packages/shex-cli/test/cli/1dotOr2dot.json index d81d54f8c..1bd0f7d78 100644 --- a/packages/shex-cli/test/cli/1dotOr2dot.json +++ b/packages/shex-cli/test/cli/1dotOr2dot.json @@ -4,6 +4,8 @@ "shapes": [ { "id": "http://a.example/S1", + "type": "ShapeDecl", + "shapeExpr": { "type": "Shape", "expression": { "type": "OneOf", @@ -27,7 +29,7 @@ } ] } - } + } } ] } diff --git a/packages/shex-webapp/doc/ShExRSchema.js b/packages/shex-webapp/doc/ShExRSchema.js index 197bbef07..339e79374 100644 --- a/packages/shex-webapp/doc/ShExRSchema.js +++ b/packages/shex-webapp/doc/ShExRSchema.js @@ -1,207 +1,212 @@ var ShExRSchema = `PREFIX sx: PREFIX xsd: PREFIX rdf: -BASE -start=@ +BASE +start=@<#Schema> - CLOSED { +<#Schema> CLOSED { a [sx:Schema] ; - sx:imports @? ; - sx:startActs @? ; - sx:start @ ? ; - sx:shapes @* + sx:imports @<#IriList1Plus> ? ; + sx:startActs @<#SemActList1Plus> ? ; + sx:start @<#shapeDeclOrExpr> ? ; + sx:shapes @<#ShapeDeclList1Plus> ? } -# is a shortcut for always requriing a ShapeDecl - @ OR @ +# <#shapeDeclOrExpr> is a shortcut for always requriing a ShapeDecl +<#shapeDeclOrExpr> @<#ShapeDecl> OR @<#shapeExpr> - CLOSED { +<#ShapeDecl> CLOSED { a [sx:ShapeDecl] ; sx:abstract [true false]? ; - sx:shapeExpr @ + sx:shapeExpr @<#shapeExpr> } - @ OR @ OR @ OR @ OR @ OR @ +<#shapeExpr> @<#ShapeOr> OR @<#ShapeAnd> OR @<#ShapeNot> OR @<#NodeConstraint> OR @<#Shape> OR @<#ShapeExternal> - CLOSED { +<#ShapeOr> CLOSED { a [sx:ShapeOr] ; - sx:shapeExprs @ + sx:shapeExprs @<#shapeDeclOrExprList2Plus> } - CLOSED { +<#ShapeAnd> CLOSED { a [sx:ShapeAnd] ; - sx:shapeExprs @ + sx:shapeExprs @<#shapeDeclOrExprList2Plus> } - CLOSED { +<#ShapeNot> CLOSED { a [sx:ShapeNot] ; - sx:shapeExpr @ + sx:shapeExpr @<#shapeDeclOrExpr> } - CLOSED { +<#NodeConstraint> CLOSED { a [sx:NodeConstraint] ; - sx:nodeKind [sx:iri sx:bnode sx:literal sx:nonliteral]?; + sx:nodeKind [sx:iri sx:bnode sx:literal sx:nonliteral] ? ; sx:datatype IRI ? ; - & ; - sx:values @? + &<#xsFacets> ; + sx:values @<#valueSetValueList1Plus> ? } - CLOSED { +<#Shape> CLOSED { a [sx:Shape] ; - sx:extends @? ; - sx:closed [true false]? ; - sx:extra IRI* ; - sx:expression @? ; - sx:semActs @? ; - sx:annotation @? ; + sx:extends @<#shapeDeclOrExprList1Plus>? ; + sx:closed [true false] ? ; + sx:extra IRI * ; + sx:expression @<#tripleExpression> ? ; + sx:semActs @<#SemActList1Plus> ? ; + sx:annotation @<#AnnotationList1Plus> ? } - CLOSED { - a [sx:ShapeExternal] ; +<#ShapeExternal> CLOSED { + a [sx:ShapeExternal] } - CLOSED { +<#SemAct> CLOSED { a [sx:SemAct] ; sx:name IRI ; - sx:code xsd:string? + sx:code xsd:string ? } - CLOSED { +<#Annotation> CLOSED { a [sx:Annotation] ; sx:predicate IRI ; - sx:object @ + sx:object @<#objectValue> } -# @ OR @ - { # hold labeled productions - $ ( & | & )* ; - $ ( +# <#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? - ); - $ ( - sx:mininclusive @ - | sx:minexclusive @ - | sx:maxinclusive @ - | sx:maxexclusive @ + | sx:pattern xsd:string ; sx:flags xsd:string ? + ) ; + $<#numericFacet> ( + sx:mininclusive @<#numericLiteral> + | sx:minexclusive @<#numericLiteral> + | sx:maxinclusive @<#numericLiteral> + | sx:maxexclusive @<#numericLiteral> | sx:totaldigits xsd:integer | sx:fractiondigits xsd:integer ) } - xsd:integer OR xsd:decimal OR xsd:double - - @ OR @ OR @ - OR @ OR @ - OR @ OR @ OR @ - IRI OR LITERAL # rdf:langString breaks on Annotation.object - CLOSED { a [sx:Language]; sx:languageTag xsd:string } - CLOSED { a [sx:IriStem]; sx:stem xsd:string } - CLOSED { - a [sx:IriStemRange]; - sx:stem xsd:string OR @; - sx:exclusion @ -} - CLOSED { a [sx:LiteralStem]; sx:stem xsd:string } - CLOSED { - a [sx:LiteralStemRange]; - sx:stem xsd:string OR @; - sx:exclusion @ -} - CLOSED { a [sx:LanguageStem]; sx:stem xsd:string } - CLOSED { - a [sx:LanguageStemRange]; - sx:stem xsd:string OR @; - sx:exclusion @ -} - BNODE CLOSED { +<#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 { + a [sx:IriStemRange] ; + sx:stem xsd:string OR @<#Wildcard> ; + sx:exclusion @<#IriStemExclusionList1Plus> +} +<#LiteralStem> CLOSED { a [sx:LiteralStem] ; sx:stem xsd:string } +<#LiteralStemRange> CLOSED { + a [sx:LiteralStemRange] ; + sx:stem xsd:string OR @<#Wildcard> ; + sx:exclusion @<#LiteralStemExclusionList1Plus> +} +<#LanguageStem> CLOSED { a [sx:LanguageStem] ; sx:stem xsd:string } +<#LanguageStemRange> CLOSED { + a [sx:LanguageStemRange] ; + sx:stem xsd:string OR @<#Wildcard> ; + sx:exclusion @<#LanguageStemExclusionList1Plus> +} +<#Wildcard> BNODE CLOSED { a [sx:Wildcard] } - @ OR @ OR @ OR CLOSED { } +<#tripleExpression> @<#TripleConstraint> OR @<#OneOf> OR @<#EachOf> OR CLOSED { } - CLOSED { +<#OneOf> CLOSED { a [sx:OneOf] ; - sx:min xsd:integer? ; - sx:max xsd:integer? ; - sx:expressions @ ; - sx:semActs @? ; - sx:annotation @? + sx:min xsd:integer ? ; + sx:max xsd:integer ? ; + sx:expressions @<#tripleExpressionList2Plus> ; + sx:semActs @<#SemActList1Plus> ? ; + sx:annotation @<#AnnotationList1Plus> ? } - CLOSED { +<#EachOf> CLOSED { a [sx:EachOf] ; - sx:min xsd:integer? ; - sx:max xsd:integer? ; - sx:expressions @ ; - sx:semActs @? ; - sx:annotation @? + sx:min xsd:integer ? ; + sx:max xsd:integer ? ; + sx:expressions @<#tripleExpressionList2Plus> ; + sx:semActs @<#SemActList1Plus> ? ; + sx:annotation @<#AnnotationList1Plus> ? } - CLOSED { - rdf:first @ ; - rdf:rest @ +<#tripleExpressionList2Plus> CLOSED { + rdf:first @<#tripleExpression> ; + rdf:rest @<#tripleExpressionList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest [rdf:nil] OR @ +<#tripleExpressionList1Plus> CLOSED { + rdf:first @<#tripleExpression> ; + rdf:rest [rdf:nil] OR @<#tripleExpressionList1Plus> } - CLOSED { +<#TripleConstraint> CLOSED { a [sx:TripleConstraint] ; - sx:inverse [true false]? ; - sx:negated [true false]? ; - sx:min xsd:integer? ; - sx:max xsd:integer? ; + sx:inverse [true false] ? ; + sx:negated [true false] ? ; + sx:min xsd:integer ? ; + sx:max xsd:integer ? ; sx:predicate IRI ; - sx:valueExpr @? ; - sx:semActs @? ; - sx:annotation @? + sx:valueExpr @<#shapeDeclOrExpr> ? ; + sx:semActs @<#SemActList1Plus> ? ; + sx:annotation @<#AnnotationList1Plus> ? } - CLOSED { +<#IriList1Plus> CLOSED { rdf:first IRI ; - rdf:rest [rdf:nil] OR @ + rdf:rest [rdf:nil] OR @<#IriList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest [rdf:nil] OR @ +<#SemActList1Plus> CLOSED { + rdf:first @<#SemAct> ; + rdf:rest [rdf:nil] OR @<#SemActList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest @ +<#ShapeDeclList1Plus> CLOSED { + rdf:first @<#ShapeDecl> ; + rdf:rest [rdf:nil] OR @<#ShapeDeclList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest [rdf:nil] OR @ + +<#shapeDeclOrExprList2Plus> CLOSED { + rdf:first @<#shapeDeclOrExpr> ; + rdf:rest @<#shapeDeclOrExprList1Plus> +} +<#shapeDeclOrExprList1Plus> CLOSED { + rdf:first @<#shapeDeclOrExpr> ; + rdf:rest [rdf:nil] OR @<#shapeDeclOrExprList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest [rdf:nil] OR @ +<#valueSetValueList1Plus> CLOSED { + rdf:first @<#valueSetValue> ; + rdf:rest [rdf:nil] OR @<#valueSetValueList1Plus> } - CLOSED { - rdf:first @ ; - rdf:rest [rdf:nil] OR @ +<#AnnotationList1Plus> CLOSED { + rdf:first @<#Annotation> ; + rdf:rest [rdf:nil] OR @<#AnnotationList1Plus> } - CLOSED { - rdf:first IRI OR @ ; - rdf:rest [rdf:nil] OR @ +<#IriStemExclusionList1Plus> CLOSED { + rdf:first IRI OR @<#IriStem> ; + rdf:rest [rdf:nil] OR @<#IriStemExclusionList1Plus> } - CLOSED { - rdf:first xsd:string OR @ ; - rdf:rest [rdf:nil] OR @ +<#LiteralStemExclusionList1Plus> CLOSED { + rdf:first xsd:string OR @<#LiteralStem> ; + rdf:rest [rdf:nil] OR @<#LiteralStemExclusionList1Plus> } - CLOSED { - rdf:first xsd:string OR @ ; - rdf:rest [rdf:nil] OR @ +<#LanguageStemExclusionList1Plus> CLOSED { + rdf:first xsd:string OR @<#LanguageStem> ; + rdf:rest [rdf:nil] OR @<#LanguageStemExclusionList1Plus> } `; diff --git a/packages/shex-webapp/examples/ClinObs.json b/packages/shex-webapp/examples/ClinObs.json index 624f48451..aefff2773 100644 --- a/packages/shex-webapp/examples/ClinObs.json +++ b/packages/shex-webapp/examples/ClinObs.json @@ -4,8 +4,10 @@ "start": "http://schema.example/ObservationShape", "shapes": [ { - "type": "Shape", + "type": "ShapeDecl", "id": "http://schema.example/ObservationShape", + "shapeExpr": { + "type": "Shape", "expression": { "type": "EachOf", "expressions": [ @@ -27,10 +29,12 @@ } ] } - }, + } }, { - "type": "Shape", + "type": "ShapeDecl", "id": "http://schema.example/PatientShape", + "shapeExpr": { + "type": "Shape", "expression": { "type": "EachOf", "expressions": [ @@ -54,6 +58,6 @@ } ] } - } + } } ] } diff --git a/packages/shex-webapp/examples/ClinObs.ttl b/packages/shex-webapp/examples/ClinObs.ttl index a317ed82e..e357db8be 100644 --- a/packages/shex-webapp/examples/ClinObs.ttl +++ b/packages/shex-webapp/examples/ClinObs.ttl @@ -12,6 +12,8 @@ PREFIX sx: ) . # An Observation has: + a sx:ShapeDecl ; + sx:shapeExpr [ a sx:Shape ; sx:expression [ a sx:EachOf ; @@ -33,9 +35,11 @@ PREFIX sx: sx:valueExpr ] ) - ] . + ] ] . # A Patient has: + a sx:ShapeDecl ; + sx:shapeExpr [ a sx:Shape ; sx:expression [ a sx:EachOf ; @@ -61,4 +65,4 @@ PREFIX sx: ] ] ) - ] . + ] ] .