Marc Moskowitz | 2 Dec 2006 00:02
Favicon

[MarkLogic Dev General] Preserving namespaces when copying documents between databases

Hello!

Is there a reliable way to copy a document from one database to another without losing namespace information? I have tried using xdmp:save and performing a backup and restore of the forest, but neither method reliably preserved the namespaces of all document elements.

Thank you.

-Marc Moskowitz

Interactive Factory

<div>

<div class="Section1">

<p class="MsoNormal"><span>Hello!<p></p></span></p>

<p class="MsoNormal"><span>Is there a reliable way to copy a document from one database
to another without losing namespace information? I have tried using xdmp:save
and performing a backup and restore of the forest, but neither method reliably
preserved the namespaces of all document elements.<p></p></span></p>

<p class="MsoNormal"><span>Thank you.<p></p></span></p>

<p class="MsoNormal"><span>-Marc Moskowitz<p></p></span></p>

<p class="MsoNormal"><span>Interactive Factory<p></p></span></p>

</div>

</div>
David Sewell | 15 Dec 2006 18:54
Favicon

[MarkLogic Dev General] cqsh question

Using the cqsh tool, is it possible to load a local file using
xdmp:document-load() within a query, or is the only loading
functionality that supplied by the "load" command or
"cqsh --load file"?

The built-in cqsh load command doesn't provide for passing options in
the way that xdmp:document-load() does.

DS
--

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell@...   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
Andrew Bruno | 15 Dec 2006 19:23

Re: [MarkLogic Dev General] cqsh question

You can use xdmp:document-load() with cqsh but the file would have to be
located on the server. The only option currently supported in cqsh for
loading local files is passing in a uri.

  cqsh --load -n '/my/doc/uri' /tmp/localfile.xml

