@prefix ae: <https://ontology.inferal.com/modules/artifact-evolution/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix prof: <http://www.w3.org/ns/dx/prof/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix role: <http://www.w3.org/ns/dx/prof/role/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ae:GovernedArtifactProfile
    a prof:Profile ;
    dcterms:title "Governed Artifact Evolution Profile"@en ;
    dcterms:description "Completeness constraints for exchanging a governed artifact-evolution lifecycle."@en ;
    prof:isProfileOf ae: ;
    prof:hasResource <https://ontology.inferal.com/modules/artifact-evolution/profiles/governed-artifact#constraints> ;
    rdfs:label "governed artifact evolution profile"@en ;
    rdfs:comment "Requires evidence-bearing proposals, attributable decisions, traceable realizations, and reproducible comparisons while remaining neutral about artifact kind."@en .

<https://ontology.inferal.com/modules/artifact-evolution/profiles/governed-artifact#constraints>
    a prof:ResourceDescriptor ;
    rdfs:label "governed artifact constraints descriptor"@en ;
    rdfs:comment "Describes the SHACL artifact containing the governed lifecycle constraints."@en ;
    prof:hasArtifact <https://ontology.inferal.com/modules/artifact-evolution/versions/0.1.0/profiles/governed-artifact.ttl> ;
    prof:hasRole role:constraints, role:validation ;
    dcterms:conformsTo <http://www.w3.org/ns/shacl#> ;
    dcterms:format <https://www.iana.org/assignments/media-types/text/turtle> .

ae:GovernedArtifactProfileArtifactShape
    a sh:NodeShape ;
    rdfs:label "governed profile artifact shape"@en ;
    rdfs:comment "Requires a governed artifact to identify at least one immutable artifact version."@en ;
    sh:targetClass ae:GovernedArtifact ;
    sh:property [ sh:path ae:hasArtifactVersion ; sh:class ae:ArtifactVersion ; sh:minCount 1 ] .

ae:GovernedArtifactProfileProposalShape
    a sh:NodeShape ;
    rdfs:label "governed profile proposal shape"@en ;
    rdfs:comment "Requires proposals exchanged under the governed profile to identify the profile and a complete review baseline."@en ;
    sh:targetClass ae:ChangeProposal ;
    sh:property [ sh:path dcterms:conformsTo ; sh:hasValue ae:GovernedArtifactProfile ] ;
    sh:property [ sh:path ae:concernsArtifact ; sh:class ae:GovernedArtifact ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path ae:baselineVersion ; sh:class ae:ArtifactVersion ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path ae:hasOperation ; sh:class ae:ChangeOperation ; sh:minCount 1 ] ;
    sh:property [ sh:path ae:supportedBy ; sh:class prov:Entity ; sh:minCount 1 ] .

ae:GovernedArtifactProfileDecisionShape
    a sh:NodeShape ;
    rdfs:label "governed profile decision shape"@en ;
    rdfs:comment "Requires each decision to be attributable, generated by a review, and timestamped."@en ;
    sh:targetClass ae:ChangeDecision ;
    sh:property [ sh:path ae:decidesProposal ; sh:class ae:ChangeProposal ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path ae:hasDecisionOutcome ; sh:class ae:DecisionOutcome ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path prov:wasAttributedTo ; sh:class prov:Agent ; sh:minCount 1 ] ;
    sh:property [ sh:path prov:wasGeneratedBy ; sh:class ae:ChangeReview ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path prov:generatedAtTime ; sh:datatype xsd:dateTimeStamp ; sh:minCount 1 ; sh:maxCount 1 ] .

ae:GovernedArtifactProfileRealizationShape
    a sh:NodeShape ;
    rdfs:label "governed profile realization shape"@en ;
    rdfs:comment "Requires every realization to generate one version and trace to a proposal or operation."@en ;
    sh:targetClass ae:ChangeRealization ;
    sh:property [ sh:path ae:generatedArtifactVersion ; sh:class ae:ArtifactVersion ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:or (
        [ sh:property [ sh:path ae:realizesProposal ; sh:class ae:ChangeProposal ; sh:minCount 1 ] ]
        [ sh:property [ sh:path ae:implementsOperation ; sh:class ae:ChangeOperation ; sh:minCount 1 ] ]
    ) .

ae:GovernedArtifactProfileComparisonShape
    a sh:NodeShape ;
    rdfs:label "governed profile comparison shape"@en ;
    rdfs:comment "Requires every comparison to identify both endpoints and its generated change set."@en ;
    sh:targetClass ae:ArtifactComparison ;
    sh:property [ sh:path ae:baselineVersion ; sh:class ae:ArtifactVersion ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path ae:resultVersion ; sh:class ae:ArtifactVersion ; sh:minCount 1 ; sh:maxCount 1 ] ;
    sh:property [ sh:path ae:generatedChangeSet ; sh:class ae:ChangeSet ; sh:minCount 1 ; sh:maxCount 1 ] .
