[MarkLogic Dev General] uri-is-file for modules in database

Erik Peterson petersones at ldschurch.org
Mon Feb 9 07:46:52 PST 2009


Geert,

Thanks for your suggestion. That was something tried early on but I  
will revisit it. I'd like to avoid using eval if possible for  
performance reasons.

Seems we should be able to do something like: xdmp:uri-is-file(":my- 
modules-db:here.xqy")...

-Erik


On Feb 9, 2009, at 8:30 AM, Geert Josten wrote:

> Erik,
>
> Xquery files are stored just like other files, but in a different  
> database. Try using something like:
>
>  xdmp:eval(
>    '
>      boolean(doc("here.xqy"))
>    ',
>    (),
>    <options xmlns="xdmp:eval">
>      <database>{xdmp:database('Modules')}</database>
>    </options>)
>
> Mind though, the user executing the eval needs to have eval  
> privileges..
>
> Kind regards,
> Geert
>
>>
>
>
> Drs. G.P.H. Josten
> Consultant
>
>
> http://www.daidalos.nl/
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> http://www.daidalos.nl/
> KvK 27164984
> De informatie - verzonden in of met dit emailbericht - is afkomstig  
> van Daidalos BV en is uitsluitend bestemd voor de geadresseerde.  
> Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het  
> te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
>
>
>> From: general-bounces at developer.marklogic.com
>> [mailto:general-bounces at developer.marklogic.com] On Behalf Of
>> Erik Peterson
>> Sent: maandag 9 februari 2009 16:13
>> To: General Mark Logic Developer Discussion
>> Subject: [MarkLogic Dev General] uri-is-file for modules in database
>>
>> We have an HTTP App server using modules database and a
>> separate content database. We need determine if certain xqy
>> file exists prior to invoking it from within another xqy
>> file. When xqy files were stored in the file system the
>> xdmp:uri-is-file() function worked fine. Now that modules are
>> stored in the database we've been unable to determine file existence.
>>
>> Below is a simple example of a here.xqy file that cannot
>> determine its own existence, all function calls return false.
>> Note that the file exists in the /code/myapp folder and the
>> http root is mapped to that folder:
>>
>> Thanks,
>> Erik
>>
>> ----------------------------------------------------------------
>> xquery version "1.0-ml";
>>
>> "--- uri-is-file",
>> "-here.xqy",
>> xdmp:uri-is-file("here.xqy"),
>> "-/here.xqy",
>> xdmp:uri-is-file("/here.xqy"),
>> "-code/conference/here.xqy",
>> xdmp:uri-is-file("code/myapp/here.xqy"),
>> "-/code/conference/here.xqy",
>> xdmp:uri-is-file("/code/myapp/here.xqy"),
>> "---doc-available",
>> "-here",
>> fn:doc-available("here.xqy"),
>> "-/here",
>> fn:doc-available("/here.xqy")
>>
>> ----------------------------------------------------------------
>>
>>
>>
>>
>> NOTICE: This email message is for the sole use of the
>> intended recipient(s) and may contain confidential and
>> privileged information. Any unauthorized review, use,
>> disclosure or distribution is prohibited. If you are not the
>> intended recipient, please contact the sender by reply email
>> and destroy all copies of the original message.
>>
>>
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general


 NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.




More information about the General mailing list