I wanna write an export script to get all capabilities in an hierarchical order, set by composition relationship. For this I have to determine one (or maybe more) root objects.
A root object means: this one has no inRels for Composition Relationship.
I have no glue how to catch them best. A simple solution: Making an further element called "root" and combine the root(s) manually with Composition Relations.
But I'm sure there must be a better solution. I thought not() - but this function gave me every relation except the named one. Is there a better way to filter it?
Hi, as with any jArchi adivce, the best thing to do is post part of the jArchi script that you have tried (just the relevant part).
Also, a simple numbered sequence of what you are trying to do - e.g "1. Iterate through all concepts 2. Find all concepts that match critieria x 3. etc"
Hi,
You have to use the filter() function on a collection to check if there's no incoming composition relationships.
Here's a small example:
function isRoot(e) {
return ! $(e).inRels('composition-relationship').size()
}
function doSomething(e) {
console.log(e)
}
$('capability').filter(isRoot).each(doSomething)
Regards,
JB
@JB: Thanks. That's perfect.