PREFIX sx: <http://www.w3.org/ns/shex#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

[] a sx:Schema ;
    sx:shapes (<http://a.example/A> <http://a.example/B>) .

<http://a.example/A> a sx:ShapeDecl ;
    sx:abstract true ;
    sx:shapeExpr [ a sx:ShapeAnd ;
        sx:shapeExprs (
            [ a sx:NodeConstraint ;
                sx:pattern "sA.........$"
            ]
            [ a sx:Shape ;
                sx:expression [ a sx:TripleConstraint ;
                    sx:predicate <http://a.example/p>  ;
                    sx:valueExpr [ a sx:NodeConstraint ;
                        sx:values (0 1 2 3 4 5 6 7 8 9)
                    ];
                    sx:min 1;
                    sx:max -1
                ]
            ]
        )
    ] .

<http://a.example/B> a sx:ShapeDecl ; sx:shapeExpr [ a sx:ShapeAnd ;
    sx:shapeExprs (
        <http://a.example/A>
        [ a sx:NodeConstraint ;
            sx:pattern "s.B........$"
        ]
        [ a sx:Shape ;
            sx:expression [ a sx:TripleConstraint ;
                sx:predicate <http://a.example/p>  ;
                sx:valueExpr [ a sx:NodeConstraint ;
                    sx:values (0 1 3 4 5 6 7 8 9)
                ];
                sx:min 1;
                sx:max -1
            ]
        ]
    ) ] .

