1

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?

Samuel Hawksby-Robinson
  • 2,652
  • 4
  • 24
  • 25

1 Answers1

0

This is not possible - the query language is limited see https://hyperledger.github.io/composer/reference/query-language

It is not an SQL database, rather the query is parsed and passed onto the Hyperledger Fabric world state database that is held in CouchDB

Calanais
  • 1,541
  • 9
  • 10