jArchi: Attribute "Viewpoint" on diagram?

Started by cr0que, September 11, 2018, 08:26:10 AM

Previous topic - Next topic

cr0que

Hi!
I've just found out the strength of jArchi and started to automate some of the work I do with my models.

However, I just can figure it out how to read the attribute or property on a diagram that shows the viewpoint. I've tried with both attributes and properties or "natural syntax" (.someAttribute) but can in no way understand how to access information about the viewpoint.

Can someone here help me?

/ cr0que

Phil Beauvoir

Hi,

we haven't implemented setting and getting viewpoint names or info yet. Not sure how this would be achieved, if a viewpoint name is a standard thing as per the exchange format.

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

cr0que

Then I have to re-think my design. =)

Thank you for your quick response.

Phil Beauvoir

It depends what is required for a "viewpoint".

Is it the internal Archi id name, such as "implementation_deployment"?
Is it the external English name, such as "Implementation and Deployment"?
Is it required to know the concept types that are permitted in the viewpoint?
Is it a JS object type that returns all of the above? For example:

id : "implementation_deployment"
name : "Implementation and Deployment"
concepts : <list of permitted concept names>
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Phil Beauvoir

More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

cr0que

 
Quote from: Phil Beauvoir on September 11, 2018, 12:17:46 PM
More...

Or should there be methods added to the jArchi Diagram object pertaining to its viewpoint such as:

var view = ...;
var isAllowed = view.isAllowedConcept(conceptName);

For my use case either id or name will do the work. Complete information will probably cover more use cases and the methods is imho an elegant solution.

cr0que

Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

My use case is based on a selection of an archimate-diagram-model and then I want to find two or more concepts in that view.

/ cr0que

Phil Beauvoir

Have you tried using the filter(predicate) function?

collection.filter(function(object) {return someBoolean})

For example:


var selected = $("element").filter(function(object) {
    return object.name === "foo" || object.name === "bar";
});
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Jean-Baptiste Sarrodie

Hi,

Quote from: cr0que on September 11, 2018, 13:13:09 PM
Another jArchi-related question, I have experimented with multiple selectors in a find-statement e.g.

$('selector').find('fo, bar')

with no luck of finding a working syntax (based on different examples from jQuery). Do you have a thought of how to achieve a selection like that?

You have to do it in two steps:

$('selector').find('fo').add($('selector').find('bar'))

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

cr0que

Thank you!

I found that the filter function is best suited for my needs. But since filter works on the currently matched elements I first had to find everything (get e new set of matched elements) with

$(selector).find.().filter(function...

It's because my first selection is a diagram and not a collection of concepts or visuals. Since the expression

$(selector).find().add(...

will need a constant number of find selectors the filter seems a lot more flexible.

/ cr0que