JSON-LD context { "@context": "http://www.w3.org/ns/shex.jsonld" }
Schema | { | start:shapeExpr? shapes:[shapeExpr+]? } |
---|---|---|
shapeExpr | = | NodeConstraint | Shape ; |
shapeExprLabel | = | IRIREF ; |
NodeConstraint | { | 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:IRIREF? } |
IriStem | { | stem:IRIREF } |
Shape | { | closed:BOOL? expression:tripleExpr} |
tripleExpr | = | EachOf | TripleConstraint ; |
EachOf | { | expressions:[TripleConstraint{2,}]} |
TripleConstraint | { | predicate:IRIREF valueExpr:shapeExpr? min:INTEGER? max:INTEGER?} |
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? }
{ "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 } ] } } ] }