Skip to content

Instantly share code, notes, and snippets.

@jbsarrodie
jbsarrodie / ConvertConcept.lib.js
Last active August 21, 2024 06:22
#jArchi script to change concepts' type (and optionally convert no more valid relationships to association)
function convert(selection, convertToType) {
var relaxed = window.confirm('By default, selected concepts are converted, and relationships involving them that would no more be valid are converted to associations. Click Ok for this behavior or Cancel if you want a "strict" mode where relationships are not changed.');
$(selection).each(function(o) {
$(concept(o)).outRels().each(function(r) {
if (! $.model.isAllowedRelationship(r.type, convertToType, r.target.type)) {
checkAndConvertRelationship(r, relaxed);
}
});
$(concept(o)).inRels().each(function(r) {
@davidsara
davidsara / Delete Unused.ajs
Last active September 17, 2020 09:48
#jArchi - Delete all unused elements (not used in any View).
// Delete all unused elements (not used in any View).
//
// (c) 2019 David Sara
function deleteUnusedElements() {
$("element").each(function(element) {
if($(element).objectRefs().isEmpty()) {
element.delete();
}
});