@prefix ci: <https://catholicintelligence.com/ontology#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix shape: <https://catholicintelligence.com/ontology?format=shacl#> .

# Validation describes the collection profile, not the Church's canon law.
# Run semantic review after this structural check; conformity never means truth.
shape:SourceSnapshotShape a sh:NodeShape ;
  sh:targetClass ci:SourceSnapshot ;
  sh:property [ sh:path ci:sourceDocument ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:contentHash ; sh:datatype xsd:string ; sh:pattern "^[a-f0-9]{64}$" ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:retrievedAt ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] .

shape:EvidenceClaimShape a sh:NodeShape ;
  sh:targetClass ci:EvidenceClaim ;
  sh:nodeKind sh:IRI ;
  sh:property [ sh:path ci:claimSubject ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:claimPredicate ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:basedOnSnapshot ; sh:nodeKind sh:IRI ; sh:class ci:SourceSnapshot ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:evidenceQuote ; sh:datatype xsd:string ; sh:minLength 1 ; sh:maxLength 500 ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:property [ sh:path ci:claimStatus ; sh:in ( "proposed" "reviewed" "disputed" "rejected" ) ; sh:minCount 1 ; sh:maxCount 1 ] ;
  sh:xone (
    [ sh:property [ sh:path ci:literalValue ; sh:datatype xsd:string ; sh:minLength 1 ; sh:maxLength 2000 ; sh:minCount 1 ; sh:maxCount 1 ] ;
      sh:property [ sh:path ci:resourceValue ; sh:maxCount 0 ] ]
    [ sh:property [ sh:path ci:resourceValue ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ] ;
      sh:property [ sh:path ci:literalValue ; sh:maxCount 0 ] ]
  ) ;
  sh:or (
    [ sh:property [ sh:path ci:claimStatus ; sh:in ( "proposed" "disputed" "rejected" ) ] ;
      sh:property [ sh:path ci:reviewedBy ; sh:maxCount 0 ] ;
      sh:property [ sh:path ci:reviewedAt ; sh:maxCount 0 ] ]
    [ sh:property [ sh:path ci:claimStatus ; sh:hasValue "reviewed" ] ;
      sh:property [ sh:path ci:reviewedBy ; sh:datatype xsd:string ; sh:minLength 1 ; sh:minCount 1 ; sh:maxCount 1 ] ;
      sh:property [ sh:path ci:reviewedAt ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ] ]
  ) .
