如何在 hyperledger composer 的自定义查询中包含关系

How to include relationship in custom query in hyperledger composer

我试图在 queries.qry 文件中编写的自定义查询中包含特定资产的关系,但找不到任何解决方案,下面是我的代码:

型号

User
    o String id
    o String name
    o Integer age

Account
    id
    account_type
    --> User owner

queries.qry

query selectAccountByType {
  description: "Select all accounts based on type"
  statement:
    SELECT com.rohitkhatri.bank.Account WHERE (account_type==_$account_type)
}

现在,我想要的是,当我获取帐户时,它应该包括用户关系。

这是我尝试使用 composer-rest-server:

/queries/selectAccountByType?account_type=saving&filter={"include":"resolve"}

它returns出现以下错误:

{'status_code': 500, 'message': 'Invalid or extraneous parameter filter has been specified'}
filter={"include":"resolve"}

是一个环回过滤器(仅在 REST API 上公开)——而不是 Composer 查询语言语法的一部分。

在此处查看更多过滤器示例 -> https://github.com/hyperledger/composer-knowledge-wiki/blob/latest/knowledge.md#filters 例如

curl -g -X GET 'http://localhost:3000/api/Account?filter={"where":{"account_type":"saving"},"include":"resolve"}'