can we update the value of relationship - hyperledger-fabric

I want to know whether we can update the parameter of relationship.
like food delivery, if I am having a relationship of a person and I am inheriting person and making a relationship of it

If you want to create a runtime relationship of any transactions, participants and assets than you can use the Factory(Runtime API) method. Using Factory you can create instances of Resource. you can follow this link.
I hope you get your answer.

Related

DDD Aggregates vs Entities

What to do with an object that has two dependencies:
Let's say we have three objects: client, company and a contract.
Contract needs a client and a company to exist.
Naturally, business wise, the contract belongs more to the client than it does to the company, however the companies provides the contract to the client.
For now, I have all three as a separate aggregate root. Because you should be able to quickly query the existing contracts for a specific company as well. If contract would be an entity under the client aggregate root, I'd need to query all the clients which have a contract of X company and then return a flattened list of those contracts. Which seemed a bit odd?
Secondly, contract itself has a lot of entities, with more entities below them.
To explain the hierarchy in a simple way:
Contract aggregates contains a list of entity A, entity A has multiple items of entity B and entity B has multiple items of entity C. So it's a deep structure, which all have to be exposed through the aggregate above it.
If I'd put the contract aggregate root as an entity below client, my client aggregate needs to carry all those extra methods for what's below contract as well. And soon I'll end up with almost everything under the same aggregate.
So my question is: what questions can I ask myself to answer this kind of issue? There's probably no right or wrong, but there should be some guidelines on how to deal with an issue like this?
Thanks!
what questions can I ask myself to answer this kind of issue?
Here is how Eric Evans defined AGGREGATE
An aggregate is a cluster of associated objects that we treat as a unit for the purpose of data changes.
"Change" is the important idea here; in designing our aggregate boundaries, we don't particularly care about data that appears in the same report (read-only view), we care instead about what data needs be to considered when making changes.
See also Mauro Servienti: All our aggregates are wrong.

CloudKit - How to share a set of entities and allow creation of new data

I'm currently building up an app for grocery-shopping where I'd want to share a set of data (shops, products, recipes and tags) within the family.
Let's say I have Entities called Shop, Product, Recipe and Tag. How can I establish an relation in CloudKit, that allows each invited user to edit shops, add products or read recipes?
I want to share all known information inside something kind of a "family store" but it seems like there's no documentation on how to do this using CloudKit and CoreData, so I hope for someone who already build sharing of a set of entities between multiple users.
I suggest setting up a Family entity in CloudKit, alongside your Shop, Product, Recipe, and Tag entities. The Family would be the parent entity, and the others would have a CKReference property that points to a Family record.
In order to coordinate sharing records between users, you could look at CKShare which is the mechanism Apple provides for sharing records from the private database (documentation).
In your case, you would share Family records between users. As long as the other records are set to have the Family record as its parent, they will automatically be shared along with the Family record's CKShare.
There is a tutorial that I like on Medium that walks through how it works which should apply pretty well to what you are trying to do: https://medium.com/#adammillers/cksharing-step-by-step-33800c8950d2
The whole workflow is more than you can shove into a Stack Overflow answer. I hope this helps get you started.

Modeling relationships with domain models

In my system, an User can be member of a Team.
I got a domain model called Team which contains id, name, member_count and is_channel. So when I fetch teams in the repository I retrieve the Team domain model.
How would I model the relation between a User and a Team? Because when talking about the relation I don’t care about the member_count and is_channel from the Team model. I even have extra data in the relation which is a role_type.
Should I create a domain model for the relation called TeamScope or something? That contains id, user_id, team_id, role_type?
See my comments on your question regarding your use of terms (model, class, association). I'm assuming you are misusing them when I wrote my answer.
How would I model the relation between a User and a Team? Because when talking about the relation I don’t care about the member_count and is_channel from the Team model (sic). I even have extra data in the relation which is a role_type.
You could use an association class in your domain model to represent this.
Membership can capture the role_type, which really is linked to the association as you have figured out.
member_count is represented with a / at the start, indicating that you'll derive its value from the multiplicity (it's a count of the number of members associated with the team).
You tagged node.js in your question, so I'm going to point to how to implement association classes in Java (not exactly your case, but in Node.js it should be easy to apply).
You should almost definitely model a TeamMember object which contains both a link to the User, a link to the Team, and the role the user plays on that team.
Teams have a list of TeamMembers, Users have a list of TeamMembers. Teams have a MemberCount (not sure if this is static, or dynamic from the count of TeamMembers), and I have no idea what is_channel means...

Should this relationship be unidirectional or not?

I have a Transaction entity that has a unidirectional to-many relationship with a Product entity. I've made it unidirectional because I want a transaction to be associated with a product, but I don't want a product to be associated with any transactions.
I know Apple suggest that you should make relationships have inverses, but I don't think having an inverse relationship from Product to Transaction is appropriate here is it? I know I will have to manually set the deletion of the product from the Transaction if a Product is deleted, but that's fine.
Does it matter what the delete rule is for the unidirectional relationship, since it won't make any difference will it?
Thanks
You should make the inverse, even if you aren't going to directly use it. There is a reason that Apple suggests doing this:
Core Data uses this information to ensure the consistency of the
object graph if a change is made (see “Manipulating Relationships and
Object Graph Integrity”).
The question I have for you is, why wouldn't you set the inverse? If you don't want the product to be associated with Transactions, then just don't access that relationship.

How to represent the instantiation of a type/class to represent a particular entity

Here is an example:
I have the generic type called "Account". I wish to use this account to represent multiple business entities:
1. Customer
2. Client
3. Company
I wish to use the Account type for the above 3 entities (as they are all types of accounts in my system - where the type is an attribute of the Account). How would I represent this relationship?
The only relationship you've described is that 'type' is an attribute of the Account. If Customer, Client, or Company are not strong enough entities on their own to deserve their own box on the Domain diagram, then you are done. In that case, you can include a note box associated with Account and say "Examples of values for the Type field: Customer, Client, Company, etc.".
If that is not strong enough, you may think about creating an AccountType class which have as sub-classes Customer, Client, Company. In that case you would draw an association from Account to AccountType, which replaces the need for the 'Type" attribute.
When I get a chance, I'll draw examples and post links to them.
You can model the template class (Account) and then bind it to create three different classes using the association link and the bind stereotype on the link, as you can see here, under the "Class Template" title.
I believe the diagram I would use to communicate these relationships between diffrent objects is the "Collaboration" diagram, as what the relationships show is how the different objects are instantiated (Account is instantiated as Customer, Client and Company) and how they (the instances) would interact with each other

Resources