Archi Forum

Archi Plug-ins => jArchi => Topic started by: nfigay on November 19, 2020, 17:19:52 PM

Title: Getting Relation attributes for Access or Influence
Post by: nfigay on November 19, 2020, 17:19:52 PM
Trying to get these attributes following some previous exchanges captured which occurred last year, I tried without success accessing these attributes. E.g. for Access relation, I tried:
attr("accessType")
.getAccessType()
.accessType

Does current version of JArchi support getters for these attributes?

Thanks in advance for your support

Nicolas
Title: Re: Getting Relation attributes for Access or Influence
Post by: Phil Beauvoir on November 19, 2020, 17:22:08 PM
It should work. See:

https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Object#accesstype
Title: Re: Getting Relation attributes for Access or Influence
Post by: nfigay on November 19, 2020, 18:12:11 PM
Thanks for the reply, Phil.

I've the version 0.8 of the jArchi plugin with Archi 4.7 on a Mac.

From a diagram, I extract all the relationships and use a switch on the relation type.

For access-relationship type, I've systematically an "undefined" output in console.log, even if setting the access type before.

$(did).children().filter('relationship').each(function(relation) {
     
     switch (relation.type) {
        case "access-relationship":
           relation.accessType = "access";
           console.log( "access type:"+ relation.accessType );
        default:

Title: Re: Getting Relation attributes for Access or Influence
Post by: Phil Beauvoir on November 19, 2020, 18:24:09 PM
I think that your filter returns a set of connections from a View. You have to go one stage further to get the referenced relationship in a connection. You need to access the ".concept" field.

So use:

relation.concept

Title: Re: Getting Relation attributes for Access or Influence
Post by: nfigay on November 19, 2020, 22:24:46 PM
You are right, Phil.
I misinterpreted the type of the children of the view, probably because of their types, i.e.  relation.type with relation a child of a view, filtered with the filter 'relationship', and giving the same output than relation.concept.type.
You make my learning by doing quite easier. Thanks a lot.
Title: Re: Getting Relation attributes for Access or Influence
Post by: Phil Beauvoir on November 19, 2020, 22:27:25 PM
Yes, it can be misleading because "relation.type" will return "access-relationship" if it is a visual connection as well as if it is a relationship concept.