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

# SHACL companion to shapes/taxonomy.shex — see SOLID_DATA_MODEL.md §1 (taxonomy.ttl).
# sh:name / sh:description here are the source of truth surfaced in the Application
# Capability preview; keep the ShEx file authoritative for the actual runtime validation
# LDO codegen uses (package.json "build:ldo").

lfal:TaxonomySchemeShape
  a sh:NodeShape ;
  sh:targetClass skos:ConceptScheme ;
  sh:name "Taxonomy scheme" ;
  sh:description "Fixed marker subject of taxonomy.ttl: title and last-modified time for the whole domain/subdomain taxonomy." ;
  sh:property
    [ sh:path dcterms:title ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path dcterms:modified ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] .

lfal:TaxonomyConceptShape
  a sh:NodeShape ;
  sh:targetClass skos:Concept ;
  sh:name "Taxonomy concept" ;
  sh:description "A domain (skos:topConceptOf) or a subdomain at any depth (skos:broader to its parent concept), sorted by lfal:order within each level. dcterms:requires links to prerequisite concepts a learner should understand first." ;
  sh:property
    [ sh:path skos:prefLabel ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ] ,
    [ sh:path skos:topConceptOf ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] ,
    [ sh:path skos:broader ; sh:nodeKind sh:IRI ; sh:maxCount 1 ] ,
    [ sh:path skos:narrower ; sh:nodeKind sh:IRI ] ,
    [ sh:path lfal:order ; sh:datatype xsd:integer ; sh:maxCount 1 ] ,
    [ sh:path dcterms:requires ; sh:nodeKind sh:IRI ; sh:class skos:Concept ] .
