Hi Marv,

To summarize, there are roughly four ways to retrieve docs:
1. Get all docs using doc() and inspect the uri (base-uri() or xdmp:node-uri()) 
with string functions or operators
2. Use cts:uri-match()
3. Navigate around the database using xdmp:directory(), but that is easiest if 
you have some clue as to where to look
4. Search based on contents, using something like /xs:sche...@targetnamespace = 
'myns'] or something like that.

There are variations possible using cts:search and related functions, but it 
all basically comes down to this I guess..

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant


Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984

P Please consider the environment before printing this mail.
De informatie - verzonden in of met dit e-mailbericht - 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: [email protected]
> [mailto:[email protected]] On Behalf Of
> Lee, David
> Sent: donderdag 13 mei 2010 22:50
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] How to query files from
> the schemadatabase?
>
> a slow way might be
>
>                 doc()[fn:base-uri(.) eq 'foo.xsd']
>
>
>
>
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> cOre dUmPeR
> Sent: Thursday, May 13, 2010 4:45 PM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] How to query files from
> the schemadatabase?
>
>
>
> Ok, xdmp-eval() did the trick.
>
>     xdmp:eval-in('doc("foo.xsd")', xdmp:schema-database())
>
> Again, this only gets me "foo.xsd" at the root of the schema
> DB. I do know the content of the schema, and the schema file
> name. But when I look in the schema database in CQ....I see
> that the schema files are not at "/foo.xsd", instead they are
> at "/some/path/foo.xsd". This path *may* change with
> different schema files...so I'd rather just search for the
> file by basename.
>
> Is cts:uri-match("*/foo.xsd") the only way to *look for*
> files in a database when you dont know the preceding path?
>
> thanks,
> /marv
>
>
>
> --- On Thu, 5/13/10, Strawn, M. Shane
> <[email protected]> wrote:
>
>
> From: Strawn, M. Shane <[email protected]>
> Subject: Re: [MarkLogic Dev General] How to query files from
> the schema database?
> To: "General Mark Logic Developer Discussion"
> <[email protected]>
> Date: Thursday, May 13, 2010, 1:26 PM
>
> I think you might get more detailed answers... but two parts:
>
>
>
> 1) in order to hit the Schemas database, or any database that
> is not the main db of your app, you should do an xdmp:eval()
> or xdmp:invoke(), of which one of the options is which
> database to target the query to.
>
>
>
> 2) if you have no idea about your schema uris, only doc file
> names, I think you could use
>
> cts:uri-match("*/foo. <http://*.html> xsd")
>
> ...IF you have the uri lexicon turned on in the schemas db config.
>
>
>
> ~Shane
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> cOre dUmPeR
> Sent: Thursday, May 13, 2010 4:04 PM
> To: [email protected]
> Subject: [MarkLogic Dev General] How to query files from the
> schema database?
>
> Question:
>
> ________________________________
>
> How do you write a ML-XQuery program *searches* the the
> Schema database for a schema of a particular name, lets say
> "foo.xsd", and writes it to disk?
>
> I know if there was a doc named "foo.xml" in the document
> database, I could just do:
>
>    doc("foo.xml")
>
> but the file i'm interested in is in the schema database.
> Also, I only know the base name of the file "foo.xsd"...and I
> dont know the path in the schema database...for example, the
> schema file could be in /path/to/foo.xsd or if could be in
> /foobar/foo.xsd. So I have to be able to *find* the schema file first.
>
> I have gone over the ML4.1 docs...and have had little luck
> finding out how to do this.
>
> I realize in CQ I can just change the "content-source"...but
> my little app will of course exist outside of CQ.
>
>
> Context:
>
> ________________________________
>
> I have an install of MLS 4.1 at work. It is already populated
> with plenty of XML docs and Schema files.
>
> I am a MLS n00b...but have a good amount of experience with
> XML and programming in General.
>
>
> thanks in advance,
> /marv
>
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to