I'm establishing a many to many relationship between Participants
. I've defined this relationship in the CTO as below:
participant User identified by userId {
o String userId
o String name
}
abstract concept Relationship by relationshipId {
o String relationshipId
}
concept RelationshipChildParent extends Relationship {
--> User child
--> User parent
}
So now the next step is to fetch the related models in a single query call. If I were write this in SQL it would look like below:
// Get User's Children
SELECT children.*
FROM users as children
INNER JOIN relationship_parent_child as relationship
ON children.id = relationship.child_id
INNER JOIN users as parent
ON parent.id = relationship.parent_id
WHERE parent.id = 1
Interactive version : http://sqlfiddle.com/#!9/3983ae/9
How would this be implemented in Hyperledger?