@prefix ex: <https://example.com/ontology-migration/> .
@prefix new: <https://example.com/person/v2/> .
@prefix old: <https://example.com/person/v1/> .
@prefix om: <https://ontology.inferal.com/modules/ontology-migration/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

old:v1 a owl:Ontology .
new:v2 a owl:Ontology .

old:Person a rdfs:Class ; rdfs:isDefinedBy old:v1 .
old:fullName a rdf:Property ; rdfs:isDefinedBy old:v1 .
old:status a rdf:Property ; rdfs:isDefinedBy old:v1 .
old:legacyCode a rdf:Property ; rdfs:isDefinedBy old:v1 .

ex:person-v1-to-v2
    a om:OntologyMigrationSet ;
    om:sourceOntology old:v1 ;
    om:targetOntology new:v2 ;
    om:hasCase ex:PersonTypeCase .

ex:PersonTypeCase
    a sh:NodeShape ;
    rdfs:label "person type case" ;
    rdfs:comment "Covers the source Person class." ;
    sh:targetClass old:Person ;
    sh:rule [
        a sh:TripleRule ;
        sh:subject sh:this ;
        sh:predicate rdf:type ;
        sh:object new:Person
    ] .

ex:FullNameCase
    a sh:NodeShape ;
    om:caseOf ex:person-v1-to-v2 ;
    rdfs:label "full name case" ;
    rdfs:comment "Covers the source fullName property." ;
    sh:targetSubjectsOf old:fullName ;
    sh:rule [
        a sh:TripleRule ;
        sh:subject sh:this ;
        sh:predicate new:displayName ;
        sh:object [ sh:path old:fullName ]
    ] .

ex:EnabledStatusCase
    a sh:NodeShape ;
    om:caseOf ex:person-v1-to-v2 ;
    rdfs:label "enabled status case" ;
    rdfs:comment "Selects subjects carrying the source status property; the rule body still supports only one value." ;
    sh:targetSubjectsOf old:status ;
    sh:rule [
        a sh:SPARQLRule ;
        sh:construct """
            PREFIX new: <https://example.com/person/v2/>
            PREFIX old: <https://example.com/person/v1/>
            CONSTRUCT { $this new:active true }
            WHERE { $this old:status "enabled" }
        """
    ] .

# This unassociated shape targets legacyCode but is not a case in the selected
# migration set, so coverage must remain "not declared".
ex:UnassociatedLegacyCodeShape
    a sh:NodeShape ;
    rdfs:label "unassociated legacy-code shape" ;
    rdfs:comment "Proves that a SHACL target outside the selected migration set does not count as its coverage." ;
    sh:targetSubjectsOf old:legacyCode ;
    sh:rule [
        a sh:TripleRule ;
        sh:subject sh:this ;
        sh:predicate new:displayName ;
        sh:object "not part of this migration"
    ] .
