building-envelope-data / metabase

Metabase of the product data network buildingenvelopedata.org
2 stars 3 forks source link

Make entities filterable by associated entities #167

Closed simon-wacker closed 1 year ago

simon-wacker commented 1 year ago

This makes for example the following queries possible:

query {
  components(
    where: {
      and: [
        { name: {contains: "A"} },
        { manufacturerEdges: { some: { and: [
          { pending: { eq: false } },
          { institution: { name: {contains: "I"} } }
        ]}}}
      ]
    }) {
    nodes {
      uuid
      name
    }
  }
} 

and

query {
  components(
    where: {
      and: [
        { name: { contains: "A" } },
        { manufacturers: { some: { name: { contains: "I" }}}}
      ]
    }) {
    nodes {
      uuid
      name
    }
  }
} 

Note that the second query also includes components with pending manufacturers containing I in their names.

christoph-maurer commented 11 months ago

I tried the queries

query {
  components(
    where: {
      and: [
        { name: {contains: "A"} },
        { manufacturerEdges: { some: { and: [
          { pending: { eq: false } },
          { institution: { name: {contains: "I"} } }
        ]}}}
      ]
    }) {
    nodes {
      uuid
      name
    }
  }
} 

and

query {
  components(
    where: {
      and: [
        { name: { contains: "A" } },
        { manufacturers: { some: { name: { contains: "I" }}}}
      ]
    }) {
    nodes {
      uuid
      name
    }
  }
} 

at https://www.buildingenvelopedata.org/graphql/, but I failed. @simon-wacker Is it because this pull request is not yet deployed? It's not urgent, I was just wondering.