[Bug 26324] New: XQuery 3.0's PostfixExpr is not properly represented in XQueryX 3.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 26324] New: XQuery 3.0's PostfixExpr is not properly represented in XQueryX 3.0

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26324

            Bug ID: 26324
           Summary: XQuery 3.0's PostfixExpr is not properly represented
                    in XQueryX 3.0
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: XQueryX 3.0
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

In XQuery 3.0, the following expression is apparently valid:
   12(1,2)[3]
and is represented by the following BNF:
   PathExpr ::= ...
              | RelativePathExpr
   RelativePathExpr ::= StepExpr
   StepExpr ::= PostfixExpr | ...
   PostfixExpr ::= PrimaryExpr (Predicate | ArgumentList)*
   PrimaryExpr ::= Literal | ...

(Note: I don't claim that I understand why anybody would write such an
expression, but it is apparently valid.)

The expressions is accepted by our syntax checker and produces the following
parse tree:

|START [1:0 - 1:10]
|   QueryList [1:0 - 1:10]
|      Module [1:0 - 1:10]
|         MainModule [1:0 - 1:10]
|            Prolog [1:0 - 0:0]
|            QueryBody [1:0 - 1:10]
|               Expr [1:0 - 1:10]
|                  PathExpr [1:0 - 1:10]
|                     PostfixExpr [1:0 - 1:10]
|                        IntegerLiteral 12 [2:1 - 1:2]
|                        ArgumentList [2:1 - 1:7]
|                           Argument [2:3 - 1:4]
|                              PathExpr [2:3 - 1:4]
|                                 PostfixExpr [2:3 - 1:4]
|                                    IntegerLiteral 1 [2:4 - 1:4]
|                           Argument [2:5 - 1:6]
|                              PathExpr [2:5 - 1:6]
|                                 PostfixExpr [2:5 - 1:6]
|                                    IntegerLiteral 2 [2:6 - 1:6]
|                        Predicate [2:7 - 1:10]
|                           Expr [2:8 - 1:9]
|                              PathExpr [2:8 - 1:9]
|                                 PostfixExpr [2:8 - 1:9]
|                                    IntegerLiteral 3 [2:9 - 1:9]

Note particularly the appearance of "PostfixExpr" in the parse tree.

However, in the XQueryX translation produced by the syntax checker, that same
expression transforms to:

<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2005/XQueryX
                                http://www.w3.org/2005/XQueryX/xqueryx.xsd">
  <xqx:mainModule>
    <xqx:queryBody>
      <xqx:pathExpr>
        <xqx:stepExpr>
          <xqx:filterExpr>
            <xqx:dynamicFunctionInvocationExpr>
              <xqx:functionItem>
                <xqx:integerConstantExpr>
                  <xqx:value>12</xqx:value>
                </xqx:integerConstantExpr>
              </xqx:functionItem>
              <xqx:arguments>
                <xqx:integerConstantExpr>
                  <xqx:value>1</xqx:value>
                </xqx:integerConstantExpr>
                <xqx:integerConstantExpr>
                  <xqx:value>2</xqx:value>
                </xqx:integerConstantExpr>
              </xqx:arguments>
            </xqx:dynamicFunctionInvocationExpr>
          </xqx:filterExpr>
          <xqx:predicates>
            <xqx:integerConstantExpr>
              <xqx:value>3</xqx:value>
            </xqx:integerConstantExpr>
          </xqx:predicates>
        </xqx:stepExpr>
      </xqx:pathExpr>
    </xqx:queryBody>
  </xqx:mainModule>
</xqx:module>

In this case, please note that the <xqx:functionItem> is an
<xqx:integerConstantExpr> (12) followed by <xqx:arguments> (1 and 2).

The XQueryX 3.0 stylesheet would (does) transform to the original expression:
   12(1,2)[3]
But that is more an accident than a planned chain of events.

DOES THE XQUERYX COMMUNITY BELIEVE THAT THIS SHOULD BE "FIXED"?  I presume that
the fix would be to permit XQueryX code that looks something like this:

<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2005/XQueryX
                                http://www.w3.org/2005/XQueryX/xqueryx.xsd">
  <xqx:mainModule>
    <xqx:queryBody>
      <xqx:pathExpr>
        <xqx:stepExpr>
          <xqx:postfixExpr>
            <xqx:integerConstantExpr>
              <xqx:value>12</xqx:value>
            </xqx:integerConstantExpr>
            <xqx:arguments>
              <xqx:integerConstantExpr>
                <xqx:value>1</xqx:value>
              </xqx:integerConstantExpr>
              <xqx:integerConstantExpr>
                <xqx:value>2</xqx:value>
              </xqx:integerConstantExpr>
            </xqx:arguments>
          </xqx:postfixExpr>
          <xqx:predicates>
            <xqx:integerConstantExpr>
              <xqx:value>3</xqx:value>
            </xqx:integerConstantExpr>
          </xqx:predicates>
        </xqx:stepExpr>
      </xqx:pathExpr>
    </xqx:queryBody>
  </xqx:mainModule>
</xqx:module>

(Note the use of <xqx:postfixExpr>, which does not appear at all in the XQueryX
3.0 schema or stylesheet.)

I believe that I have no choice but to make this kind of fix in XQueryX 3.1
because of the new alternatives in the production for PostfixExpr, and I
*think* (I'm still working on it) I can do so with full XQueryX 3.0
compatibility with or without "fixing" this problem in XQueryX 3.0.

Guidance, please!!

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26324] XQuery 3.0's PostfixExpr is not properly represented in XQueryX 3.0

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26324

Jim Melton <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jim Melton <[hidden email]> ---
Upon additional consideration, especially after re-reading XQuery 3.0, section
3.2 "Postfix Expressions", last paragraph:

   An expression (other than a raw EQName) followed by an argument list in
parentheses (that is, E1(E2, E3, ...)) is referred to as a dynamic function
call. Its effect is to evaluate E1 to obtain a function, and then call that
function, with E2, E3, ... as arguments. Dynamic function calls are described
in 3.2.2 Dynamic Function Call.

I have concluded that the specific case of 12(1,2) is a useless artifact of
allowing far more useful expressions such as $x(1,2) (which is a
DynamicFunctionInvocation).

The cost in "fixing" the case of 12(1,2) to be a (useless) Postfix Expression
instead of a Dynamic Function Invocation is in no way worth the effort,
particularly as it doesn't actually change any results.

I am therefore marking this bug RESOLVED/INVALID and then marking it CLOSED.

Sorry for the interruption.  Please carry on.

--
You are receiving this mail because:
You are the QA Contact for the bug.

Reply | Threaded
Open this post in threaded view
|

[Bug 26324] XQuery 3.0's PostfixExpr is not properly represented in XQueryX 3.0

Bugzilla from bugzilla@jessica.w3.org
In reply to this post by Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26324

Michael Kay <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #2 from Michael Kay <[hidden email]> ---
The expression 12(1) is syntactically valid but is always a type error (rather
like the expression ("London"+1). So you're really asking a policy question:
should XQueryX be able to represent every syntactically-valid XQuery
expression, or should it only be required to represent expressions that have no
static errors. (And then the sub-question, are type errors regarded as static
errors for this purpose?)

--
You are receiving this mail because:
You are the QA Contact for the bug.