Recent posts

#11
General Archi Discussion / Re: Export views.csv ?
Last post by Xiaoqi - April 30, 2024, 22:42:37 PM
Hello,

I've found myself these HTML report tables are quite useful for supporting querying.

Here you may find the summarized data model (tables structure with relationships) on those 7 tables in HTML report:

https://github.com/yasenstar/EA/blob/master/architool/Archi%20HTML.png

Refer to those relationships between tables will facilitate you writing complex query for getting data from joined tables. Good Luck!

p.s. I also load the HTML Report data into Power BI then for more visualization views and linking with other data source internally.

Regards,
Xiaoqi
#12
coArchi / Azure DevOps and Archi Model
Last post by mark_s - April 30, 2024, 21:57:54 PM
Hi Forum,

This is probably a very basic question, but needed to ask.

I'm using Azure DevOps and wanted to check that a single Archi Model equates to a single Repo?

Mark
#13
jArchi / Re: New Script: Import special...
Last post by yveszoundi - April 27, 2024, 20:01:03 PM
Thanks Jean-Baptiste,

I didn't know about that approach as I usually don't import models. It's great to have multiple options.

Cheers,
Yves
#14
jArchi / Re: New Script: Import special...
Last post by Jean-Baptiste Sarrodie - April 27, 2024, 19:55:44 PM
Hi,

Just in case you didn't think about it: your can also create a model which only contains specializations' definition and import this model into other model to automate the creation of the specializations.

Regards,

JB
#15
jArchi / New Script: Import specializat...
Last post by yveszoundi - April 27, 2024, 01:16:25 AM
Hello guys,

Reusing specializations quickly in new models is not easy, unless you've got a special diagram with all specialized elements that you copy/paste between models.
I use different specializations accordingly to the project/model/audience and maybe you'll find this minimalistic script handy too.

Script URL
https://gist.github.com/yveszoundi/cddecaca70b0b3a97d69224d7a29d2c1

Approach
  • Create a folder wih all your icons
  • Create a mapping.properties file in your icons folder with the following syntax: specialization=element-type

Auxiliary script to dump archimate view element types
https://gist.github.com/yveszoundi/2f3dd1e97b616540d86931f55662bed3

#16
General Archi Discussion / Re: A database of property obj...
Last post by Azix - April 03, 2024, 23:28:40 PM
hi, ohhh I see a bit clearer, thanks for the examples ;D

I've started to do this, does it seem consistent with the view I have or can I simplify the code even more?

console.log("----------GET OBJECT NODE FROM MODEL------------");
var nodes = $("node");
console.log(nodes);

console.log("----------GET VIEW------------");
var view = $(".5-Prod").first(); // Get view from its name (pick the first one if multiple views share the same name)

var flowRelationship = $(view).find("flow-relationship"); // Build a collection containing the view, and then get all flow-relationship in this view.
var compositionRelationship = $(view).find("composition-relationship"); // Build a collection containing the composition-relationship, and then get all flow-relationship in this view.
console.log(flowRelationship);
flowRelationship.each(function(flowRelationship) {
console.log("Relation " + flowRelationship.concept.name + ""); // we can still access the name attribute through the visual object
console.log(flowRelationship.prop("port")); // get port of the relation
console.log(flowRelationship.concept.source.id); // get source id of the relation
console.log(flowRelationship.concept.target.id); // get target id of the relation
console.log(flowRelationship.concept.documentation); // get documentation of the relation
console.log("Source"+$("#"+flowRelationship.concept.source.id)); // get source object of the relation
console.log("Target"+$("#"+flowRelationship.concept.target.id)); // get target object of the relation

if ($("#"+flowRelationship.concept.source.id)
[o].type == "technology-interface") { // if source is a technology-interface
    compositionRelationship.each(function(compositionRelationship) { // get all composition-relationship
        if (compositionRelationship.concept.target.id == $("#"+flowRelationship.concept.source.id)
[o].concept.id) { // if target of the composition-relationship is the source of the flow-relationship
            console.log(" Source: " + compositionRelationship.concept.source.id + " Target: " + compositionRelationship.concept.target.id); // get source and target of the composition-relationship
            console.log($("#"+compositionRelationship.concept.source.id)
[o].name); // get name of the source of the composition-relationship
        }           
    }
    );
}

console.log("\n");
});



#17
Hi,

