[Application-profiles-ig] ShEx JSON proposal for DSP

Eric Prud'hommeaux eric at w3.org
Fri Aug 30 11:17:51 BST 2019


Tom and I worked out a quick subset of ShExJ to meet apparent (simple) DSP requirements. Let's call it ShExJ-Lite. It is valid JSON-LD: "@context": "http://www.w3.org/ns/shex.jsonld" This subset captures, for example, this ShExC: [[ PREFIX dc: <http://purl.org/dc/terms/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> BASE <http://a.example/schema> <#book> { dc:title xsd:string ; dc:creator @<#person>+ ; } <#person> { foaf:name xsd:string+ ; foaf:homepage IRI? } ]] (See below for the proposed ShExJ-Lite equivalent.) Here's the ShExJ-Lite grammar: Schema { start:shapeExpr? shapes:[shapeExpr+]? } shapeExpr = NodeConstraint | Shape ; shapeExprLabel = IRIREF | BNODE ; NodeConstraint { id:shapeExprLabel nodeKind:("iri" | "bnode" | "nonliteral" | "literal")? datatype:IRIREF? numericFacet* values:[valueSetValue]? } numericFacet = (mininclusive|minexclusive|maxinclusive|maxexclusive):numericLiteral numericLiteral = INTEGER | DECIMAL | DOUBLE ; valueSetValue = objectValue | IriStem ; objectValue = IRIREF | ObjectLiteral ; ObjectLiteral { value:STRING language:STRING? type:STRING? } IriStem { stem:IRIREF } Shape { id:shapeExprLabel expression:tripleExpr} tripleExpr = EachOf | TripleConstraint ; EachOf { expressions:[tripleExpr} TripleConstraint { predicate:IRIREF valueExpr:shapeExpr? min:INTEGER? max: INTEGER} and here's the ShExJ representation of the simple book schema above: { "type": "Schema", "@context": "http://www.w3.org/ns/shex.jsonld", "shapes": [ { "type": "Shape", "id": "http://a.example/schema#book", "expression": { "type": "EachOf", "expressions": [ { "type": "TripleConstraint", "predicate": "http://purl.org/dc/terms/title", "valueExpr": { "type": "NodeConstraint", "datatype": "http://www.w3.org/2001/XMLSchema#string" } }, { "type": "TripleConstraint", "predicate": "http://purl.org/dc/terms/creator”、“valueExpr”:“http://a.example/schema#person", "min": 1, "max": -1 } ] } }, { "type": "Shape", "id": "http://a.example/schema#person", "expression": { "type": "EachOf", "expressions": [ { "type": "TripleConstraint", "predicate": "http://xmlns.com/foaf/0.1/name", "valueExpr": { "type": "NodeConstraint", "datatype": "http://www.w3.org/2001/XMLSchema#string" }, "min": 1, "max": -1 }, { "type": "TripleConstraint", "predicate": "http://xmlns.com/foaf/0.1/homepage", "valueExpr": { "type": "NodeConstraint", "nodeKind": "iri" }, "min": 0, "max": 1 } ] } } ] } -- -ericP


More information about the Application-profiles-ig mailing list