Matthew,

According to the dump you're using ISQL client. That client uses $ as a
special character that is the beginning of macro to expand. You can
either use \044 escape sequence in strings in order to avoid macro
expansion at alient side or $$ that will be replaced by ISQL with single
$. I'd recommend to use \044 to be able to run queries unchanged from
other clients.

Same problem happens with SPARQL queries that use $variablename syntax
as well, but SPARQL is developed after XQuery so it was possible to
avoid known issues. Hence SPARQL let ?variablename syntax as a
replacement for $variablename.

Best Regards,

Ivan Mikhailov,
OpenLink Software.

On Sat, 2008-03-01 at 01:33 -0800, Matthew Graham wrote:
> Hi,
> 
> I have a table with schema: (id varchar, event long xml). Using isql I  
> try the following query:
> 
> select xquery_eval('declare namespace 
> vo="http://www.ivoa.net/xml/VOEvent/v1.1 
> " let $val:=vo:VOEvent[Citations/EventId = "ivo://gcn.gsfc/172767"]  
> return <events>{$val}</events>', event) from voevent..events;
> 
> which throws up this error:
> 
> /usr/local/virtuoso-opensource/bin/isql: get_next_token: Unknown macro  
> word "val:" at line 16 of Top-Level
> /usr/local/virtuoso-opensource/bin/isql: get_next_token: Unknown macro  
> word "val" at line 16 of Top-Level
> 
> *** Error 37000: [Virtuoso Driver][Virtuoso Server]XM029: XQuery  
> interpreter, line 1: syntax error at vo
> at line 16 of Top-Level:
> select xquery_eval('namespace vo="http://www.ivoa.net/xml/VOEvent/ 
> v1.1" let NULL=vo:VOEvent[Citations/EventId = "ivo://gcn.gsfc/172767"]  
> return <events>{NULL}</events>', event) from voevent..events
> 
> I've tried just doing 'namespace vo=...' and also putting a semicolon  
> after the namespace declaration but neither works. I'd use an XPath  
> statement if possible but this does not let you declare the namespace  
> - or is there a Virtuoso hack for this?
> 
> What am I doing wrong - I am using Virtuoso 5.0.3 on Mac 10.5.1.
> 
>       Cheers,
> 
>       Matthew
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Reply via email to