RE: Variable Declaration in Query Prolog

In many XQuery implementations you will have a tight coupling of schema
to storage layout, indexing and typing. Thus, decoupling will not work.
I am willing to see this as a v2 item but not as a v1 item since I feel
there is too much research hidden to make it implementable for anything
but some research prototype.

As to typing variables, I again think this can wait. Especially since
this will reopen the expectations and discussions about side-effects
with variables.

Best regards
Michael

> -----Original Message-----
> From: TAN Kuan Hui [mailto:kuanhui@mobileworkspace.com]
> Sent: Thursday, February 07, 2002 19:04 PM
> To: Michael Rys; www-ql@w3.org
> Cc: Jonathan Robie; Per Bothner
> Subject: Re: Variable Declaration in Query Prolog
> 
> > Note that parameterizing namespace and schema declarations basically
> > means that you cannot compile the functions (since the type
information
> > becomes dynamic). This is not something I need in a v1.0 standard or
> > implementation.
> >
> agree but this is only on the assumption that the schema remains
static
> wrt to the given namespace; hard when the schema can potentially
> have deep dependencies and requires to remain static for the
> lifetime of the compiled function. Quite the converse, a
> compiled function's integrity is perhaps better assured if
> namespace and schema are parameterised (via prefixes, say)
> and dependency on type components be factored out into the
> evaluation context.
> 
> Variable typing is however a core issue and I feel that we need to
> get off on the right footing for v1.0.
> 
>    Variable ::= Datatype? "$" QName
> 
> and allow variable declaration in the query prolog,
> [2] QueryProlog ::= (NamespaceDecl
>                                 |  DefaultNamespaceDecl
>                                 |  SchemaImport)* FunctionDefn*
Variable*
> 
> and allow variable assignment,
> 
> VariableAssignment ::= Variable ColonEquals Expr
> 
> [4] Expr ::= SortExpr
>       |  ....
>       |  PathExpr
>       |  VariableAssignement
> 
> then we can have our construct such as
> xs:string $x = "world"
> <hello>{$x}</hello>
> 
> rather than
> Let $x := "world"
> return <hello>{$x}</hello>
> 
> and we can do this,
> xs:string $userDatabase = "BusinessBooks.xml"
> 
> Let $x := document($userDatabase)//book
> return ....
> 
> then our previous discussion on "environment variable" can
> materialise if the QueryProlog changes to,
> 
> [2] QueryProlog ::= (NamespaceDecl
>                                 |  DefaultNamespaceDecl
>                                 |  SchemaImport)* FunctionDefn* Expr*
> 
> and even better still, completely defunct QueryProlog and
> put its clauses into
> 
> [4] Expr :: = NamespaceDecl
>                    | DefaultNamespaceDecl
>                    | SchemaImport
>                    | FunctionDefn
>                    | SortExpr
>                    | ....
> 
> getting really far fetch huh ? Anyway, will file a short comment note
> to WG.
> 
> best regards,
> Kuan Hui
> 
> 
> 

Received on Thursday, 7 February 2002 22:11:43 UTC