Hyperledger How to retrieve properties of relationship through query

0 votes

I want to create a query which returns all the Requests (asset) in which the Container's (asset) owner's id is equal to the parameter.

Model file (owner of a container is a Company participant, identified by id):

namespace org.acme.shipping.assets
import org.acme.shipping.participants.*

asset Container identified by number {
  o String number
  o ContainerType type
  o String content
  o ContainerStatus status default = "FREE"
  --> Company owner
}

enum ContainerType {
  o DRY
  o REEFER
}

enum ContainerStatus {
  o LOCKED
  o FREE
}

asset Request identified by id {
  o String id
  --> Container container
}

Query file

query getRequestsByCompany {
  description: "Get requests by company"
  statement:
      SELECT org.acme.shipping.assets.Request
          WHERE (container.owner.id == _$company_id)
}

How do i do this?

Nov 8, 2018 in Blockchain by slayer
• 29,370 points
865 views

1 answer to this question.

0 votes

I dont think its possible using query. You can do it using loopback filters:

{"where":{"shipmentId":1000}, "include":"resolve"}
answered Nov 8, 2018 by Omkar
• 69,220 points

Related Questions In Blockchain

0 votes
1 answer

How to retrieve complete world state of hyperledger?

you can achieve this by iteration process ...READ MORE

answered Jul 5, 2018 in Blockchain by slayer
• 29,370 points
1,396 views
0 votes
1 answer

How to connect two instances of Hyperledger Fabric?

Before getting on with your question, let ...READ MORE

answered Jun 11, 2018 in Blockchain by Christine
• 15,790 points
1,168 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,456 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,010 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,928 views
0 votes
1 answer

Hyperledger Composer: How to retrieve array of assets?

This is what worked for me: asset Ask ...READ MORE

answered Nov 14, 2018 in Blockchain by Omkar
• 69,220 points
1,735 views
0 votes
1 answer

Hyperledger composer: How to include relationship in custom query?

You are trying to use filter={"include":"resolve"} in Composer Query. ...READ MORE

answered Nov 16, 2018 in Blockchain by Omkar
• 69,220 points
1,108 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP