arangodb-java-driver icon indicating copy to clipboard operation
arangodb-java-driver copied to clipboard

Query Builder

Open mrbatista opened this issue 9 years ago • 13 comments

Implement "ArangoDB Query Builder" like JavaScript node package module.

mrbatista avatar May 11 '15 12:05 mrbatista

bump

welovelain avatar Feb 14 '17 09:02 welovelain

Would be nice to have this. My queries are getting quite complex!

Queatz avatar Nov 11 '17 20:11 Queatz

Seems that some people are interested in an ArangoDB Query Builder. I also need one for a current project, so I started writing one myself.

If I find some extra time I will release it as an independent module. Maybe some of you are interested in contributing to such a project. Any help is much appreciated, as this module is only a byproduct and certainly won't get the attention it needs.

christian-lechner avatar Nov 14 '17 18:11 christian-lechner

Has work been started on this? I may give it a go as well.

Queatz avatar Nov 26 '17 03:11 Queatz

I have already done a good portion of the job. I took the ArangoDB Bison grammar file as a template to build a fluid query builder. So you can do the following:

String query = query()._for("doc").in(bindParam("@coll"))._return("doc").toAQL();
System.out.println(query);   // prints FOR `doc` IN @@coll RETURN `doc`

I hope I can upload the first prototype at the weekend.

christian-lechner avatar Nov 27 '17 09:11 christian-lechner

Awesome, can't wait to play around with it! :)

Queatz avatar Nov 27 '17 17:11 Queatz

Just uploaded the first version of the query builder to this repo. Have fun ;)

christian-lechner avatar Nov 28 '17 22:11 christian-lechner

Awesome, will try it out @christian-lechner 👍

Queatz avatar Nov 29 '17 00:11 Queatz

Any official news on progress towards a query builder? @christian-lechner 's repo has not been updated in 7 months, which is either a very good thing, or a very bad one :-)

rocketraman avatar Jun 22 '18 21:06 rocketraman

One thing the rethinkdb guys did was generate a good portion of their client driver code from the query language definition. It seemed to work quite well, as their Java client driver and query builder was a pleasure to use. It's possible their scripts could be a starting point to do the same for ArangoDB:

See the section "A behind the scenes look at how we brewed the Java driver" at https://rethinkdb.com/blog/official-java-driver/. There are links to the open source they used to do the code generation.

rocketraman avatar Jun 22 '18 21:06 rocketraman

Hi,

I'd like to announce that we're using Arango in Sages company, and we've created both java and kotlin support for Arango Query DSL.

In Java queries looks like:

    filter(
        and(
            exp(path("conflictReason", "conflictType"), EQ, "@conflictType"),
            exp(path("key"), LIKE, "@pattern")
        )
    )

whereas in kotlin it looks like:

    private val query =
        (FOR("doc") IN bindCollection("collection"))(
            RETURN("doc")
        )

It can be easily integrated with JNOSQL with the usage of the DocumentTemplate class.

We can open source this code if you wish.

m4ttek avatar Nov 08 '23 11:11 m4ttek

Hi @m4ttek , it would be great if you could open source the related code and/or create PR for it.

Thanks!

rashtao avatar Dec 07 '23 12:12 rashtao

Hi @rashtao,

Great, I'll talk to my boss about the strategy of open sourcing it under com.arangodb package but with additional javadocs indicating our company if you don't mind.

I reckon we can start with Java code as it matches this repository, and then think about incorporating Kotlin.

m4ttek avatar Dec 08 '23 10:12 m4ttek