Re: [Sedna-discussion] Using fn:error in XQuery module

2013-02-25 Thread Ivan Lagunov
Hi Ivan,

 

Thanks, a silly mistake.

 

Regards,

Ivan Lagunov

 

From: Ivan Shcheklein [mailto:[email protected]] 
Sent: Monday, February 25, 2013 11:49 AM
To: Ivan Lagunov
Cc: sedna-discussion
Subject: Re: [Sedna-discussion] Using fn:error in XQuery module

 

Hi Ivan,

 

Try this:

 

declare function vp:getMapSubtitle($vp as element(value-proposition)*) as
xs:string? {

if (count($vp) < 2)

then data($vp/topicmeta/subtitle)

else

  let $vp_ids := for $single_vp in $vp return data($single_vp/@id)

  return error(xs:QName("vp:getMapSubtitle"), "More than one VPs
provided", $vp_ids)

};

 

 

On Mon, Feb 25, 2013 at 2:37 PM, Ivan Lagunov  wrote:

Hi all,

 

Is it possible to throw a dynamic error from an XQuery module? I'm referring
to the fn:error function. I get the following error when I try to load my
module:

 

2013/02/25 11:34:29 database query/update failed (SEDNA Message: ERROR
XPST0003

It is a static error if an expression is not a valid instance of the grammar
defined in A.1 EBNF.

Details: at (74:7), syntax error, unexpected QName

 

)

 

This is a function from the module:

 

declare function vp:getMapSubtitle($vp as element(value-proposition)*) as
xs:string? {

if (count($vp) < 2)

then data($vp/topicmeta/subtitle)

else

  let $vp_ids := for $single_vp in $vp return data($single_vp/@id)

  error(xs:QName("vp:getMapSubtitle"), "More than one VPs provided",
$vp_ids)

};

 

Any suggestions?

 

Best regards,

Ivan Lagunov



--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion


Re: [Sedna-discussion] Using fn:error in XQuery module

2013-02-25 Thread Ivan Shcheklein
Hi Ivan,

Try this:

declare function vp:getMapSubtitle($vp as element(value-proposition)*) as
xs:string? {

if (count($vp) < 2)

then data($vp/topicmeta/subtitle)

else

  let $vp_ids := for $single_vp in $vp return data($single_vp/@id)

  *return* error(xs:QName("vp:getMapSubtitle"), "More than one VPs
provided", $vp_ids)

};



On Mon, Feb 25, 2013 at 2:37 PM, Ivan Lagunov  wrote:

> Hi all,
>
> ** **
>
> Is it possible to throw a dynamic error from an XQuery module? I’m
> referring to the fn:error function. I get the following error when I try to
> load my module:
>
> ** **
>
> 2013/02/25 11:34:29 database query/update failed (SEDNA Message: ERROR
> XPST0003
>
> It is a static error if an expression is not a valid instance of the
> grammar defined in A.1 EBNF.
>
> Details: at (74:7), syntax error, unexpected QName
>
>  
>
> )
>
> ** **
>
> This is a function from the module:
>
> ** **
>
> declare function vp:getMapSubtitle($vp as element(value-proposition)*) as
> xs:string? {
>
> if (count($vp) < 2)
>
> then data($vp/topicmeta/subtitle)
>
> else
>
>   let $vp_ids := for $single_vp in $vp return data($single_vp/@id)
>
>   error(xs:QName("vp:getMapSubtitle"), "More than one VPs provided",
> $vp_ids)
>
> };
>
> ** **
>
> Any suggestions?
>
> ** **
>
> Best regards,
>
> Ivan Lagunov
>
>
> --
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> ___
> Sedna-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
>
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb___
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion