[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] CUP and JFlex for Qexo
From: |
Joseph Coffland |
Subject: |
Re: [Qexo-general] CUP and JFlex for Qexo |
Date: |
Sun, 22 Feb 2004 15:33:47 -0500 |
Per Bothner,
> [In future, try to "reply all" for topics that might be of general
> interest. I think this one is.]
Will do.
> > I started looking at this because Kawa is A) a very cool project and B) I
> > need a good XQuery implementation. BUT, I need 'declare variable $x
> > extern'
> > support. I started trying to hack it in and got lost in your recursive
> > descent
> > parser. Adding a '--parm <name> <expr>' option was no problem. I have
> > not
> > been able to figure out how to 1) compile the expression and 2) map it in
> > the
> > XQuery context or focus. You also mentioned on the list that there are
> > namespace
> > issues involved as well.
>
> I'm delayed here because the XQuery specifications are incomplete
> and inconsistent about initializing variables. Specifically, how
> to handle cross-modules variable references. I've posted some
> inquiries, and gotten some feedback, but the situation is still muddled,
> as far as I can tell.
>
> So this leads to the issue of how to implement a variable: a Symbol,
> or a field in a class, or a method that lazily initializes the variable
> if it hasn't been set yet. The older code uses a Symbol, but a method
> might be better, depending on the specific XQuery semantics needed.
>
> Handling 'external' variables is I think simple. Basically, we
> can treat:
> declare variable $x external;
> as:
> declare variable $x { qexo:lookup-external-variable("x") };
> (though we should use a Symbol in place of "x"). This isn't
> quite right, since we might want to pass the expect type to
> lookup-external-variable; we might also need to enter $x in a
> table a variables that need a value. But it will do for now.
>
> Then the exact implementation of qexo:lookup-external-variable
> is pragmatics issue. A command-line parameter is one option.
All I really need is to be able to pass filenames in from the command
line.
I don't want to have to build an XML file to do this. For me it is not
critical that everything the 'external' feature is supported exactly to
spec. I noticed some other users also need this feature. Maybe they
feel the same way I do about it.
Using a method seems easier to me. A mistake I made when trying to
implement
this feature was to get caught up in trying to pass in not just values
but expressions. If you just assume the variable value is a string then
it should be easy. XQuery expressions will coerce the value into a
number
or what ever else when necessary. Of course if you implement the 'as
xs:integer'
XQuery syntax this is solved. SUN has release an implementation of the
Schema data types, but I don't like SUN's licensing.
> A follow-up goal: Implement 'validate' expressions. I assume Xerces
> has a node where you can pass XNI events to the validator, so we need
> a wrapper to convert Consumer events to XNI events.
First I want to clarify that I was wrong about PSVI support in Xerces-J.
It is supported in Xerces2-J. It is not necessary to use XNI. IMHO it
is better to use SAX than XNI because you avoid locking in your
implementation to Xerces.
I'll look in to implementing this.
Joseph
--
Joseph Coffland
address@hidden
[Qexo-general] XQuery as CGI scripts, Jun Yu, 2004/02/21