Here is the current draft of an export in ShEx format. SHACL is also below. For contrast see also the last version of something close to the schemarama codebase (albeit not guaranteed to run right now):
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .
@prefix sx: <http://www.w3.org/ns/shex#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
[] a sx:Schema ;
sx:shapes [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max 1 ;
sx:min 1 ;
sx:predicate schema:url ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:semActs ( [ a sx:SemAct ;
sx:code "console.log('some url checking code here')" ;
sx:name <https://google.com/search/validation/valid-url> ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max 1 ;
sx:min 1 ;
sx:predicate schema:claimReviewed ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:itemReviewed ;
sx:valueExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:CreativeWork ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Claim ) ] ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:CreativeWork ) ] ] ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:author ;
sx:valueExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max 1 ;
sx:min 0 ;
sx:predicate schema:name ] ] ) ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:datePublished ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:semActs ( [ a sx:SemAct ;
sx:code "console.log('some datetime checking code here')" ;
sx:name <https://google.com/search/validation/valid-date-time> ] ) ] ] ] ) ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Claim ) ] ] ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:appearance ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:firstAppearance ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:appearance ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:firstAppearance ] ] ) ] ) ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:appearance ;
sx:valueExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:NodeConstraint ;
sx:pattern "https?://.*" ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:CreativeWork ) ] ] ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:firstAppearance ;
sx:valueExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:NodeConstraint ;
sx:pattern "https?://.*" ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:CreativeWork ) ] ] ] ) ] ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:author ;
sx:valueExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max 1 ;
sx:min 0 ;
sx:predicate schema:name ] ] ) ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:datePublished ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:semActs ( [ a sx:SemAct ;
sx:code "console.log('some datetime checking code here')" ;
sx:name <https://google.com/search/validation/valid-date-time> ] ) ] ] ] ) ] ) ] ) ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:author ;
sx:valueExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Organization ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Person ) ] ] ] ) ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:name ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:url ] ] ) ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:name ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:url ] ] ) ] ) ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:url ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:semActs ( [ a sx:SemAct ;
sx:code "console.log('some url checking code here')" ;
sx:name <https://google.com/search/validation/valid-url> ] ) ] ] ] ) ] ) ] ) ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:reviewRating ;
sx:valueExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Rating ) ] ] ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:predicate rdf:type ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:values ( schema:Rating ) ] ] ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max 1 ;
sx:min 0 ;
sx:predicate schema:alternateName ] ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:name ] ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:alternateName ] ] ) ] [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:alternateName ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:name ] ] ) ] ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:ratingValue ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:bestRating ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:worstRating ] ] ) ] [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:ratingValue ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:pattern "-1" ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:bestRating ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:pattern "-1" ] ] ] [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:worstRating ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:pattern "-1" ] ] ] ) ] ] ) ] ] [ a sx:ShapeAnd ;
sx:shapeExprs ( [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 0 ;
sx:predicate schema:ratingValue ;
sx:valueExpr [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:NodeConstraint ;
sx:pattern "(\\d+[\\.,]?\\d*)/(\\d+[\\.,]?\\d*)" ] [ a sx:NodeConstraint ;
sx:pattern "(\\d+[\\.,]?\\d*)%" ] [ a sx:NodeConstraint ;
sx:pattern "(\\d+[\\.,]?\\d*)" ] ) ] ] ] [ a sx:ShapeOr ;
sx:shapeExprs ( [ a sx:ShapeNot ;
sx:shapeExpr [ a sx:Shape ;
sx:expression [ a sx:TripleConstraint ;
sx:max -1 ;
sx:min 1 ;
sx:predicate schema:ratingValue ;
sx:valueExpr [ a sx:NodeConstraint ;
sx:pattern "(\\d+[\\.,]?\\d*)" ] ] ] ] [ a sx:Shape ;
sx:expression [ a sx:SemAct ;
sx:name <https://google.com/search/validation/valid-rating> ] ] ) ] ) ] ) ] ) ] ) ] ) ] ] ] ) ] .
Here is the corresponding SHACL. The internal representation is very similar and has a few other constructs:
@ericprud @rrlevering
Here is the current draft of an export in ShEx format. SHACL is also below. For contrast see also the last version of something close to the schemarama codebase (albeit not guaranteed to run right now):
Here is the corresponding SHACL. The internal representation is very similar and has a few other constructs: