# Harbor Path website-leads board SHACL — Turtle twin of shapes in leads-report.jsonld
# https://demo.networkforrecovery.com/data/leads-report.jsonld
# https://demo.networkforrecovery.com/leads-report/

@prefix sh:     <http://www.w3.org/ns/shacl#> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .
@prefix schema: <https://schema.org/> .
@prefix rpt:    <https://incins.com/ns/rpt#> .

rpt:ReportShape
  a sh:NodeShape ;
  sh:name "Leads board report" ;
  sh:description "A board is a named report with at least one widget part and a SPARQL endpoint." ;
  sh:targetClass rpt:Report ;
  sh:property [
    sh:path schema:name ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:message "Report needs a name." ;
  ] ;
  sh:property [
    sh:path schema:hasPart ;
    sh:minCount 1 ;
    sh:message "Report needs at least one widget." ;
  ] ;
  sh:property [
    sh:path rpt:endpoint ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:message "Report needs a SPARQL endpoint." ;
  ] ;
  sh:property [
    sh:path rpt:formula ;
    sh:maxCount 1 ;
  ] .

rpt:QueryShape
  a sh:NodeShape ;
  sh:name "Leads board query" ;
  sh:targetClass rpt:Query ;
  sh:property [
    sh:path schema:name ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:message "Query needs a name." ;
  ] ;
  sh:property [
    sh:path rpt:sparql ;
    sh:minCount 1 ;
    sh:message "Query needs SPARQL." ;
  ] .

rpt:WidgetShape
  a sh:NodeShape ;
  sh:name "Leads board widget" ;
  sh:targetClass rpt:Widget ;
  sh:property [
    sh:path schema:name ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:message "Widget needs a name." ;
  ] ;
  sh:property [
    sh:path rpt:kind ;
    sh:in ( "kpi" "trend" "bars" "table" ) ;
    sh:minCount 1 ;
    sh:message "kind must be kpi, trend, bars, or table." ;
  ] ;
  sh:property [
    sh:path rpt:query ;
    sh:nodeKind sh:IRI ;
    sh:minCount 1 ;
    sh:message "Widget must point at a Query IRI." ;
  ] ;
  sh:property [
    sh:path rpt:order ;
    sh:datatype xsd:integer ;
    sh:minCount 1 ;
    sh:message "Widget needs an integer order." ;
  ] ;
  sh:or (
    [
      sh:property [ sh:path rpt:kind ; sh:hasValue "kpi" ] ;
      sh:property [ sh:path rpt:valueVar ; sh:minCount 1 ] ;
      sh:property [ sh:path rpt:format ; sh:in ( "currency" "integer" ) ; sh:minCount 1 ] ;
    ]
    [
      sh:property [ sh:path rpt:kind ; sh:in ( "trend" "bars" ) ] ;
      sh:property [ sh:path rpt:labelVar ; sh:minCount 1 ] ;
      sh:property [ sh:path rpt:valueVar ; sh:minCount 1 ] ;
    ]
    [
      sh:property [ sh:path rpt:kind ; sh:hasValue "table" ] ;
      sh:property [ sh:path rpt:columns ; sh:minCount 1 ] ;
    ]
  ) .

rpt:TalkingPointShape
  a sh:NodeShape ;
  sh:name "Admissions talking point" ;
  sh:targetClass rpt:TalkingPoint ;
  sh:property [
    sh:path schema:name ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;
  sh:property [
    sh:path rpt:pitch ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
  ] ;
  sh:property [
    sh:path schema:position ;
    sh:datatype xsd:integer ;
    sh:minCount 1 ;
  ] .
