PREFIX ex:<http://ex.example/#>
PREFIX foaf:<http://xmlns.com/foaf/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rs:<http://open-services.net/ns/core#>
PREFIX se:<http://www.w3.org/2013/ShEx/Definition#>
PREFIX shex:<http://www.w3.org/2013/ShEx/ns#>
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
<IssueShape> a rs:ResourceShape ;
    rs:property [
        rs:name "state" ;
        rs:propertyDefinition ex:state ;
        rs:allowedValue <http://ex.example/#unassigned> , <http://ex.example/#assigned> ;
        rs:occurs rs:Exactly-one ;
    ] ;
    rs:property [
        rs:name "reportedBy" ;
        rs:propertyDefinition ex:reportedBy ;
        rs:valueShape <UserShape> ;
        rs:occurs rs:Exactly-one ;
    ] ;
    rs:property [
        rs:name "reportedOn" ;
        rs:propertyDefinition ex:reportedOn ;
        rs:valueType xsd:dateTime ;
        rs:occurs rs:Exactly-one ;
        se:extension [
            se:label "js" ;
            se:action """ report = _.o; return true; """
        ] ;
    ] ;
    se:ruleGroup [
        rs:occurs rs:Zero-or-one ;
        rs:property [
            rs:name "reproducedBy" ;
            rs:propertyDefinition ex:reproducedBy ;
            rs:valueShape <EmployeeShape> ;
            rs:occurs rs:Exactly-one ;
        ] ;
        rs:property [
            rs:name "reproducedOn" ;
            rs:propertyDefinition ex:reproducedOn ;
            rs:valueType xsd:dateTime ;
            rs:occurs rs:Exactly-one ;
            se:extension [
                se:label "js" ;
                se:action """ return _.o.lex > report.lex; """
            ] ;
            se:extension [
                se:label "sparql" ;
                se:action """ ?s ex:reportedOn ?rpt . FILTER (?o > ?rpt) """
            ] ;
        ] ;
    ] ;
    rs:property [
        rs:name "related" ;
        rs:propertyDefinition ex:related ;
        rs:valueShape <IssueShape> ;
        rs:occurs rs:Zero-or-many ;
    ] ;
 .
<UserShape> a rs:ResourceShape ;
    rs:choice [
        rs:property [
            rs:name "name" ;
            rs:propertyDefinition foaf:name ;
            rs:valueType xsd:string ;
            rs:occurs rs:Exactly-one ;
        ] ;
        se:ruleGroup [
            rs:property [
                rs:name "givenName" ;
                rs:propertyDefinition foaf:givenName ;
                rs:valueType xsd:string ;
                rs:occurs rs:One-or-many ;
            ] ;
            rs:property [
                rs:name "familyName" ;
                rs:propertyDefinition foaf:familyName ;
                rs:valueType xsd:string ;
                rs:occurs rs:Exactly-one ;
            ] ;
        ] ;
    ] ;
    rs:property [
        rs:name "mbox" ;
        rs:propertyDefinition foaf:mbox ;
        rs:valueType shex:IRI ;
        rs:occurs rs:Exactly-one ;
    ] ;
 .
<EmployeeShape> a rs:ResourceShape ;
    rs:property [
        rs:name "givenName" ;
        rs:propertyDefinition foaf:givenName ;
        rs:valueType xsd:string ;
        rs:occurs rs:One-or-many ;
    ] ;
    rs:property [
        rs:name "familyName" ;
        rs:propertyDefinition foaf:familyName ;
        rs:valueType xsd:string ;
        rs:occurs rs:Exactly-one ;
    ] ;
    rs:property [
        rs:name "phone" ;
        rs:propertyDefinition foaf:phone ;
        rs:valueType shex:IRI ;
        rs:occurs rs:Zero-or-many ;
    ] ;
    rs:property [
        rs:name "mbox" ;
        rs:propertyDefinition foaf:mbox ;
        rs:valueType shex:IRI ;
        rs:occurs rs:Exactly-one ;
    ] ;
 .
