This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15399 - [XP3.0] Conflict between EQName syntax and JSON
Summary: [XP3.0] Conflict between EQName syntax and JSON
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 10:00 UTC by Michael Kay
Modified: 2013-06-19 09:11 UTC (History)
4 users (show)

See Also:


Attachments

Description Michael Kay 2012-01-03 10:00:44 UTC
For an XPath/XQuery release after 3.0, there is discussion about supporting maps, and one of the proposals is to support maps using a JSON-like syntax. For example a map constructor might take the form

{ "colour":white,
  "size":large,
  "weight":heavy
}


The current syntax for EQNames, for example "foo":bar, will create usability problems if we do this, as it will be necessary to use spaces around the colon for disambiguation.

This bug report suggests that in the interests of keeping our options open, we should use a different syntax for EQNames. EQNames are intended primarily for use in software-generated code, and their readability is not of paramount importance.

We should reconsider the original proposal to use a backtick (`foo`:bar) .
Comment 1 Jonathan Robie 2012-01-10 18:02:45 UTC
In today's telcon, there was a lot of sympathy for changing the syntax, but we have not yet agreed on a new syntax.
Comment 2 John Snelson 2012-01-10 18:23:39 UTC
What about some kind of character followed by Clark notation? Norm and I discussed the possibility of "~" or "^", but landed upon "Q" which I think looks ok:

Q{http:example.com}foo

It should be parsed with ws:explicit - that is, as a single token (IMHO).
Comment 3 Michael Kay 2012-01-10 18:46:07 UTC
Q{http:example.com}foo  

+1 I like the continuity with Clark notation, which is well established
Comment 4 Michael Dyck 2012-01-31 18:08:03 UTC
I'm slightly put off by the fact that
    {http://example.com}
would play the role of a URILiteral without actually being one.
Comment 5 John Snelson 2012-01-31 19:58:34 UTC
That's true, but URILiteral has no intrinsic meaning other than as a useful EBNF alias for StringLiteral - so it's probably not that big a deal.
Comment 6 Jonathan Robie 2012-01-31 20:25:13 UTC
(In reply to comment #4)
> I'm slightly put off by the fact that
>     {http://example.com}
> would play the role of a URILiteral without actually being one.

I agree. We already have a way to delimit a URI literal, and it's well defined.

There's a second shortcoming: Q{ } looks like it delimits the name, but it doesn't.

I'd prefer something like:

Q{"http://example.com/exemplia":local}

Advantages:

1. URI Literal is recycled without change in meaning
2. : is recycled without change in meaning
3. The {} delimiters actually delimit the name
Comment 7 John Snelson 2012-01-31 20:30:03 UTC
The main disadvantage being it's another unknown unfamiliar syntax, rather than actually reusing the de-facto standard for expressing expanded QNames.
Comment 8 Jonathan Robie 2012-01-31 21:22:29 UTC
(In reply to comment #7)
> The main disadvantage being it's another unknown unfamiliar syntax, rather than
> actually reusing the de-facto standard for expressing expanded QNames.

As opposed to being *almost* the same as an existing syntax, and having two different ways to represent a URI literal in the same language ;->

Pure Clark notation won't parse in our grammar. We're going to have to modify it somehow. We may as well do it in a way that leverages the existing design of our language.

I also think my proposed syntax is clear about whitespace handling. Anyone who knows XQuery knows what whitespace is in the URI for the following QName:

Q{ "http://example.com/gratia":lpart }

We can define the whitespace rules for the following syntax, but whatever definition we choose, it's one more thing to learn:

Q{ http://example.com/gratia }lpart

Should the above constant be allowed? If so, what whitespace does the URI contain?
Comment 9 Andrew Coleman 2012-02-13 08:37:09 UTC
I would favour John and Norm's proposal in comment 1...

Q{http:example.com}foo
Comment 10 Christian Gruen 2012-02-14 08:33:09 UTC
Thanks for discussing this issue; I would favor the Clark notation as well. Just to get sure: will the new proposed syntax be compatible with the existing syntax for computed constructors (e.g.: attribute Q{"text"} )?
Comment 11 John Snelson 2012-02-14 08:40:37 UTC
Yes, the expanded QName syntax will be parsed with ws:explicit - ie: as a single token. This disambiguates it from existing syntax.
Comment 12 John Snelson 2012-02-14 15:41:11 UTC
The joint working groups decided to resolve this bug by changing the EQName syntax to use the suggestion in comment #2.
Comment 13 Michael Kay 2012-03-08 23:07:18 UTC
The output of fn:path() also changes as a result of this decision. The changes have been made.