@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix lfal: <https://www.mpeters.dev/ns/lfal#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix elm: <http://data.europa.eu/snb/model/elm/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix schema: <https://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# SHACL companion to shapes/session.shex — see SOLID_DATA_MODEL.md §2, §3 (sessions/<id>.ttl,
# sessions-index.ttl). Main subject of a session resource is <#it>.

lfal:SessionShape
  a sh:NodeShape ;
  sh:targetClass elm:LearningAssessment ;
  sh:name "Learning session" ;
  sh:description "An ELM assessment of a test/homework/practice attempt: source, findings, and any attached evidence." ;
  sh:property
    [ sh:path dcterms:identifier ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:title ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:created ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:modified ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:description ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path elm:educationSubject ; sh:nodeKind sh:IRI ] ,
    [ sh:path dcterms:subject ; sh:node lfal:SessionTopicShape ] ,
    [ sh:path lfal:hasFinding ; sh:node lfal:SessionOutcomeShape ] ,
    [ sh:path schema:associatedMedia ; sh:node lfal:SessionAttachmentShape ] .

lfal:SessionTopicShape
  a sh:NodeShape ;
  sh:targetClass skos:Concept ;
  sh:name "Session topic" ;
  sh:description "One of the topics a learning session's findings are filed under, ordered by lfal:order." ;
  sh:property
    [ sh:path skos:prefLabel ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path lfal:order ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] .

lfal:SessionOutcomeShape
  a sh:NodeShape ;
  sh:targetClass elm:LearningOutcome ;
  sh:name "Session outcome" ;
  sh:description "A single finding from a session: a strength, weakness, next step, or common error." ;
  sh:property
    [ sh:path dcterms:type ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:title ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path lfal:order ; sh:datatype xsd:integer ; sh:minCount 1 ; sh:maxCount 1 ] .

lfal:SessionAttachmentShape
  a sh:NodeShape ;
  sh:targetClass schema:MediaObject ;
  sh:name "Session attachment" ;
  sh:description "A binary attachment (image or PDF) linked as evidence from a learning session." ;
  sh:property
    [ sh:path dcterms:identifier ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:created ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path schema:encodingFormat ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path schema:name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path schema:contentUrl ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] .

lfal:SessionMetaShape
  a sh:NodeShape ;
  sh:targetClass elm:LearningAssessment ;
  sh:name "Session metadata (index)" ;
  sh:description "Narrower projection of SessionShape used by sessions-index.ttl — the rebuildable subgraph union of session metadata across all sessions." ;
  sh:property
    [ sh:path dcterms:identifier ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:title ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:created ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:modified ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] .
