The following SPARQL Update queries are probably mostly correct, but may not be perfect. They focus on LC's LCSH vocabulary, whose resources are sufficiently complex as to make the query patterns more complex than others.
Steps to replace an authoritative label via SPARQL
Find all the subjects with the matching triple pattern,
and replace the matched triples with the INSERT triple pattern.
- Is there an issue using ?s with it matching many entities? Should it be a single URI and update the label for that specific entity?
Add a new variant:
- This one identifies the subject.
Delete an LCSH resource
1) Delete related component list. Thanks to: https://afs.github.io/rdf-lists-sparql
2) Delete related elements list. Thanks to: https://afs.github.io/rdf-lists-sparql
3) Delete related variant elements list. Thanks to: https://afs.github.io/rdf-lists-sparql
4) Delete related resources identified with blank nodes.
5) Delete triples that link to deleted resource. NB: If ?s is a blank node, it may be because this Thing is a member of a list. That's just a plain problem.
6) Delete triples where the subject is the resource's URI.
Deprecate a resource
By rights, there are so many changes that it would probably be better, in reality, to delete the resource and replace it.
1) Removes the Authority type and replaces it with Deprecated.
2) Removes the authLabel and replaces with depLabel.
Resource deprecated, but we have a replacement URI
1) Find where the old URI is used, replace it with the new one. Not sure this can be done in one step; might need two steps. The first to add the new triple, the second to delete the old one.
If "Deprecate a resource" above would better involve deleting the existing resource first, it would be best to replace the old URI with the new one in relationships first.