@entities
.[/type == (Id(/ museum ) , Id(/ theme_park ))]
.{
id: ?cur
require name: /name.[TextLang() == en ]
@merge : events::GetInfo()
}
can be written something like: *[type == "museum" || type == "theme_park"] {
id,
name: select(name[lang == "en"] => name),
...{
// GROQ doesn't have functions, so GetInfo()
// would need to be inlined here
}
}
PathQuery is of course a lot more complex, but the basic structure seems very similar. One thing GROQ does not have yet is recursive querying of the type needed to traverse graphs, but this is on our roadmap to implement.We've published a public draft specification for GROQ, and hoping it will be adopted by more tools. For example, we already have an open-source JavaScript implementation of it.
(Disclosure: I work on GROQ at Sanity.)