我在Participants
之间建立了多对多的关系。我在CTO中定义了这种关系如下:
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
}
现在,下一步是在单个查询调用中获取相关模型。如果我在SQL中写这个,它将如下所示:
// 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
互动版:http://sqlfiddle.com/#!9/3983ae/9
如何在Hyperledger中实现?