#BASE <http://base.example/#>
PREFIX ex: <http://ex.example/#>
PREFIX foaf: <http://xmlns.com/foaf/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX js: <http://shexspec.github.io/extensions/js/>
PREFIX sparql: <http://shexspec.github.io/extensions/sparql/>

start = <IssueShape>

<IssueShape> {
    ex:state (ex:unassigned ex:assigned),
    ex:reportedBy @<UserShape>,
    ex:reportedOn xsd:dateTime
        %js:{ report = _.o; return true; %},
    (ex:reproducedBy @<EmployeeShape>,
     ex:reproducedOn xsd:dateTime
    )
        %js:{ return _[1].triple.o.lex > report.lex; %}
        %sparql:{ ?s ex:reportedOn ?rpt . FILTER (?o > ?rpt) %},
    ex:related @<IssueShape>*
}

<UserShape> {
    (foaf:name xsd:string
     | foaf:givenName xsd:string+,
       foaf:familyName xsd:string),
    foaf:mbox IRI
}

<EmployeeShape> {
    foaf:givenName xsd:string+,
    foaf:familyName xsd:string,
    foaf:phone IRI*,
    foaf:mbox IRI
}

