Hi Pedro,
I've released a patch 1.2.1 to:
http://www.cfoster.net/sedna/xmldb/download/
Should work fine now. Let me know if you have any other problems.
Regards,
Charles
> Hi Charles, thanks for the quick reply, but unfortunatly tt doesn't quite
> work yet :(
> The original problem still remains, as the variable declaration is being
> put
> before the module import (i am using
> the second patch you sent) and the module import has the wrong syntax.
> Check
> bellow:
>
> My Original XQUery expression
>
> let $groups := mdr:getMRIInstanceGroups($concept)
> return
> <Projects>
> {
> for $group in $groups
> return
> <Project>{$group}</Project>
> }
> </Projects>
>
>
> The Java Code that's called to execute the query (the @xquery parameter
> has
> the content of the previous query
> and the @params parameter is an hashmap with the "concept" variable)
> public String executeXQueryWithParams(String xquery,
> HashMap<String,String>
> params) throws XMLDBException
> {
> //Import Module
> xqs.declareModuleNamespace("mdr", "http://mdr.di.fct.unl.pt");
> if (params != null)
> {
> if (params.size() > 0)
> {
> Iterator<String> it = params.keySet().iterator();
> while (it.hasNext())
> {
> String name = (String) it.next();
> xqs.declareVariable(name, params.get(name)); //Declare variable
> }
> }
> }
> ResourceSet res = xqs.query(xquery); //Error is raised here (see the query
> bellow)
> }
>
>
> The Query that's executed against the Database
>
> 1 declare variable $concept := xs:string("mdr://
> www.di.fct.unl.pt/Project&1");
> 2 import module namespace mdr := "http://mdr.di.fct.unl.pt";
> 3 let $groups := mdr:getMRIInstanceGroups($concept)
> 4 return
> 5 <Projects>
> 6 {
> 7 for $group in $groups
> 8 return
> 9 <Project>{$group}<Project>
> 10 }
> 11 <Projects>
>
> As you can see, in line 1 the variables are still showing up first and,
> more
> importantly, the import module
>
> statement is not 100% correct as it should be "namespace mdr --> = <--
> "http" (and not with " := " )
>
> At first I tried declaring the module import AFTER the variable
> declaration
> and thought the problem was from there
> but after putting it after the variable declaration the result is the
> same.
>
> Another question that matters to me is the following... even if this
> situation is corrected, how can I re-use a
> XQuery expression that I already have, that has a namespace declaration
> (and
> imports the module and uses
> variables)?
>
> The query is something like
> import module namespace mdr = "http://mdr.di.fct.unl.pt"
> declare namespace tt = "http://www.fct.unl.pt"
>
> declare function tt:getObjects($param as xs:string)
> { ... };
>
>
> let $result := tt:getObjects($EXTERNAL_VARIABLE_SET_WITH_XMLDB_API) return
> $result
>
> In order to use XML:DB API with this query, can I use it like this, or I
> have to take out the Import and namespace
> declaration? (It would be really neat if you could detect where the
> namespace declarations and module declaration
> finishes and declare the external variables after that part)
> Also, I thank you very much for the great work in this API and I'm certain
> you have your reasons for not doing it
> up until now, but have you considered releasing the source code for the
> XML:DB API as opensource?
> Anyway, thanks alot for your effort, it's always nice to see a developer
> put
> some much work and effort in a good
> piece of software
>
> Another issue regarding the XML:DB API that i Have it that it does not
> recognize the privileges (declared as static int in the Privileges class)
> When trying to access those values (when I want to create a new role) the
> API says the values are undefined, any ideias?
>
> Many thanks again :)
>
> On Tue, Oct 27, 2009 at 7:10 PM, Charles Foster <[email protected]>
> wrote:
>
>> UPDATED
>>
>> If it works Pedro, please reply to the the the discussion forum and I
>> will
>> post it on CFoster.net immediately.
>>
>> Thanks for your help.
>>
>> Regards,
>>
>> Charles
>>
>
>
>
> --
> Pedro Pereira
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion