Ron,

The URI worked great.  Thanks!

I tried using the xdmp:document-load() as you mentioned, but I'm still 
struggling with the syntax and where to find the documentation.  I downloaded 
the entire documentation set, but I'm still finding my way around.

This is what I tried as I understood your suggestion:

xquery version "1.0-ml";
xdmp:document-load( "/C/software/MarkLogic Server/db/people/people.xml",
 <options xmlns="xdmp:document-load">
          <uri>/people</uri>
          <format>xml</format>
 </options> )
for $person in doc( "/people/people.xml" )/people/person 
return (
<div>
$person/@name
<a href="delete.xqy?path={ xdmp:path($person) }">delete</a>
</div>
)

This is not correct syntax. 

But with the URI replacement you gave me I am in business.  Thanks.

Scott 




________________________________
From: Ron Hitchens <[email protected]>
To: General MarkLogic Developer Discussion <[email protected]>
Sent: Sun, April 3, 2011 5:09:45 AM
Subject: Re: [MarkLogic Dev General] Working with loaded data


  The name (actually the URI) of your document in
MarkLogic is "/C/software/MarkLogic Server/db/people/people.xml",
not simply "people.xml".

  A collection of documents in MarkLogic is not a
disk-style filesystem, even though it can often be
treated that way.  Whenever you reference a specific
document by name you need to provide the full and
complete URI.  Think of document URIs as more like
hash keys than filenames.

  Use the xdmp:document-load() function to load
a document and assign your preferred URI.

On Apr 3, 2011, at 6:16 AM, Scott wrote:

> I just downloaded MarkLogic Server 4.2 and have created a database and loaded 
>some data.  I'm brand new to this, so I have a basic question on how to 
>specify 
>a document to query.
>  
> I followed this tutorial for setting up a new database with the Shakespeare 
>data.  But I'll go through a simple scenario of creating everything from 
>scratch.
>     • Create a new database called "people"
>     • Create a new forest called "people", no data directory specified
>     • Create a new HTTP App Server called "people", specify a root folder, 
> port 
>8012, selected database "people"
>     • Copy the cq folder from the samples folder
>     • Copy an xml file to the http server root called people.xml.  Here is 
> the 
>contents:
>     • <people>
> <person name="bob" />
> <person name="jim" />
> <person name="bob" />
> <person name="ryan" />
> </people>
> 
>     • I load the data using the load tab of the people database screen.
>     • In CQ->explore, I see:  /C/software/MarkLogic 
> Server/db/people/people.xml 
>– element people (properties)  (no collections)
>     • Now I can query this data:
> xquery version "1.0-ml";
> for $person in doc()/people/person 
> return (
> <div>
> $person/@name
> <a href="delete.xqy?path={ xdmp:path($person) }">delete</a>
> </div>
> )
> 
>  
> There are some problems with this query that some research will help me to 
>figure out--the results look like this:
> 
>  
> $person/@name delete
> $person/@name delete
> $person/@name delete
> $person/@name delete
> 
>  
> --but I'm getting the right number of results.  My question is, how to I 
> target 
>a document by name?
> 
>  
> If I change the doc() call above to read doc( "people.xml" ), I get an emtpy 
>return set in response.  I need this to work because I have several xml files 
>loaded into the database I'm trying to work with, and I want to be specific.
> 
>  
> Thanks for helping out!
> 
>  
> Scott 
> 
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

---
Ron Hitchens {mailto:[email protected] Ronsoft Technologies
    +44 7879 358 212 (voice)          http://www.ronsoft.com
    +1 707 924 3878 (fax)              Bit Twiddling At Its Finest
"No amount of belief establishes any fact." -Unknown




_______________________________________________
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