arangodb / arangodb-java-driver

The official ArangoDB Java driver.
Apache License 2.0
202 stars 94 forks source link

Query Builder #16

Open mrbatista opened 9 years ago

mrbatista commented 9 years ago

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

welovelain commented 7 years ago

bump

Queatz commented 7 years ago

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

christian-lechner commented 7 years ago

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.

Queatz commented 6 years ago

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

christian-lechner commented 6 years ago

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.

Queatz commented 6 years ago

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

christian-lechner commented 6 years ago

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

Queatz commented 6 years ago

Awesome, will try it out @christian-lechner 👍

rocketraman commented 6 years ago

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 commented 6 years ago

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.

m4ttek commented 1 year ago

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.

rashtao commented 11 months ago

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

Thanks!

m4ttek commented 11 months ago

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.