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