@prefix hdip: <https://specs.kivanura.org/hdip/gedra-profile/0.1#> .
@prefix gedra: <https://specs.kivanura.org/gedra#> .
@prefix gedrm: <https://specs.kivanura.org/gedrm#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

<https://specs.kivanura.org/gedra/0.1/profiles/hdip/0.1/shacl> a owl:Ontology ;
  dcterms:title "HDIP GEDRA Reference Profile 0.1 SHACL" ;
  dcterms:hasVersion "0.1" .

hdip:ProfileParentShape a sh:NodeShape ;
  sh:targetNode <https://specs.kivanura.org/gedra/0.1/profiles/hdip/0.1> ;
  dcterms:identifier "HDIP-C-001" ;
  sh:property [
    sh:path gedra:profileOf ;
    sh:hasValue <https://specs.kivanura.org/gedra/0.1> ;
    sh:message "HDIP-C-001: HDIP reference profile must bind exactly to GEDRA 0.1."
  ] .

hdip:ADSSpecializationShape a sh:NodeShape ;
  sh:targetNode hdip:AuthorizedDataSource ;
  dcterms:identifier "HDIP-C-002" ;
  sh:property [ sh:path rdfs:subClassOf ; sh:hasValue gedrm:AuthoritativeSource ;
    sh:message "HDIP-C-002: ADS must specialize GEDRM Authoritative Source." ] .

hdip:ADOSpecializationShape a sh:NodeShape ;
  sh:targetNode hdip:AuthorizedDataOriginator ;
  dcterms:identifier "HDIP-C-006" ;
  sh:property [ sh:path rdfs:subClassOf ; sh:hasValue gedrm:DataOriginator ;
    sh:message "HDIP-C-006: ADO, if present, must specialize GEDRM Data Originator." ] .

hdip:ADDSpecializationShape a sh:NodeShape ;
  sh:targetNode hdip:AuthorizedDataDistributor ;
  dcterms:identifier "HDIP-C-004" ;
  sh:property [ sh:path rdfs:subClassOf ; sh:hasValue gedrm:DataDistributor ;
    sh:message "HDIP-C-004: ADD must specialize GEDRM Data Distributor." ] .

hdip:HDIPDataProductSpecializationShape a sh:NodeShape ;
  sh:targetNode hdip:HDIPDataProduct ;
  sh:property [ sh:path rdfs:subClassOf ; sh:hasValue gedrm:DataProduct ;
    sh:message "HDIP Data Product must specialize GEDRM Data Product." ] .

hdip:ADSNotSoRShape a sh:NodeShape ;
  sh:targetClass gedra:TerminologyMapping ;
  dcterms:identifier "HDIP-C-003" ;
  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "HDIP-C-003: ADS must not be declared equivalent to System of Record." ;
    sh:select """
      PREFIX gedra: <https://specs.kivanura.org/gedra#>
      PREFIX gedrm: <https://specs.kivanura.org/gedrm#>
      SELECT $this WHERE {
        $this gedra:localTerm "ADS" ; gedra:mappingType "equivalent" ; gedra:targetConcept gedrm:SystemOfRecord .
      }
    """
  ] .

hdip:ADDNotAuthorityShape a sh:NodeShape ;
  sh:targetClass gedra:TerminologyMapping ;
  dcterms:identifier "HDIP-C-005" ;
  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "HDIP-C-005: ADD must not be declared equivalent to Authoritative Source." ;
    sh:select """
      PREFIX gedra: <https://specs.kivanura.org/gedra#>
      PREFIX gedrm: <https://specs.kivanura.org/gedrm#>
      SELECT $this WHERE {
        $this gedra:localTerm "ADD" ; gedra:mappingType "equivalent" ; gedra:targetConcept gedrm:AuthoritativeSource .
      }
    """
  ] .

hdip:C3ExactProfileVersionShape a sh:NodeShape ;
  sh:targetClass gedra:ConformanceClaim ;
  dcterms:identifier "HDIP-C-008" ;
  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "HDIP-C-008: HDIP C3 claim must bind the exact HDIP reference profile version 0.1." ;
    sh:select """
      PREFIX gedra: <https://specs.kivanura.org/gedra#>
      SELECT $this WHERE {
        $this gedra:claimsConformanceLevel gedra:ProfiledConformance .
        FILTER EXISTS { $this gedra:appliesProfile ?p . }
        FILTER NOT EXISTS { ?p <https://specs.kivanura.org/hdip/gedra-profile/0.1#version> "0.1" . }
      }
    """
  ] .

hdip:NoAILeakShape a sh:NodeShape ;
  sh:targetNode <https://specs.kivanura.org/gedra/0.1/profiles/hdip/0.1> ;
  dcterms:identifier "HDIP-C-009" ;
  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "HDIP-C-009: AI Product / Intelligence-specific constructs must not be introduced into this data-side reference profile baseline." ;
    sh:select """
      PREFIX hdip: <https://specs.kivanura.org/hdip/gedra-profile/0.1#>
      SELECT $this WHERE {
        VALUES ?forbidden { hdip:AIProduct hdip:FoundationModel hdip:InferenceActivity hdip:TrainingActivity hdip:Agent }
        ?forbidden ?p ?o .
      }
    """
  ] .

hdip:ProfileMappingTargetResolutionShape a sh:NodeShape ;
  sh:targetSubjectsOf gedra:mapsTo ;
  dcterms:identifier "HDIP-C-007" ;
  sh:sparql [
    a sh:SPARQLConstraint ;
    sh:message "HDIP-C-007: HDIP architectural profile mapping target must resolve to an allowed GEDRA 0.1 architectural construct." ;
    sh:select """
      PREFIX gedra: <https://specs.kivanura.org/gedra#>
      SELECT $this WHERE {
        $this gedra:mapsTo ?target .
        FILTER (?target NOT IN (
          gedra:SemanticEnterpriseOntologyPlane,
          gedra:AuthorityPlane,
          gedra:ProcessingProvisionMovementPlane,
          gedra:DataPlatformProductPlane,
          gedra:ConsumptionAccessPlane,
          gedra:ValueObservabilityFeedbackPlane,
          gedra:GovernanceAndControl,
          gedra:TechnologyUtilityFoundation
        ))
      }
    """
  ] .