Ok, there is a fundamental misunderstanding on how jArchi API works, which lead to non-needed code and complexity (Btw, don't worry, such misunderstanding is quite frequent).

Most of your 'get_something_from_xxx' function are not needed because jArchi returns a collection which is itself a list of objects.

For example:
var nodes = get_object_from_model("element","node");
Is really only:
var nodes = $("node");
Which in turn makes it easy to rewrite this:
for (var id in nodes) {
    if (nodes.hasOwnProperty(id)) {
        var node = nodes[id];
        console.log("Node ID: " + id + ", Name: " + node.name + ", Type: " + node.type);
    }
}

to this:
nodes.each(function(node) {
  console.log("Node ID:" + node.id + ", Name: " + node.name + ", Type: " + node.type);
});

And because (in this example) node is really a collection (i.e. a list) of object, you can then use them to navigate the model. Based on the previous code sample, let's imagine you want, for each node, to list incoming flow relationships and print the other end, you'll end up with this:
nodes.each(function(node) {
  console.log("Node " + node.name + " has the following remote ends:");
  $(node).inRels("flow-relationship").sourceEnds().each(function(end) {
    console.log("- [" + end.id + "] " + end.name + " (" + end.type + ")");
  });
});

Quote from: Azix on April 03, 2024, 10:37:12 AMI'm trying to get the relationships from a view but how do I get the right ids between the view and the objects models?

When iterating on a view content, what you get is a collection of visual objects which have their own attributes (such as position and colors), but also act as a "pass-through" to access underlying model concept's type and properties. When navigating using such visual objects as input, the navigation is limited to the view. If you want to navigate the model, then you have to get the underlying concept using the ".concept" attribute of visual objects.

Here's an example based on previously shared code snippets... Let's imagine that the list of nodes doesn't come from the model but from a view, but you still want to list incoming relationships's ends as defined in the model (not the view):
var view = $("view.ViewName").first(); // Get view from its name (pick the first one if multiple views share the same name)
//var view = selection.parents().add(selection).filter("view").first(); // Another option: get the selected view, or the one containing the selected visual object

var nodes = $(view).find("node"); // Build a collection containing the view, and then get all nodes in this view. Note: 'nodes' is a collection of Visual Objects

nodes.each(function(node) { // Note: 'node' is a Visual Object
  console.log("Node " + node.name + " has the following remote ends:"); // we can still access the name attribute through the visual object
  $(node.concept).inRels("flow-relationship").sourceEnds().each(function(end) { // by using 'node.concept' we switch to the underlying model element
    console.log("- [" + end.id + "] " + end.name + " (" + end.type + ")");
  });
});


Hope this helps.

Regards,

JB
#18
General Archi Discussion / Re: A database of property obj...
Last post by Phil Beauvoir - April 03, 2024, 12:30:53 PM
> I'm trying to get the relationships from a view but how do I get the right ids between the view and the objects models?

If you want to get the underlying concept for a visual object you can access it with:
object.concept
See https://github.com/archimatetool/archi-scripting-plugin/wiki/Visual-Objects#concept
#19
General Archi Discussion / Re: A database of property obj...
Last post by Azix - April 03, 2024, 10:37:12 AM
Hi, I'm sorry, I'm trying to get the relationships from a view but how do I get the right ids between the view and the objects models?

how do I can retrieve the elements according to the view if they are not ?


function get_relationship_from_view(view,relationship_object){

var relationships = {}; // Objet pour stocker les relations

    $(view).children(relationship_object).each(function(obj) {
        relationships[obj.id] = {
            name: obj.name,
            type: obj.type,
            source: obj.source.id,
            target: obj.target.id,
            documentation: obj.documentation
        };
    });
    console.log(relationships);
    return relationships;
}

function get_object_from_model(model,object){
    var objects = {}; // Objet pour stocker les les variable de l'object

    $(model).filter(object).each(function(obj) {
        objects[obj.id] = {
            name: obj.name,
            type: obj.type,
            documentation: obj.documentation
        };
    });

    return objects;
}

function get_relation_from_model(model,object){
    var relationships = {}; // Objet pour stocker les relations

    $(model).each(function(obj) {
        relationships[obj.id] = {
            name: obj.name,
            type: obj.type,
            source: obj.source.id,
            target: obj.target.id,
            documentation: obj.documentation
        };
    });

    return relationships;
}



var relationships = get_relationship_from_view(".view matrix","flow-relationship");
var nodes = get_object_from_model("element","node");
var network = get_object_from_model("element","communication-network");
var groups = get_object_from_model("element","grouping");
var relationships_from_model = get_relation_from_model("flow-relationship","");

console.log("----------GET OBJECT NODE FROM MODEL-!!!!!!!!!!!!!!!!!!!!------------");


for (var id in nodes) {
    if (nodes.hasOwnProperty(id)) {
        var node = nodes[id];
        console.log("Node ID: " + id + ", Name: " + node.name + ", Type: " + node.type);
    }
}
console.log("\n");

console.log("----------GET OBJECT relationships_from_model FROM MODEL-------------");

for (var id in relationships_from_model) {
    if (relationships_from_model.hasOwnProperty(id)) {
        var relation = relationships_from_model[id];
        console.log("Relation ID: " + id + ", Name: " + relation.name + ", Type: " + relation.type + ", Source ID: " + relation.source + ", Target ID: " + relation.target);
    }
    console.log("\n");
}

console.log("----------GET OBJECT relationships_from_VIEW FROM MODEL-------------");


for (var id in relationships) {
    if (relationships.hasOwnProperty(id)) {
        var relation = relationships[id];
       
        var relation_name = relation.name;
        var sourceId = relation.source;
        var targetId = relation.target;

        // Trouver la source et la cible dans nodes, network ou groups
        var sourceElement = nodes[sourceId] || network[sourceId] || groups[sourceId];
        var targetElement = nodes[targetId] || network[targetId] || groups[targetId];

        console.log("Name: "+relation_name+" Relation ID: " + id + ", Source ID: " + sourceId + ", Target ID: " + targetId);

        if (sourceElement) {
            console.log("Source Element: " + sourceElement.name + " (" + sourceElement.type + ")");
        } else {
            console.log("Source element not found for ID: " + sourceId);
        }

        if (targetElement) {
            console.log("Target Element: " + targetElement.name + " (" + targetElement.type + ")");
        } else {
            console.log("Target element not found for ID: " + targetId);
        }
    }
    console.log("\n");
}
#20
General Archi Discussion / Re: A database of property obj...
Last post by Phil Beauvoir - April 03, 2024, 09:28:22 AM
@Azix I merged your latest topic into this one to keep everything together.

Regarding jArchi scripting, it would be easier to help you if you could take one simple problem at a time. Perhaps if you could explain what you have already tried, and then say where you are stuck. For example, "how to add a property to a concept?", "how to add a concept to a view?"

Phil