Xquery brackets without FLWOR

Hi, I have a little lame question, but can't find the answer.

what happens if you leave the void bracket constructor?

eg.

{data(doc("somedata.xml")//node[0])}

I mean, I know what’s going on, but what is it considered in the analysis?

What is it like?

{
    for $i in "0"
    return
    data(doc("somedata.xml")//node[0])
}
+3
source share
2 answers

It is a common misconception that any XQuery is a FLWOR expression. This misconception arises when people approach XQuery in terms of SQL, treating it as SELECT.

In fact, this is not so; the FLWOR expression is in many ways another expression. Maybe the FLWOR statement is executed as an SQL statement, but this is not necessary.

XQuery (, Haskell), (, ).

1+2 - XQuery, 1 2, FLWOR.

XQuery , . .

:

for $x in ...
for $y in ...
where $x/@name=$y/@name
return $x

, , for , $x $y. , . $x $y , .

//foo

. FLWOR let ( , ). . , ( ) XQuery .

+3

. " void"?

node, . . , FLWOR. FLWOR - .

,

<p> {data(doc("somedata.xml")//node[0])}</p>

<p> {data(doc("somedata.xml")//node[0])}</p>

Console.WriteLine("foo");

foreach (int x in new string[] {"0"})
  Console.WriteLine("foo")

#.

Formal Semantics, , :

element {p}
{
  fs:item-sequence-to-node-sequence(
    fn:data(
      fs:distinct-doc-order-or-atomic-sequence(
        let $fs:sequence :=
          fs:distinct-doc-order-or-atomic-sequence(
            let $fs:sequence := doc("somedata.xml")
            let $fs:count := count($sequence)
            for $fs:dot at $fs:position in $fs:sequence
            return $fs:dot/descendant-or-self::node())
        let $fs:count := count($fs:sequence)
        for $fs:dot at $fs:position in $fs:sequence
        return item-at($fs:dot/child::node, 0)
      )
    )
  )
} 
0

Source: https://habr.com/ru/post/1724820/


All Articles