You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Eugen Stan <ie...@netdava.com> on 2018/08/20 17:28:41 UTC

Re: [QUESTION] Opinions wanted on Query Language Design

Hi,

I'm curious if there has been progress over Sling GraphQL implementation?

I know there is graphql-java project that takes care of schema/request
parsing and some other things. I wonder how would this be provided on
top of Sling.

Regards,

On 02.07.2018 21:07, Jason E Bailey wrote:
> I'll over explain, since others on the list reading may not understand what I'm talking about. The conversation that you referenced was for a module that has since been split into multiple modules, with the main module being added to Sling  here:
>
> https://github.com/apache/sling-org-apache-sling-resource-filter
>
> I struggle with terminology occasionally,  when people say "Query Language" there is usually a mental image of indexes and complex optimizations. What I did was far simpler in that I can convert any Query Language you want down to a simple true/false check against a resource. Combine that with a controlled traversal of a resources tree and you end up with the ability to handle queries in a way that may not be as fast as an indexed, optimized,  JCR-SQL2 query, but also  doesn't have the negative impact of accidentally triggering a full node traversal of your entire repository by accident. 
>
>  I was debating internally whether the current Query Language that I implemented was good enough which is why I reached out. It's a bit wordy but it works in a logically consistent manner and  in a way that fits my use cases , so I'll probably keep it unless someone comes up with a good argument.
>
> I think GraphQL would be fun to implement because it combines selection as well as defining  a result.   So I may just write a new module to handle that implementation.
>
>
> - Jason
>
> On Mon, Jul 2, 2018, at 5:36 AM, Radu Cotescu wrote:
>> Hi Jason,
>>
>> I’m getting old and start forgetting things, so a link would help. I 
>> think you’re referring to [0].
>>
>> Personally I’d like a GraphQL implementation in Sling, because it would 
>> theoretically allow us to fetch all the resources needed to render a 
>> page in one go. This way scripts can become a bit more declarative, in 
>> the sense that each of them could provide a query they’d require to 
>> execute in order to retrieve their data.
>>
>> Cheers,
>> Radu
>>
>> [0] - 
>> https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E 
>> <https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E>
>>
>>> On 29 Jun 2018, at 15:10, Jason E Bailey <je...@apache.org> wrote:
>>>
>>> When I first wrote the Query Language used in the ResourceFilter I based it off of a "Resource Query Language" combined with a more familiar JCRSQL2 syntax.  Effectively it's a 'key' = 'value' filter  combined with basic logic and grouping.
>>> I looked at the SlingQuery implementation which is based off of JQuery, it has a cleaner syntax in a lot of cases but doesn't do some of the things I personally need like the ability to compare two properties. I'm working on getting ResourceFilter release ready and now is the time to make any changes to the language. Either additions, modifications, or adopting a new paradigm like an implementation  of GraphQL, because it's the new hotness. I was wondering if any of you had thoughts on the subject, strong opinions, or a wish list. 
>>>
>>> TIA.
>>>
>>> - Jason


Re: [QUESTION] Opinions wanted on Query Language Design

Posted by Jason E Bailey <je...@apache.org>.
Actually it was something Carsten was putting together and it was apparently 3 years ago and I suddenly feel old :)

- Jason

On Mon, Aug 20, 2018, at 1:51 PM, Jason E Bailey wrote:
> It's on my list of things to implement :) I currently sit and think 
> about it a lot. Hopefully I'll get more time at the adaptTo convention 
> to focus on it.
> 
> The way I'm most likely going to tackle this is similar to the Resource 
> Filter Script, in that it will take the GraphQL query and convert it to 
> one or more Stream<> processes.  I also might look into converting it 
> into something that Bertrand has been working on for a while where you 
> pass in a set of conditions which defines a query into a 
> ResourceProvider. I realize I'm saying that wrong cause I haven't gotten 
> that a-ha moment yet with his implementation. Which might be a good 
> reason to pursue that path. 
> 
> I've also been looking at diving more into Graph query languages 
> overall. Since there are more out there then just GraphQL. But GraphQL 
> is definitely the hotness right now. 
> 
> - Jason
> 
> On Mon, Aug 20, 2018, at 1:28 PM, Eugen Stan wrote:
> > Hi,
> > 
> > I'm curious if there has been progress over Sling GraphQL implementation?
> > 
> > I know there is graphql-java project that takes care of schema/request
> > parsing and some other things. I wonder how would this be provided on
> > top of Sling.
> > 
> > Regards,
> > 
> > On 02.07.2018 21:07, Jason E Bailey wrote:
> > > I'll over explain, since others on the list reading may not understand what I'm talking about. The conversation that you referenced was for a module that has since been split into multiple modules, with the main module being added to Sling  here:
> > >
> > > https://github.com/apache/sling-org-apache-sling-resource-filter
> > >
> > > I struggle with terminology occasionally,  when people say "Query Language" there is usually a mental image of indexes and complex optimizations. What I did was far simpler in that I can convert any Query Language you want down to a simple true/false check against a resource. Combine that with a controlled traversal of a resources tree and you end up with the ability to handle queries in a way that may not be as fast as an indexed, optimized,  JCR-SQL2 query, but also  doesn't have the negative impact of accidentally triggering a full node traversal of your entire repository by accident. 
> > >
> > >  I was debating internally whether the current Query Language that I implemented was good enough which is why I reached out. It's a bit wordy but it works in a logically consistent manner and  in a way that fits my use cases , so I'll probably keep it unless someone comes up with a good argument.
> > >
> > > I think GraphQL would be fun to implement because it combines selection as well as defining  a result.   So I may just write a new module to handle that implementation.
> > >
> > >
> > > - Jason
> > >
> > > On Mon, Jul 2, 2018, at 5:36 AM, Radu Cotescu wrote:
> > >> Hi Jason,
> > >>
> > >> I’m getting old and start forgetting things, so a link would help. I 
> > >> think you’re referring to [0].
> > >>
> > >> Personally I’d like a GraphQL implementation in Sling, because it would 
> > >> theoretically allow us to fetch all the resources needed to render a 
> > >> page in one go. This way scripts can become a bit more declarative, in 
> > >> the sense that each of them could provide a query they’d require to 
> > >> execute in order to retrieve their data.
> > >>
> > >> Cheers,
> > >> Radu
> > >>
> > >> [0] - 
> > >> https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E 
> > >> <https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E>
> > >>
> > >>> On 29 Jun 2018, at 15:10, Jason E Bailey <je...@apache.org> wrote:
> > >>>
> > >>> When I first wrote the Query Language used in the ResourceFilter I based it off of a "Resource Query Language" combined with a more familiar JCRSQL2 syntax.  Effectively it's a 'key' = 'value' filter  combined with basic logic and grouping.
> > >>> I looked at the SlingQuery implementation which is based off of JQuery, it has a cleaner syntax in a lot of cases but doesn't do some of the things I personally need like the ability to compare two properties. I'm working on getting ResourceFilter release ready and now is the time to make any changes to the language. Either additions, modifications, or adopting a new paradigm like an implementation  of GraphQL, because it's the new hotness. I was wondering if any of you had thoughts on the subject, strong opinions, or a wish list. 
> > >>>
> > >>> TIA.
> > >>>
> > >>> - Jason
> > 
> > Email had 1 attachment:
> > + signature.asc
> >   1k (application/pgp-signature)

Re: [QUESTION] Opinions wanted on Query Language Design

Posted by Jason E Bailey <je...@apache.org>.
It's on my list of things to implement :) I currently sit and think about it a lot. Hopefully I'll get more time at the adaptTo convention to focus on it.

The way I'm most likely going to tackle this is similar to the Resource Filter Script, in that it will take the GraphQL query and convert it to one or more Stream<> processes.  I also might look into converting it into something that Bertrand has been working on for a while where you pass in a set of conditions which defines a query into a ResourceProvider. I realize I'm saying that wrong cause I haven't gotten that a-ha moment yet with his implementation. Which might be a good reason to pursue that path. 

I've also been looking at diving more into Graph query languages overall. Since there are more out there then just GraphQL. But GraphQL is definitely the hotness right now. 

- Jason

On Mon, Aug 20, 2018, at 1:28 PM, Eugen Stan wrote:
> Hi,
> 
> I'm curious if there has been progress over Sling GraphQL implementation?
> 
> I know there is graphql-java project that takes care of schema/request
> parsing and some other things. I wonder how would this be provided on
> top of Sling.
> 
> Regards,
> 
> On 02.07.2018 21:07, Jason E Bailey wrote:
> > I'll over explain, since others on the list reading may not understand what I'm talking about. The conversation that you referenced was for a module that has since been split into multiple modules, with the main module being added to Sling  here:
> >
> > https://github.com/apache/sling-org-apache-sling-resource-filter
> >
> > I struggle with terminology occasionally,  when people say "Query Language" there is usually a mental image of indexes and complex optimizations. What I did was far simpler in that I can convert any Query Language you want down to a simple true/false check against a resource. Combine that with a controlled traversal of a resources tree and you end up with the ability to handle queries in a way that may not be as fast as an indexed, optimized,  JCR-SQL2 query, but also  doesn't have the negative impact of accidentally triggering a full node traversal of your entire repository by accident. 
> >
> >  I was debating internally whether the current Query Language that I implemented was good enough which is why I reached out. It's a bit wordy but it works in a logically consistent manner and  in a way that fits my use cases , so I'll probably keep it unless someone comes up with a good argument.
> >
> > I think GraphQL would be fun to implement because it combines selection as well as defining  a result.   So I may just write a new module to handle that implementation.
> >
> >
> > - Jason
> >
> > On Mon, Jul 2, 2018, at 5:36 AM, Radu Cotescu wrote:
> >> Hi Jason,
> >>
> >> I’m getting old and start forgetting things, so a link would help. I 
> >> think you’re referring to [0].
> >>
> >> Personally I’d like a GraphQL implementation in Sling, because it would 
> >> theoretically allow us to fetch all the resources needed to render a 
> >> page in one go. This way scripts can become a bit more declarative, in 
> >> the sense that each of them could provide a query they’d require to 
> >> execute in order to retrieve their data.
> >>
> >> Cheers,
> >> Radu
> >>
> >> [0] - 
> >> https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E 
> >> <https://lists.apache.org/thread.html/928bb3dd3d142df462f0941dc73b7f656398468ff643694df035a84d@%3Cdev.sling.apache.org%3E>
> >>
> >>> On 29 Jun 2018, at 15:10, Jason E Bailey <je...@apache.org> wrote:
> >>>
> >>> When I first wrote the Query Language used in the ResourceFilter I based it off of a "Resource Query Language" combined with a more familiar JCRSQL2 syntax.  Effectively it's a 'key' = 'value' filter  combined with basic logic and grouping.
> >>> I looked at the SlingQuery implementation which is based off of JQuery, it has a cleaner syntax in a lot of cases but doesn't do some of the things I personally need like the ability to compare two properties. I'm working on getting ResourceFilter release ready and now is the time to make any changes to the language. Either additions, modifications, or adopting a new paradigm like an implementation  of GraphQL, because it's the new hotness. I was wondering if any of you had thoughts on the subject, strong opinions, or a wish list. 
> >>>
> >>> TIA.
> >>>
> >>> - Jason
> 
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)