Rank nodes on type in JointJS in combination with Dagre - jointjs

I would like to know if/how it is possible to rank nodes depending on a certain type. So lets say Dependend I want to align on the same level as the current node and child below and parent above.
Is this possible? I use Dagre now to align my nodes but I want to be a bit more in controll.
Kind regards,
kevin

Related

Is it allowed to use DECISION NODE after INITIAL NODE in activity diagram?

I'm modelling an activity diagram for a project. Directly after initial node is it okay to use a decision node. I just google for it. But I fail to find similar examples even.
Eg:- imagine a person can Search for a dog name or Select the category animal, then dog likewise at the very beginning.......
One of my team mates mention that according to above example those are two different activities and we should create two activity diagrams for it.
This is allowed under condition.
The rules concerning the input flow(s) of a decision node are (formal 2017 § 15.3.3.6 Decision Nodes page 390) :
A DecisionNode shall have at least one and at
most two incoming ActivityEdges, and at least one outgoing ActivityEdge. ... If the DecisionNode has only one
incoming edge, then it is the primary incoming edge. If the primary incoming edge of a DecisionNode is a ControlFlow,
then all outgoing edges shall be ControlFlows and, if the primary incoming edge is an ObjectFlow, then all outgoing edges
shall be ObjectFlows.
Also knowing (§ 15.3.3.1 Initial Node page 387) :
The outgoing ActivityEdges of an InitialNode must all be ControlFlows.
that means in your case, and supposing there is no other input edge to the DecisionNode, all outgoing edges of the DecisionNode shall be ControlFlows, else this is not allowed
Your team mate isn't wrong. This is a design question which should have been clarified beforehand. Activities are functional parts inside of use cases. They represent scenarios like "sunny day", various error scenarios, etc. And again one step back the use cases represent the added value the system under consideration represents for its primary actor.
Now from your examples it's hard to tell what that system should be. Search for dog name could be a use case, but in which context? Is it to name a new dog or to search for an existing dog in a database? Same for Select animal category(and then dog?). Both do not make much sense as use cases. Once you come up with meaningful use cases you can tell exactly which steps the activities should have as actions. Only then you can have the need to decide. The decision which use case to actually use it outside the system and you wont see the steps done for it.
As a recommendation: Bittner/Spence have an excellent book about use cases which (unlike the UML specification) makes a lot of sense. There are also other well known authors teaching the same school (along Ivar Jacobson).

DDD | hierarchy (same types) | constraint

I've looked at 2 other questions that seem related:
Is Aggregate Root with Deep Hierarchy appropriate in DDD?
How to define DDD Aggregate root for hierarchical data structure?
However they're not exactly the same as my situation; maybe missing the "constraint" aspect.
My situation: I have an AR named "Study", and a Study can be organized by cluster (borrowing from clustered-sampling concept in survey domain).
Let's say this "Study" takes this parameter "clusteringDepth" (an integer) in is constructor. Let's say: I specify 3 (provinces, counties, cities).
That's just a spec. of a Study. When you actually conduct a study, you create an instance of StudyPlan based on the Study.
So, in this case I will have an instance of StudyPlan that has a list of provinces (first-level clusters). Each province, has a list of counties (second-level clusters), and each county has list of cities (third / final-level clusters).
On each cluster you can attach quota information, and date range (specifying how many interviews you have to raise in that cluster, and the date interval for the interviews). Obviously a parent cluster must maintain invariants like "sum of quotas of child clusters must be less or equal to the quota of this cluster".
Ok..., now, the constraint: you can plan an interview with a respondent. For that you'd create an instance of InterviewPlan. But..., this interviewplan can only be attached to terminal (third-level) clusters.
Of course, it's easy to implement that constraint (e.g.: in the addInterviewPlan method of a cluster, I'd check if the cluster has a parent or no).
But..., for some reason... I think this is not a good DDD design. That constraint sounds too technical; it doesn't go naturally in a normal domain conversation.
My question: am I over-interpreting DDD "language-fluidity/naturalness requirement"? or... am I missing a concept? I mean, should I invent another domain model, something, that can be a child of cluster and have associated interviewPlan?
Thanks,
Raka
Other related: http://git.net/ml/programming.domain-driven-design/2006-06/msg00028.html
I don't think it is too tehnical. Domain experts knows basic math like sum and in this case they even create that tule.
Tehnical invariants imply tehnical things like tables, indexes, columns, rows, IDs, functions etc.