or you can give a uri prefix for loading multiple files:

  cqsh --load -i '/docs/' /tmp/*.xml

cqsh is still using the old XDBC libraries under the covers. I'm hoping to
update cqsh to use XCC which has a much better interface for document
loading. What options would you like to see added to cqsh load?

--Andy

> Using the cqsh tool, is it possible to load a local file using
> xdmp:document-load() within a query, or is the only loading
> functionality that supplied by the "load" command or
> "cqsh --load file"?
>
> The built-in cqsh load command doesn't provide for passing options in
> the way that xdmp:document-load() does.
>
> DS
> --
> David Sewell, Editorial and Technical Manager
> ROTUNDA, The University of Virginia Press
> PO Box 400318, Charlottesville, VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: dsewell@...   Tel: +1 434 924 9973
> Web: http://rotunda.upress.virginia.edu/
> _______________________________________________
> General mailing list
> General@...
> http://xqzone.com/mailman/listinfo/general
>
>

Wyatt | 15 Dec 2006 19:45

[MarkLogic Dev General] Application (and session) variables???

Is there such thing as an application level variable in MLS?  Something 
that can be created when MLS starts and is resident in memory all the 
time?  I've looked around the documentation and can't anything, am I'm 
missing something?

On a side note, I've been using session variables in lieu of application 
variables and found some inaccuracies in the documentation for 
xdmp:get-sesssion-field() function...  The documentation says it returns 
a xs:string, but I believe it returns an item().  When I store an 
element() with xdmp:set-session-field(), I get an element() from 
xdmp:get-session-field().  It would also be nice if the default (2nd) 
parameter of xdmp:get-session-field() would take an item rather than an 
xs:string.

Thanks

Wyatt

Danny Sokolsky | 15 Dec 2006 21:32

RE: [MarkLogic Dev General] Application (and session) variables???

Hi Wyatt,

MarkLogic has no concept of what you describe as an application level
variable.  Depending upon what you want to use it for, you could of
course achieve this by storing the information in a document in the
database--then it would always be accessible to applications.

You are indeed correct that the return type of xdmp:get-session-field is
an item()*, nos a string as the doc says.  Also, it would make sense for
the second parameter to take an item()* since that is what it returns.
Thanks for pointing those things out, and I'll take them up with
engineering.

Thanks,
-Danny

-----Original Message-----
From: general-bounces@...
[mailto:general-bounces@...] On Behalf Of Wyatt
Sent: Friday, December 15, 2006 10:45 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Application (and session) variables???

Is there such thing as an application level variable in MLS?  Something 
that can be created when MLS starts and is resident in memory all the 
time?  I've looked around the documentation and can't anything, am I'm 
missing something?

On a side note, I've been using session variables in lieu of application

variables and found some inaccuracies in the documentation for 
xdmp:get-sesssion-field() function...  The documentation says it returns

a xs:string, but I believe it returns an item().  When I store an 
element() with xdmp:set-session-field(), I get an element() from 
xdmp:get-session-field().  It would also be nice if the default (2nd) 
parameter of xdmp:get-session-field() would take an item rather than an 
xs:string.

Thanks

Wyatt

_______________________________________________
General mailing list
General@...
http://xqzone.com/mailman/listinfo/general
David Sewell | 15 Dec 2006 22:03
Favicon

Re: [MarkLogic Dev General] cqsh question

On Fri, 15 Dec 2006, Andrew Bruno wrote:

> You can use xdmp:document-load() with cqsh but the file would have to be
> located on the server. The only option currently supported in cqsh for
> loading local files is passing in a uri.
>
>   cqsh --load -n '/my/doc/uri' /tmp/localfile.xml
>
> or you can give a uri prefix for loading multiple files:
>
>   cqsh --load -i '/docs/' /tmp/*.xml
>
> cqsh is still using the old XDBC libraries under the covers. I'm hoping to
> update cqsh to use XCC which has a much better interface for document
> loading. What options would you like to see added to cqsh load?

With our current use case, the "permissions" and "collections" options,
but the ideal would be access to everything that xdmp:document-load()
allows.

Thanks for the work on cqsh--it's a handy tool for a lot of things.

--

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell@...   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
Tim Finney | 15 Dec 2006 22:11
Favicon

Re: [MarkLogic Dev General] Application (and session) variables???

As it happens, a request for enhancement was submitted yesterday after
discussion over how one might store XML fragments on a per-session
basis.

Best

Tim Finney
Programmer
UVa Press

On Fri, 2006-12-15 at 13:45 -0500, Wyatt wrote:
> Is there such thing as an application level variable in MLS?  Something 
> that can be created when MLS starts and is resident in memory all the 
> time?  I've looked around the documentation and can't anything, am I'm 
> missing something?
> 
> On a side note, I've been using session variables in lieu of application 
> variables and found some inaccuracies in the documentation for 
> xdmp:get-sesssion-field() function...  The documentation says it returns 
> a xs:string, but I believe it returns an item().  When I store an 
> element() with xdmp:set-session-field(), I get an element() from 
> xdmp:get-session-field().  It would also be nice if the default (2nd) 
> parameter of xdmp:get-session-field() would take an item rather than an 
> xs:string.
> 
> Thanks
> 
> Wyatt
> 
> 
> _______________________________________________
> General mailing list
> General@...
> http://xqzone.com/mailman/listinfo/general

Charles Blair | 16 Dec 2006 04:13
Favicon

[MarkLogic Dev General] sorting efficiency question

hello all. i need to do a 3-level sort, somewhat as follows:

let $docs := for $i in fn:distinct-values($results//titleName),
                  $j in fn:distinct-values($results//titleTypeName),
                   $k in fn:distinct-values($results//titlePhotoSequenceNumber)
             let $p := $results[//titleName = $i and
                                //titleTypeName = $j and
                                //titlePhotoSequenceNumber = $k]
             order by $i, $j, $k
             return $p

the above works, and is easy enough to write, but it's not terribly
speedy at returning results. does someone have, or can someone
suggest, a better approach? 

thanks.
Andrew Bruno | 18 Dec 2006 19:11

Re: [MarkLogic Dev General] cqsh question

I've released a new version of cqsh (0.5.0) which supports a few new load
options: --permission, --collection, --quality, and --type. I also
re-factored the code to use the latest XCC java libraries. I haven't done
much testing so let me know if things break.

You can download here:
  http://xqzone.marklogic.com/svn/cqsh/releases/cqsh-0.5.0-bin.zip

Example load options:

 cqsh -l -n /myuri.xml -c mycollection -x read:admin -t xml -q 20 /file.xml

--Andy

>
> With our current use case, the "permissions" and "collections" options,
> but the ideal would be access to everything that xdmp:document-load()
> allows.
>
> Thanks for the work on cqsh--it's a handy tool for a lot of things.
>
> --
> David Sewell, Editorial and Technical Manager
> ROTUNDA, The University of Virginia Press
> PO Box 400318, Charlottesville, VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: dsewell@...   Tel: +1 434 924 9973
> Web: http://rotunda.upress.virginia.edu/
> _______________________________________________
> General mailing list
> General@...
> http://xqzone.com/mailman/listinfo/general
>
>

Wyatt | 18 Dec 2006 22:25

[MarkLogic Dev General] Content-Type, xdmp:get-request-field() and xdmp:get-request-body()

I'm running into a problem using xdmp:get-request-field() with POST 
requests...

According to the xdmp:get-request-body() documentation:
"If the content-type of the POST body is 
application/x-www-form-urlencoded, it is not available here, but instead 
is available in its decoded form through xdmp:get-request-field-names() 
and xdmp:get-request-field()."

I've trying to upgrade to the latest (1.5.0_rc2) Prototype Framework 
(http://prototype.conio.net), and they now add a charset parameter to 
the Content-Type header field...

     application/x-www-form-urlencoded; charset=UTF-8

This changes how MLS interprets the Content-Type and the data is only 
available via xdmp:get-request-body().  I'd much rather MLS know that 
this if form data, parse it, and make it available via 
xdmp:get-request-field().  This means no changes to my XQuery code.

My question is whether this is a short-coming of MLS that is likely to 
change, in which case I can hack the Javascript and leave my XQueries 
alone, or if this is intentional and I should update my XQueries to use 
xdmp:get-request-body() and parse the body data?

Thanks to anyone with guidance on this issue.

Wyatt


Gmane