Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jbsarrodie/aae4ed4981ada94834cfdf48d978a13f to your computer and use it in GitHub Desktop.
Save jbsarrodie/aae4ed4981ada94834cfdf48d978a13f to your computer and use it in GitHub Desktop.
#jArchi scripts to delete any element (or relationship) not used in at least one view
// Delete unused elements and relationships
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script will delete any element or relationship not used in at least one view
//
// (c) 2020 Jean-Baptiste Sarrodie
var response = window.confirm("This script will delete any element or relationship not used in at least one view. Continue?");
if (!response)
exit();
$("concept").each(function(c) {
if($(c).objectRefs().isEmpty()) {
c.delete();
}
});
// Delete unused elements
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script will delete any element not used in at least one view.
// (only relationships having such element as source or target will be deleted too)
//
// (c) 2019 Jean-Baptiste Sarrodie
var response = window.confirm("This script will delete any element not used in at least one view. Only relationships having such element as source or target will be deleted too. Continue?");
if (!response)
exit();
$("element").each(function(e) {
if($(e).objectRefs().isEmpty()) {
e.delete();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment