declarative data structure query language

269 Views Asked by At

I'm having difficulty describing a sort of query language that I figure must exist and have a name.

Simply, you describe the data you want to receive as a data structure of paths to values and any transformations, constraints, etc.

For example, requesting this:

{:query {:title
         :content
         :fullname (join [:author.firstname :author.lastname] " ")
         :meta {:date-created
                :date-updated
                :date-published}}
 :limit 10
 :order-by :title}

would return a list of results like:

[
    {:title "dummy title 1" 
     :content "lorem ipsum" 
     :author "Jane Doe"
     :meta {:date-created 2016-01-01
            :date-updated 2016-01-02
            :date-published 2016-01-02}}

    {:title "dummy title 2" 
     :content "ipsum lorem" 
     :author "John Doe"
     :meta {:date-created 2016-01-01
            :date-updated 2016-01-02
            :date-published 2016-01-02}}

     ...

]

Datalog type queries and even MongoDB queries have a similar feel but does this type of querying have a name or fit some design pattern I can better search the internet for?

1

There are 1 best solutions below

0
On BEST ANSWER

I've just come across Facebook's GraphQL that seems to serve this purpose.

https://code.facebook.com/posts/1691455094417024/graphql-a-data-query-language/

And the Python Graphene library has Django support.

There is a repo with links to the various implementations: https://github.com/chentsulin/awesome-graphql