You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Julian Reschke <ju...@gmx.de> on 2011/12/05 14:35:42 UTC

JSOP extension points, was: JSOP

On 2011-11-29 17:37, Thomas Mueller wrote:
> Hi,
>
> What is not on this wiki page yet - because it's not defined yet - is:
> "commit metadata". Commit metadata is needed when you want to:
>
> * get multiple commits (diffs) in one block
> * send multiple commits (diffs) in one block
>
> As an example, see MicroKernel.getJournal() at
> http://svn.apache.org/repos/asf/jackrabbit/sandbox/microkernel/src/main/jav
> a/org/apache/jackrabbit/mk/api/MicroKernel.java
>
> This method is supposed to get multiple commits in one operation.
>
> I propose the following syntax:
>
> @ {"ts": 1322055029229, "msg": "New node 'hello'"}
> + "/hello": {}
> @ {"ts": 1322055029230, "msg": "New node 'world'"}
> + "/world": {}
>
> That means, the syntax for "commit metadata" is:
>
> METADATA ::= "@" OBJECT
> ...

This highlights a general problem with the compact syntax; it lacks an 
extension point.

Unless I'm missing something, a today's JSOP parsers will be unable to 
parse future messages that contain an extension defined like the above, 
as they won't know how to skip over it.

Best regards, Julian

Re: JSOP extension points, was: JSOP

Posted by Michael Dürig <md...@apache.org>.

On 5.12.11 14:54, Michael Dürig wrote:
>> Unless I'm missing something, a today's JSOP parsers will be unable to
>> parse future messages that contain an extension defined like the above,
>> as they won't know how to skip over it.
>>
>
> We could add an extension point to the compact syntax through the
> following production:
>
> EXTENSION ::= OP STRING ":" (OBJECT | ATOM | ARRAY)
>
> where OP is any single character except for +, ^, -, >, =, @ (and maybe
> some others to be defined).
>

FYI I added experimental support for above syntax.

Michael

Re: JSOP extension points, was: JSOP

Posted by Julian Reschke <ju...@gmx.de>.
On 2011-12-06 10:05, Thomas Mueller wrote:
> Hi,
>
>> The extension could indicate whether it's must-understand (such as
>> 'copy') or may-ignore (such as 'metadata').
>
> The 'may-ignore' extensions would have to be known when creating the
> specification.
>
> What about versions? The version to use is negotiated as follows:
>
> * client and server send the maximum version they support
> * they take the smaller of the two values in further communication
>
> In the case the server doesn't understand "copy node" (server version is
> 1), the client (client version 2) could send explicit add node commands,
> which are also understand in version 1, but are less efficient.
>
> Actually there could be multiple version number, for example a server and
> a client version, or a read and a write version (if the client version is
> too low, he might only be allowed to read but not write).

Version numbers may work when the format is defined by a single party.

Is it? Right now? Certainly not if we want to propose this as 
alternative to JSON-Patch (the IETF ID).

Best regards, Julian

Re: JSOP extension points, was: JSOP

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>The extension could indicate whether it's must-understand (such as
>'copy') or may-ignore (such as 'metadata').

The 'may-ignore' extensions would have to be known when creating the
specification.

What about versions? The version to use is negotiated as follows:

* client and server send the maximum version they support
* they take the smaller of the two values in further communication

In the case the server doesn't understand "copy node" (server version is
1), the client (client version 2) could send explicit add node commands,
which are also understand in version 1, but are less efficient.

Actually there could be multiple version number, for example a server and
a client version, or a read and a write version (if the client version is
too low, he might only be allowed to read but not write).


Regards,
Thomas


Re: JSOP extension points, was: JSOP

Posted by Julian Reschke <ju...@gmx.de>.
On 2011-12-06 09:17, Thomas Mueller wrote:
> Hi,
>
>> We could add an extension point to the compact syntax through the
>> following production:
>>
>> EXTENSION      ::= OP STRING ":" (OBJECT | ATOM | ARRAY)
>>
>> where OP is any single character except for +, ^, -,>, =, @ (and maybe
>> some others to be defined).
>
> That's a possible extension. The parser could support that. But I'm not
> sure if it's a good idea if items that are not understood are silently
> ignored. For example, if we add a new command "copy" as:
>
>      * "/from": "/to"
>
> (copies the node "/from" including all sub-nodes to a new node "/to"). Old
> implementations would silently ignore it? For proxies ignoring might work
> (forward whatever is not understood), but not for implementations (client
> side or server side).

The extension could indicate whether it's must-understand (such as 
'copy') or may-ignore (such as 'metadata').

Best regards, Julian

Re: JSOP extension points, was: JSOP

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>We could add an extension point to the compact syntax through the
>following production:
>
>EXTENSION      ::= OP STRING ":" (OBJECT | ATOM | ARRAY)
>
>where OP is any single character except for +, ^, -, >, =, @ (and maybe
>some others to be defined).

That's a possible extension. The parser could support that. But I'm not
sure if it's a good idea if items that are not understood are silently
ignored. For example, if we add a new command "copy" as:

    * "/from": "/to"

(copies the node "/from" including all sub-nodes to a new node "/to"). Old
implementations would silently ignore it? For proxies ignoring might work
(forward whatever is not understood), but not for implementations (client
side or server side).

Regards,
Thomas




Re: JSOP extension points, was: JSOP

Posted by Michael Dürig <md...@apache.org>.

On 5.12.11 13:35, Julian Reschke wrote:
> This highlights a general problem with the compact syntax; it lacks an
> extension point.
>
> Unless I'm missing something, a today's JSOP parsers will be unable to
> parse future messages that contain an extension defined like the above,
> as they won't know how to skip over it.
>

We could add an extension point to the compact syntax through the 
following production:

EXTENSION      ::= OP STRING ":" (OBJECT | ATOM | ARRAY)

where OP is any single character except for +, ^, -, >, =, @ (and maybe 
some others to be defined).

Michael


Re: JSOP extension points, was: JSOP

Posted by Michael Dürig <md...@apache.org>.

On 5.12.11 13:35, Julian Reschke wrote:
> This highlights a general problem with the compact syntax; it lacks an
> extension point.
>
> Unless I'm missing something, a today's JSOP parsers will be unable to
> parse future messages that contain an extension defined like the above,
> as they won't know how to skip over it.

Right, that's a valid point. I think we should find a way how extensions 
for the compact syntax could be handled - or switch to the IETF syntax. 
Otherwise we will probably lock ourselves in.

Michael

Re: JSOP extension points, was: JSOP

Posted by Julian Reschke <ju...@gmx.de>.
On 2011-12-05 15:02, Thomas Mueller wrote:
> Hi,
>
>> Unless I'm missing something, a today's JSOP parsers will be unable to
>> parse future messages that contain an extension defined like the above,
>> as they won't know how to skip over it.
>
> What we currently don't have, and probably should add, is a way to
> negotiate the format / protocol version (for example in the first message,
> similar to the "HTTP/1.1" in "GET / HTTP/1.1").
>
> But generally, parsers shouldn't silently skip over things they don't
> understand, except if it's explicitly defined to be implementation
> specific / optional (#pragma and such). Could you provide examples of
> languages that do support such extension points?

Most XML-based formats do; the same applies to JSON -- it's the "must 
ignore" pattern.

The "must understand" pattern makes it very hard to deploy new things, 
as you can't use it until each recipient understands it (this is why, 
for instance, the HTTP Expect header field is a big failure).

Best regards, Julian

Re: JSOP extension points, was: JSOP

Posted by Julian Reschke <ju...@gmx.de>.
On 2011-12-06 09:10, Thomas Mueller wrote:
> Hi,
>
>> JSON itself: if you specify that you are only interested in the property
>> "foo" in your json-based data, you will automatically skip any other
>> properties in the structure, without breaking any parsing.
>
> There are no extension points in the JSON syntax itself. With JSON syntax
> I mean the BNF of the JSON. The JSON syntax is strict, and that's OK.
>
>
> You are talking about the data. Sure, we could and should do that in our
> case as well. For example, we could say that the path "/:info/" should
> contain metadata information similar to the "information schema" in
> relational databases - if the given implementation supports it (meaning
> it's optional).

The difference here is that JSON and XML *are* extensible not at the 
syntax level, but the the logical level (by introducing new members / 
elements). The proposed JSOP diff format is not, because the grammar is 
optimized for the base operations.

Best regards, Julian

Re: JSOP extension points, was: JSOP

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>JSON itself: if you specify that you are only interested in the property
>"foo" in your json-based data, you will automatically skip any other
>properties in the structure, without breaking any parsing.

There are no extension points in the JSON syntax itself. With JSON syntax
I mean the BNF of the JSON. The JSON syntax is strict, and that's OK.


You are talking about the data. Sure, we could and should do that in our
case as well. For example, we could say that the path "/:info/" should
contain metadata information similar to the "information schema" in
relational databases - if the given implementation supports it (meaning
it's optional).

Regards,
Thomas


Re: JSOP extension points, was: JSOP

Posted by Alexander Klimetschek <ak...@adobe.com>.
On 05.12.11 15:02, "Thomas Mueller" <mu...@adobe.com> wrote:
>Could you provide examples of
>languages that do support such extension points?

JSON itself: if you specify that you are only interested in the property
"foo" in your json-based data, you will automatically skip any other
properties in the structure, without breaking any parsing.

Cheers,
Alex

-- 
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel





Re: JSOP extension points, was: JSOP

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>Unless I'm missing something, a today's JSOP parsers will be unable to
>parse future messages that contain an extension defined like the above,
>as they won't know how to skip over it.

What we currently don't have, and probably should add, is a way to
negotiate the format / protocol version (for example in the first message,
similar to the "HTTP/1.1" in "GET / HTTP/1.1").

But generally, parsers shouldn't silently skip over things they don't
understand, except if it's explicitly defined to be implementation
specific / optional (#pragma and such). Could you provide examples of
languages that do support such extension points?

Regards,
Thomas