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#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


delete {

        ?a ?p ?target .
}

insert {

       [
                a sh:NodeShape ;
                ?p ?target ;
                sh:property ?a ;
       ]

}

where {

        ?a
                sh:path ?path ;
               ?p ?target ;
        .

        FILTER(?p in (sh:targetClass, sh:targetNode, sh:targetSubjectsOf, sh:targetObjectsOf ))
}