Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get an agent's offers? #15

Closed
fosterlynn opened this issue Jul 4, 2023 · 2 comments
Closed

How to get an agent's offers? #15

fosterlynn opened this issue Jul 4, 2023 · 2 comments

Comments

@fosterlynn
Copy link
Member

This is for the agent popup from the map, which includes the offers.

I'm trying to work with what is in hREA using the graphiql in the installation, and spec out a query for agents that also gets their offers. So far no real luck, and I'm not sure the best path to follow in terms of odd queries and/or more work in hREA. (Note we'll need the same kind of thing for an agent's chosen facet values.)

First try:

query GetAgents {
  agents {
    edges {
      node {
        id
        name        
        proposals {
          edges {
            node {
              id
              unitBased
              hasBeginning
              hasEnd
              publishes {
                reciprocal
                publishes {
                  id
                  provider {
                    id
                    name
                  }
                  receiver {
                    id
                    name
                  }
                  availableQuantity {
                    hasNumericalValue
                    hasUnit {
                      label
                    }
                  }
                  resourceQuantity {
                    hasNumericalValue
                    hasUnit {
                      label
                    }
                  }
                  resourceConformsTo {
                    name
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

This doesn't work because agent.proposals is not implemented.

Next try, because agent.intentsAsProvider does work. But I can't figure out any way to get back up to the Proposal through the ProposedIntent from the Intent, so I can get back down to the reciprocal Intent.

query GetAgents {
  agents {
    edges {
      node {
        id
        name
        intentsAsProvider {
          edges {
            node {
              id
              availableQuantity {
                hasNumericalValue
                hasUnit {
                  label
                }
              }
              resourceQuantity {
                hasNumericalValue
                hasUnit {
                  label
                }
              }
              resourceConformsTo {
                name
              }
              finished
              
            }
          }
        }
      }
    }
  }
}

The one below works. But there is no filter to get proposals just for one agent afaict? So filtering or shuffling them onto the right agents could possibly be done somewhere - the UI? But it's a bit of work. I don't know, maybe it is the same amount of work to do it in hREA to make agent.proposals work, without sql? Above my pay grade.

query GetProposals {
  proposals {
    edges {
      node {
        id
        unitBased
        hasBeginning
        hasEnd
        publishes {
          reciprocal
          publishes {
            id
            provider {
              id
              name
            }
            receiver {
              id
              name
            }
            availableQuantity {
              hasNumericalValue
              hasUnit {
                label
              }
            }
            resourceQuantity {
              hasNumericalValue
              hasUnit {
                label
              }
            }
            resourceConformsTo {
              name
            }
          }
        }
      }
    }
  }
}
@fosterlynn
Copy link
Member Author

See this issue in hREA: h-REA/hREA#393

@fosterlynn
Copy link
Member Author

Closing. I don't know what you did, but it is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant