Re: Why is it "JSQuery"?

Lists: pgsql-hackers
From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Why is it "JSQuery"?
Date: 2014-06-06 00:08:32
Message-ID: D600D1DB-3B96-475C-8A72-1C22034BD9FF@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Oleg, Teodor, and Hackers:

Love what you’re doing with JSQuery. I’m curious, though, whether you considered adopting an existing syntax, such as JSONPath.

http://goessner.net/articles/JsonPath/

Might be easier for people to pick up and use. Thoughts?

Best,

David


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 00:25:43
Message-ID: 53910A87.50800@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 06/05/2014 08:08 PM, David E. Wheeler wrote:
> Oleg, Teodor, and Hackers:
>
> Love what you’re doing with JSQuery. I’m curious, though, whether you considered adopting an existing syntax, such as JSONPath.
>
> http://goessner.net/articles/JsonPath/
>
> Might be easier for people to pick up and use. Thoughts?

My understanding is that it's meant to be analogous to tsquery.

At first glance, JsonPath doesn't seem to support AND and OR operators,
which would make it rather less expressive than I gather JSQuery is
meant to be.

cheers

andrew


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 00:34:03
Message-ID: AAA3F5B1-EB86-4D21-8406-64F565241AFF@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 5, 2014, at 5:25 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> My understanding is that it's meant to be analogous to tsquery.
>
> At first glance, JsonPath doesn't seem to support AND and OR operators, which would make it rather less expressive than I gather JSQuery is meant to be.

Yes, but perhaps it could be a superset.

I guess my real question is: Should it not be based on some existing dialect, preferably something in fairly wide use outside the Postgres community?

Unless that something is awful, of course.

David


From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 13:54:53
Message-ID: CAF4Au4whQrQajoueyBmWrEz6Kpm6zg9r1BAAxf6Opov=2fx4jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jsquery - is QUERY language, JsonPath - is language to EXTRACT json parts.

On Fri, Jun 6, 2014 at 4:34 AM, David E. Wheeler <david(at)justatheory(dot)com> wrote:
> On Jun 5, 2014, at 5:25 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>> My understanding is that it's meant to be analogous to tsquery.
>>
>> At first glance, JsonPath doesn't seem to support AND and OR operators, which would make it rather less expressive than I gather JSQuery is meant to be.
>
> Yes, but perhaps it could be a superset.
>
> I guess my real question is: Should it not be based on some existing dialect, preferably something in fairly wide use outside the Postgres community?
>
> Unless that something is awful, of course.
>
> David
>


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Oleg Bartunov <obartunov(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 16:12:13
Message-ID: EE91CC71-ED83-4AF7-8D5C-9DEA7A042C76@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 6, 2014, at 6:54 AM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:

> Jsquery - is QUERY language, JsonPath - is language to EXTRACT json parts.

Sure, but could we not potentially build on its syntax, instead of building a new one? I’m not saying we *should*, but if we don’t, I think there should be a discussion about why not. For example, I think it would not be a good idea to follow [JSONiq](http://www.jsoniq.org/) because who wants to write queries in JSON? (Have we learned nothing from XSLT?).

Here’s a (partial) list of existing JSON query languages:

http://stackoverflow.com/a/7812073/79202

The arguments might be:

* [JSONiq](http://jsoniq.org/): Queries in JSON? Gross!
* [UNQL](http://www.unqlspec.org/): Too similar to SQL
* [JAQL](https://code.google.com/p/jaql/): Too different from SQL
* [JSONPath](http://goessner.net/articles/JsonPath/): Too verbose
* [JSON Query](https://github.com/mmckegg/json-query): Too little there
* [Mongo](http://www.mongodb.org/display/DOCS/Inserting#Inserting-JSON): Gross syntax
* [LINQ](http://james.newtonking.com/archive/2008/03/02/json-net-2-0-beta-2): Too similar to SQL
* [searchjs](https://github.com/deitch/searchjs): Queries in JSON? Gross!
* [JQuery](http://jquery.org/): It's for HTML, not JSON
* [SpahQL](http://danski.github.io/spahql/): More like XPath
* [ObjectPath](http://adriank.github.io/ObjectPath/): Too verbose
* [JFunk](https://code.google.com/p/jfunk/): XPathy
* [JData](http://jaydata.org): Queries in JavaScript? C’mon.

These are just off-the-cuff evaluations in 10 minutes of looking -- surely not all of them are accurate. Some of them maybe *are* useful to emulate. It’s definitely worthwhile, IMHO, to evaluate prior art and decide what, if any of it, should inspire the JSQuery syntax, and there should be reasons why and why not.

I do think that the name should be changed if we don’t follow an existing standard, as [JSQuery](https://code.google.com/p/gwtquery/wiki/JsQuery) is already a thing.

Best,

David


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 19:51:34
Message-ID: 53921BC6.4050105@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 06/06/2014 09:12 AM, David E. Wheeler wrote:
> On Jun 6, 2014, at 6:54 AM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:
>
>> Jsquery - is QUERY language, JsonPath - is language to EXTRACT json parts.
>
> Sure, but could we not potentially build on its syntax, instead of building a new one? I’m not saying we *should*, but if we don’t, I think there should be a discussion about why not. For example, I think it would not be a good idea to follow [JSONiq](http://www.jsoniq.org/) because who wants to write queries in JSON? (Have we learned nothing from XSLT?).
>
> Here’s a (partial) list of existing JSON query languages:
>
> http://stackoverflow.com/a/7812073/79202
>
> The arguments might be:
>
> * [JSONiq](http://jsoniq.org/): Queries in JSON? Gross!

Also overly complex for the functionality we support. There's also no
way to make the jsquery strings valid JSON without adding a bunch of
extra text.

> * [UNQL](http://www.unqlspec.org/): Too similar to SQL

... also intended to be a *complete* replacement for SQL, whereas we
just want a syntax to search JSON fields.

> * [JAQL](https://code.google.com/p/jaql/): Too different from SQL
> * [JSONPath](http://goessner.net/articles/JsonPath/): Too verbose

I don't agree with the too verbose, but lacking AND|OR is pretty crippling.

> * [JSON Query](https://github.com/mmckegg/json-query): Too little there
> * [Mongo](http://www.mongodb.org/display/DOCS/Inserting#Inserting-JSON): Gross syntax
> * [LINQ](http://james.newtonking.com/archive/2008/03/02/json-net-2-0-beta-2): Too similar to SQL
> * [searchjs](https://github.com/deitch/searchjs): Queries in JSON? Gross!
> * [JQuery](http://jquery.org/): It's for HTML, not JSON
> * [SpahQL](http://danski.github.io/spahql/): More like XPath
> * [ObjectPath](http://adriank.github.io/ObjectPath/): Too verbose
> * [JFunk](https://code.google.com/p/jfunk/): XPathy
> * [JData](http://jaydata.org): Queries in JavaScript? C’mon.
>
> These are just off-the-cuff evaluations in 10 minutes of looking -- surely not all of them are accurate. Some of them maybe *are* useful to emulate. It’s definitely worthwhile, IMHO, to evaluate prior art and decide what, if any of it, should inspire the JSQuery syntax, and there should be reasons why and why not.

Well, I'd also say that we don't care about syntaxes which are not
already popular. There's no point in being compatible with something
nobody uses. How many of the above have any uptake?

Also, the explosion of query languages in this area is not an
encouraging sign for us being able to pick the "right" one. UUID-OSSP
anyone?

So the advantage of the current "jsquery" syntax is that it's similar to
tsquery, which already has some adoption in our userbase. On the other
hand, I'm not sure how many people actually understand the tsquery
syntax, and jsquery will be different enough to trip people up.

> I do think that the name should be changed if we don’t follow an existing standard, as [JSQuery](https://code.google.com/p/gwtquery/wiki/JsQuery) is already a thing.

I saw that too, but I don't get the impression that Google jsquery is
all that active. No?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 22:23:59
Message-ID: 5FA62CA1-8707-450D-8CF8-3DC27D259E48@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 6, 2014, at 12:51 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

>> * [JAQL](https://code.google.com/p/jaql/): Too different from SQL
>> * [JSONPath](http://goessner.net/articles/JsonPath/): Too verbose
>
> I don't agree with the too verbose, but lacking AND|OR is pretty crippling.

I had enough people complain about Test::XPath, which tests the structure of XML and HTML documents using XPath. They didn't like how verbose XPath was, preferring CSS selectors. So I ended up with a patch to support CSS syntax, too. CSS-style syntax is part of what people like about JQuery, too.

> Well, I'd also say that we don't care about syntaxes which are not
> already popular. There's no point in being compatible with something
> nobody uses. How many of the above have any uptake?

I think there is JQuery, JSONPath, and everything else, really. If we can draw some parallels, I think that would be sufficient to make people comfortable.

>> I do think that the name should be changed if we don’t follow an existing standard, as [JSQuery](https://code.google.com/p/gwtquery/wiki/JsQuery) is already a thing.
>
> I saw that too, but I don't get the impression that Google jsquery is
> all that active. No?

It’s Google. You really want to wrangle with their attorneys?

David


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-06 22:50:40
Message-ID: 539245C0.2030101@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 06/06/2014 03:23 PM, David E. Wheeler wrote:
> On Jun 6, 2014, at 12:51 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> Well, I'd also say that we don't care about syntaxes which are not
>> already popular. There's no point in being compatible with something
>> nobody uses. How many of the above have any uptake?
>
> I think there is JQuery, JSONPath, and everything else, really. If we can draw some parallels, I think that would be sufficient to make people comfortable.

Well, then those are the only ones worth considering.

>>> I do think that the name should be changed if we don’t follow an existing standard, as [JSQuery](https://code.google.com/p/gwtquery/wiki/JsQuery) is already a thing.
>>
>> I saw that too, but I don't get the impression that Google jsquery is
>> all that active. No?
>
> It’s Google. You really want to wrangle with their attorneys?

Google is not going to sue us over a minor OSS project which isn't a
commercial product.

The relevant question is: are users liable to confuse our jsquery with
Google jsquery?

Maybe we should call it "jsonesque" ;-)

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-10 18:04:45
Message-ID: C4ED2F1A-EE4B-43E8-A1A1-7E05836B15DA@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 6, 2014, at 3:50 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

> Maybe we should call it "jsonesque" ;-)

I propose JOQL: JSON Object Query Language.

Best,

David

PS: JAQL sounds better, but [already exists](http://code.google.com/p/jaql/).


From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-10 19:06:35
Message-ID: CAF4Au4wvT=kuzW1WL8xFBOzn-1Wj_Sit-92QjPx5_d3q+DfKqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

People,

we have many other tasks than guessing the language name.
jsquery is just an extension, which we invent to test our indexing
stuff. Eventually, it grew out. I think we'll think on better name
if developers agree to have it in core. For now, jsquery is good
enough to us.

jsquery name doesn't need to be used at all, by the way.

Oleg

On Tue, Jun 10, 2014 at 10:04 PM, David E. Wheeler
<david(at)justatheory(dot)com> wrote:
> On Jun 6, 2014, at 3:50 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>
>> Maybe we should call it "jsonesque" ;-)
>
> I propose JOQL: JSON Object Query Language.
>
> Best,
>
> David
>
> PS: JAQL sounds better, but [already exists](http://code.google.com/p/jaql/).


From: Oleg Bartunov <obartunov(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Jan Urbański <wulczer(at)wulczer(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-10 19:31:31
Message-ID: CAF4Au4y0o65rCcQaUozXD1jEQUKDnRpicg+peFfRY1X-CLPKCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The closest problem we have is jsonb statistics (lack of, actually) ,
which prevents use of all the power of jsquery. I hope Jan Urbański
could work on this.

Oleg

On Tue, Jun 10, 2014 at 11:06 PM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:
> People,
>
> we have many other tasks than guessing the language name.
> jsquery is just an extension, which we invent to test our indexing
> stuff. Eventually, it grew out. I think we'll think on better name
> if developers agree to have it in core. For now, jsquery is good
> enough to us.
>
> jsquery name doesn't need to be used at all, by the way.
>
> Oleg
>
> On Tue, Jun 10, 2014 at 10:04 PM, David E. Wheeler
> <david(at)justatheory(dot)com> wrote:
>> On Jun 6, 2014, at 3:50 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>>
>>> Maybe we should call it "jsonesque" ;-)
>>
>> I propose JOQL: JSON Object Query Language.
>>
>> Best,
>>
>> David
>>
>> PS: JAQL sounds better, but [already exists](http://code.google.com/p/jaql/).


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Oleg Bartunov <obartunov(at)gmail(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-10 21:46:19
Message-ID: 22529FD8-1254-4E60-B85D-0FA91AB3B01A@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 10, 2014, at 12:06 PM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:

> we have many other tasks than guessing the language name.
> jsquery is just an extension, which we invent to test our indexing
> stuff. Eventually, it grew out. I think we'll think on better name
> if developers agree to have it in core. For now, jsquery is good
> enough to us.
>
> jsquery name doesn't need to be used at all, by the way.

Yeah, I was more on about syntax than the name. We can change that any time before you release it.

David


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-15 20:58:18
Message-ID: 539E08EA.2040309@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 06/10/2014 02:46 PM, David E. Wheeler wrote:
> On Jun 10, 2014, at 12:06 PM, Oleg Bartunov <obartunov(at)gmail(dot)com> wrote:
>
>> we have many other tasks than guessing the language name.
>> jsquery is just an extension, which we invent to test our indexing
>> stuff. Eventually, it grew out. I think we'll think on better name
>> if developers agree to have it in core. For now, jsquery is good
>> enough to us.
>>
>> jsquery name doesn't need to be used at all, by the way.
>
> Yeah, I was more on about syntax than the name. We can change that any time before you release it.

I've been poking at the various json-query syntaxes you forwarded, and
none of them really work for the actual jsquery features. Also, the
existing syntax has the advantage of being *simple*, relatively
speaking, and reasonably similar to JSONPATH.

In other words, what I'm saying is: I don't think there's an existing,
poplular syntax we could reasonably use.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-15 21:07:31
Message-ID: 539E0B13.1020200@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 06/15/2014 04:58 PM, Josh Berkus wrote:
> I've been poking at the various json-query syntaxes you forwarded, and
> none of them really work for the actual jsquery features. Also, the
> existing syntax has the advantage of being *simple*, relatively
> speaking, and reasonably similar to JSONPATH.
>
> In other words, what I'm saying is: I don't think there's an existing,
> poplular syntax we could reasonably use.
>

Not to mention the similarity to tsquery, which is something not to be
despised.

cheers

andrew


From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Oleg Bartunov <obartunov(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is it "JSQuery"?
Date: 2014-06-16 16:27:41
Message-ID: 99B39B7C-43E8-478D-A5F3-DA5E63742D11@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jun 15, 2014, at 1:58 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

> In other words, what I'm saying is: I don't think there's an existing,
> poplular syntax we could reasonably use.

Okay, I’m good with that. Would be handy to document it in such a way as to kind of put it forward as a standard. :-)

D