How to draw this relationship : Multiple composition of same instance

I have a nodes. Two nodes makes link. Multiple links make chain.
How can I draw this relationship in UML?
I thought Chain as a aggregation of links. But I have not come across any diagram stating such relation with “filled diamond with 1..* in it”.
Sorry I cannot upload the picture of mine. Since the “.violet.class” format is not supported by stackexchage.
Thanks
Edit : Node is similar to the any point in map.
Link : (source node , destination node).
Chain: vector[multiple-links]
So node will exists irrespective of the link. Whenever you create a chain a new links will be created and it lives only the life time of chain.
Here is a UML class diagram modeling what you stated.
A chain has a predecessor and a successor. Either might be 0.
You might add a constraint that in a chain the first must not have a predecessor and the last no successor and also that no circle is allowed (all depends on the context where you model this).

UML Relationships. Aggregation

I have a problem with my UML diagram and I'll be happy if you help me. I have relationships like
Object A (1)<>----(0..*) Object B
Object B (1)<>----(0..*) Object A
and I'd like to unite them. How can I do it? Thanks a lot.
Can you please define the term "unite them"? What exactly would you like to achive? An example could probably help.
Meanwhile, I can try to guess and give you two possible solutions. Maybe they help you to rephrase your question or even to find the solution:
In the Solution 1, I've just made a single relationship that describes both of yours. This can be used if there is only a single and clear criterion of the linkage between the objects. A typical n..m relationship. Objects A will each hold a collection of related objects B and vice versa.
For example a Person (A on the diagram) can join several Clubs (B) and a Club can have several members - there is only one logical relation behind this situation - membership.
Solution 2 is where there are actually 2 different ways to relate between those elements, each one 1..n. So, A holds a collection of Bs and B holds collection of As, but they are unrelated.
Extending the same example - a Person (A) can join only 1 Club (B) and a Club can have many members and hold their reference (col_a on the diagram). In the same time, a Club can have only 1 owner, and a Person can own several Clubs (col_b). Here we have two different logical relations - membership and ownership.
Of course, other multiplicities and navigabilities are possible, this is just an example to give you an idea.
Does one of these situations sound like yours?
UPDATE (after the 1st comment):
So, here is the updated solution 1:
This is an aggregation used here, and this is more a Group-member relationship. It suits perfectly the description of my first solution up there. Members (B) can be "shared" between the Groups (A) and Gruop does not have any special control over their lifetime.
The real Whole-part relationship would employ composition instead of aggregation (visually depicted with a black diamond, instead of a white one). Its semantics it that Whole object has a full control over the life of the contained objects (parts). In consequence, the Parts cannot be shared between several Wholes and must be destroyed if the Whole itself is destroyed.
Now you just need to find out which situation describes your problem the best, pick-up on of this solutions and eventually fine tune the multiplicities.
Here is a way you could represent this scenario in UML.
One server can contain 0 or many Functions (ie. aggregate relationship).
Each function must belong to one server. Or if it is a distributed function then it can belong to many servers.

Displaying different NSManagedObject entities in the same NSOutlineView

Basically I have three different Core Data entities (A, B, C) and A contains a set of Bs and B contains a set of Cs. These three entities are, however, quite different from each other and they don't have common methods to access each other's children or the values to be displayed in the view.
I'm trying to display these three enties in an NSOutlineView. There's propably other solutions too but I came up with two different ones:
Implementing NSOutlineViewDataSource protocol and handling each of the entities differently.
Consolidate the classes with categories and add common (transient) methods/properties for the NSOutlineView to use. These methods/properties get their actual values from the model entities' properties.
I chose the second option and added getters for the children and the display value. This way, however, the Key-Value Observing does not work anymore and changes in the model are not reflected to the view. I understand why, but I'm not sure how to solve this the right way. I was thinking of some way to be notified of the actual model value changes and forward them to the view.
Is there any easy way to forward those notifications or should I consider some other alternative?
In short, I need to display different kinds of entities in an NSOutlineView and I don't want to mess the model.
Can't you just use relationship A->B->C to fetch the object A and display them in outline view?
After some trial and error, I found out that creating a custom data source is really that simple and decided to go with the first choice. Also, with drag & drop support this feels much more natural way.
The only issue was with outlineView:setObjectValue:forTableColumn:byItem: for which one needs to specify column identifier references. I feel that undirect dependencies are always something one should avoid, but this is a small matter in comparison to making this work nicely.

Resources