Hello,
I just found the problem with my code and the Invalid options node
error message! Sorry for bothering you, it works now.
> xdmp:spawn(
> "/app/backend/query-doi.xqy",
> (xs:QName("doi"), $doi, xs:QName("dir"), $dir),
> <b>tested {$doi} ...</b>
> )
The line <b>tested {$doi} ...</b> should not have been *inside* the
spawn function, because it was of course considered the third
parameter of this function which is an options element ...
cheers,
Jakob.
On Tue, Jul 7, 2009 at 00:13, Jakob Fix<[email protected]> wrote:
> Thanks Mark,
>
> yes, in the meantime I was able to progress a little bit. Now I have
> my two modules, one with the for clause which is supposed to spawn the
> other module. This seems to work as far as the spawning is concerned,
> however, the spawned module now throws this error message
>
> "Invalid options node"
>
> for each time it is spawned. Here are the two modules for your kind
> consideration:
>
> ----- module 1 ------
> xquery version "1.0-ml";
> declare namespace xh = "http://www.w3.org/1999/xhtml";
> declare variable $doi-dir := "/data/2009/07/05/";
>
> (: cycle over all DOI values using cts:element-values() and xdmp:spawn
> a "thread" for each :)
> for $doi in cts:element-values(xs:QName("DOI"))
> return
> <div>
> {
> try {
> xdmp:spawn(
> "/app/backend/query-doi.xqy",
> (xs:QName("doi"), $doi, xs:QName("dir"), $dir),
> <b>tested {$doi} ...</b>
> )
> } catch( $e) {
> <span>
> Problem while checking {$doi}:
> <i
> xmlns:e="http://marklogic.com/xdmp/error">{$e/e:message/text()}</i>
> </span>
> }
> }
> </div>
>
> ----- module 2 ------
> declare variable $doi as xs:string external;
> declare variable $dir as xs:string external;
> (: declare variable $doi := "abc"; :)
> (: declare variable $dir := "/data/2009/07/05/"; :)
>
> declare variable $doi-prefix := "10.1787";
> declare variable $open-url :=
> "http://www.crossref.org/openurl/?pid=YY:XX&noredirect=true";
> declare variable $doi-url := fn:concat($open-url, "&id=doi:",
> $doi-prefix, "/", $doi);
> declare variable $uri := fn:concat($dir, $doi, ".xml");
>
> xdmp:document-load(
> $doi-url,
> <options xmlns="xdmp:document-load">
> <uri>{$uri}</uri>
> </options>
> )
>
> The weird thing is that this works when module 2 is run on its own,
> but not when it's spawned from module 1. In the latter case I always
> get the above error message. It's starting to drive me insane ...
>
> Thanks anyway for your help!
>
>
> Jakob.
>
>
>
> On Mon, Jul 6, 2009 at 21:04, Mark
> Helmstetter<[email protected]> wrote:
>> Jakob,
>>
>> Looking at your code snippet, assuming that's the whole query, it looks like
>> you're missing the return clause:
>>
>> let $all-dois := cts:element-values(xs:QName("DOI"))
>> return $all-dois
>>
>>
>> --Mark
>>
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general