Simple, but non-live query

So I’m looking for what I believe is a very simple query. I can do it with a live query, but I don’t want or need the whole live query nonsense in the output so I maybe it would be considered a remedial “advanced query”. Either way, I’m in the early stages of the query writing learning curve and this is proving to be pretty painful for what it is so I thought I’d ask here.

I have multiple teams of people. Each team has a page of its own and the name of the page is the team name itself. I also have pages for each person and those pages have a page property that identifies the team. team:: A, team:: B, etc.

On the team page, I’d like to display a table of all of the engineers who’s team page property reference the name of the current page. I hope that makes sense.

Any help that moves me along would be much appreciated.

For team:: [[T]] , try something like this:

#+BEGIN_QUERY
{:query
   [:find (pull ?engineer [*])
    :in $ ?prop ?current
    :where
      [?engineer :block/properties ?engineer-props]
      [(get ?engineer-props ?prop) ?engineer-prop]
      [(contains? ?engineer-prop ?current)]
   ]
 :inputs [:team :current-page]
}
#+END_QUERY

So, that didn’t work and, honestly, the query syntax feels so esoteric to me that I’m having a difficult time even sorting out what it’s doing. As a reference, on the team page, I have the following “simple query” pulling the correct information. Maybe that helps make the jump from simple to advanced?

{{query (and (property :type "staff") (property :pod [[Yellowstone]]))}}

Our teams are called “pods” here because ¯\_(ツ)_/¯.

Like every normal person. And that was a very simple advanced query. The only solution is experience.

Try this:

#+BEGIN_QUERY
{:query
   [:find (pull ?engineer [*])
    :in $ ?current
    :where
      [?engineer :block/properties ?engineer-props]
      [(get ?engineer-props :type) ?engineer-type]
      [(= ?engineer-type "staff")]
      [?p :block/name ?current]
      [?p :block/original-name ?original]
      [(get ?engineer-props :pod) ?engineer-pod]
      [(contains? ?engineer-pod ?original)]
   ]
 :inputs [:current-page]
}
#+END_QUERY

@magillathegorilla @mentaloid
For your convenience, it can be even simpler. We can use something more akin to simple query syntax. In my experience for properties at least it can be beneficial. (I generally only use that now myself unless I need the value for something)
Also moved some things around for performance.

#+BEGIN_QUERY
{:query
   [:find (pull ?engineer [*])
    :in $ ?current
    :where
      [?p :block/name ?current]
      [?p :block/original-name ?original]
      (property ?engineer :pod ?original)
      (property ?engineer :type  "staff")
   ]
 :inputs [:current-page]
}
#+END_QUERY