Thanks, Micah,

I was looking for how to convert from something any xs:date object to the
integer that is the UTC value in milliseconds since 1970.

For example, some time on sept 7th resolved to 1252342800000

I ended up not needing the conversion for now, but figured I'd end up just
having to write it myself if/when I really need it.  I just figured someone
else must have needed this at some point and didn't want to duplicate the
testing/bugs :)

Best,
-Eric

On Fri, Sep 4, 2009 at 12:00 PM, <[email protected]>wrote:

> Send General mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://xqzone.com/mailman/listinfo/general
> or, via email, send a message with subject or body 'help' to
>        [email protected]
>
> You can reach the person managing the list at
>        [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of General digest..."
>
>
> Today's Topics:
>
>   1. dateTime cast (Paul M)
>   2. How to insert binary or text document using
>      xdmp:document-insert() function - reg., (Santhosh Raj)
>   3. empty Task Server queue (Mike Whitman)
>   4. RE: How to insert binary or text document using
>      xdmp:document-insert() function - reg., (Danny Sokolsky)
>   5. RE: empty Task Server queue (Danny Sokolsky)
>   6. Re: dateTime cast (David Sewell)
>   7. UTC <-> xs:date in XQuery ? (Eric Bloch)
>   8. Re: UTC <-> xs:date in XQuery ? (Micah Dubinko)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 4 Sep 2009 07:30:36 -0700 (PDT)
> From: Paul M <[email protected]>
> Subject: [MarkLogic Dev General] dateTime cast
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="us-ascii"
>
> Not sure if bug, need workaround ideas regardless..
> 3.2-10
>
> let $x := try{xs:dateTime("1999-01-01TTT0:0:0")} catch($ex) {()}
> let $y := try{ 2 div 0 } catch($ex) {()}
> return $x
>
> Return a dateTime if possible. Otherwise, return empty sequence.
> The second try-catch works. The first does not.
>
> What would you do if you knew one of your casts may fail? My only idea is
> regexp?
>
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://xqzone.marklogic.com/pipermail/general/attachments/20090904/220030ab/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Fri, 4 Sep 2009 20:15:40 +0530
> From: Santhosh Raj <[email protected]>
> Subject: [MarkLogic Dev General] How to insert binary or text document
>        using xdmp:document-insert() function - reg.,
> To: [email protected]
> Message-ID:
>        <of30663fc7.a80867c1-on65257627.0051cb18-65257627.0051e...@tcs.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi all,
>
>        I have to store .txt or .doc,.pdf files in marklogic server using
> xdmp:document-insert() function.
>
> In the Marklogic built-in functions it is represented as following:
>
> xdmp:document-insert(
> $uri as xs:string,
> $root as node(),
> [$permissions as element(sec:permission)*],
> [$collections as xs:string*],
> [$quality as xs:int?],
> [$forest-ids as xs:unsignedLong*]
> )  as  empty-sequence()
>
>
> $root : The root node. The root node can be one of XML format, binary
> (BLOB) format, or text (CLOB) format.
>
> Eg: If i want to store a .txt file (sample.txt) with content as "This is a
> sample text document."
>        or
>      If i want to store a .doc file (sample.doc) with content as "This is
> a sample word document"
>
> then how do i construct the root node of  binary(BLOB) format or
> text(CLOB) format.
>
> How can i insert the document(text/doc) to database.
>
>
> Thanks and Regards,
> Santhosh Rajasekaran
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://xqzone.marklogic.com/pipermail/general/attachments/20090904/fa5c3bf1/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Fri, 04 Sep 2009 11:18:00 -0400
> From: Mike Whitman <[email protected]>
> Subject: [MarkLogic Dev General] empty Task Server queue
> To: General Mark Logic Developer Discussion
>        <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Is there a way to empty the Task Server Queue.  I tried restarting and
> setting queue size to one and restarting.
>
> thanks,
>
> Mike
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 4 Sep 2009 09:36:43 -0700
> From: Danny Sokolsky <[email protected]>
> Subject: RE: [MarkLogic Dev General] How to insert binary or text
>        document        using xdmp:document-insert() function - reg.,
> To: General Mark Logic Developer Discussion
>        <[email protected]>
> Message-ID:
>        <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> You can use the text { } or binary { } or node constructors.
>  xdmp:document-insert will load the document according to the node kind of
> the 2nd parameter.  For example, to store a text file with uri "notxml.xml",
> try something like this:
>
> xquery version "1.0-ml";
> xdmp:document-insert("notxml.xml", text { "This is a text node." } );
> xdmp:node-kind(doc("notxml.xml")/node())
> => text
>
> xquery version "1.0-ml";
> xdmp:document-insert("notxml.xml", binary { "deadbeef" } );
> xdmp:node-kind(doc("notxml.xml")/node())
> => binary
>
> -Danny
>
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Santhosh Raj
> Sent: Friday, September 04, 2009 7:46 AM
> To: [email protected]
> Subject: [MarkLogic Dev General] How to insert binary or text document
> using xdmp:document-insert() function - reg.,
>
>
> Hi all,
>
>         I have to store .txt or .doc,.pdf files in marklogic server using
> xdmp:document-insert() function.
>
> In the Marklogic built-in functions it is represented as following:
>
> xdmp:document-insert(
> $uri as xs:string,
> $root as node(),
> [$permissions as element(sec:permission)*],
> [$collections as xs:string*],
> [$quality as xs:int?],
> [$forest-ids as xs:unsignedLong*]
> )  as  empty-sequence()
>
>
> $root : The root node. The root node can be one of XML format, binary
> (BLOB) format, or text (CLOB) format.
>
> Eg: If i want to store a .txt file (sample.txt) with content as "This is a
> sample text document."
>         or
>       If i want to store a .doc file (sample.doc) with content as "This is
> a sample word document"
>
> then how do i construct the root node of  binary(BLOB) format or text(CLOB)
> format.
>
> How can i insert the document(text/doc) to database.
>
>
> Thanks and Regards,
> Santhosh Rajasekaran
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 4 Sep 2009 09:40:27 -0700
> From: Danny Sokolsky <[email protected]>
> Subject: RE: [MarkLogic Dev General] empty Task Server queue
> To: General Mark Logic Developer Discussion
>        <[email protected]>
> Message-ID:
>        <[email protected]>
> Content-Type: text/plain; charset="us-ascii"
>
> Restarting the server will empty the task queue; the queue itself is only
> persistent in memory.
>
> Keep in mind, however, that if you are doing some cpf processing, after the
> server comes back, the restart trigger will fire and it will pick up where
> it left off in its processing, loading up the task server as it needs to.
>
> -Danny
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Mike Whitman
> Sent: Friday, September 04, 2009 8:18 AM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] empty Task Server queue
>
> Is there a way to empty the Task Server Queue.  I tried restarting and
> setting queue size to one and restarting.
>
> thanks,
>
> Mike
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 4 Sep 2009 12:52:21 -0400 (EDT)
> From: David Sewell <[email protected]>
> Subject: Re: [MarkLogic Dev General] dateTime cast
> To: General Mark Logic Developer Discussion
>        <[email protected]>
> Message-ID:
>        <[email protected]>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> I don't know if "bug" is the right term, but certainly "limitation".
> This is still the case in ML 4.1-1.
>
> And this workaround is not even possible:
>
>  if ("1999-01-01TTT0:0:0" castable as xs:dateTime)
>  then xs:dateTime("1999-01-01TTT0:0:0")
>  else ()
>
> It still throws an XDMP-CAST error, meaning the "then" result is being
> evaluated in a static context and not optimized away. (In eXist and
> Saxon XQuery, by contrast, the query succeeds.)
>
> So I think you'd have to go with a workaround like
>
> let $date := "1999-01-01TTT0:0:0"
> let $castable := $date castable as xs:dateTime
> return
>  if ($castable)
>  then xs:dateTime($date)
>  else ()
>
>
> On Fri, 4 Sep 2009, Paul M wrote:
>
> > Not sure if bug, need workaround ideas regardless..
> > 3.2-10
> >
> > let $x := try{xs:dateTime("1999-01-01TTT0:0:0")} catch($ex) {()}
> > let $y := try{ 2 div 0 } catch($ex) {()}
> > return $x
> >
> > Return a dateTime if possible. Otherwise, return empty sequence.
> > The second try-catch works. The first does not.
> >
> > What would you do if you knew one of your casts may fail? My only idea is
> regexp?
> >
> >
> >
> >
>
> --
> David Sewell, Editorial and Technical Manager
> ROTUNDA, The University of Virginia Press
> PO Box 801079, Charlottesville, VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: [email protected]   Tel: +1 434 924 9973
> Web: http://rotunda.upress.virginia.edu/
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 4 Sep 2009 10:31:24 -0700
> From: Eric Bloch <[email protected]>
> Subject: [MarkLogic Dev General] UTC <-> xs:date in XQuery ?
> To: [email protected]
> Message-ID:
>        <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hey Folks,
>
> I'm a bit of a newbie to XQuery so pardon if this is well-documented
> elsewhere.  How do I convert between xs:date and UTC?  My XML data has
> times
> stored in UTC.
>
> Thanks,
> Eric
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://xqzone.marklogic.com/pipermail/general/attachments/20090904/62d2bcf2/attachment-0001.html
>
> ------------------------------
>
> Message: 8
> Date: Fri, 4 Sep 2009 10:41:44 -0700
> From: Micah Dubinko <[email protected]>
> Subject: Re: [MarkLogic Dev General] UTC <-> xs:date in XQuery ?
> To: General Mark Logic Developer Discussion
>        <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Eric,
>
> By UTC, do you mean that the values end with the 'Z' character
> (2009-09-04T13:01Z), or something else?
>
> I think you need fn:adjust-dateTime-to-timezone() or one of the other
> functions here:
> http://www.xqueryfunctions.com/xq/c0002.html#c0058
>
> Thanks, -m
>
>
> On Sep 4, 2009, at 10:31 AM, Eric Bloch wrote:
>
> > Hey Folks,
> >
> > I'm a bit of a newbie to XQuery so pardon if this is well-documented
> > elsewhere.  How do I convert between xs:date and UTC?  My XML data
> > has times stored in UTC.
> >
> > Thanks,
> > Eric
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://xqzone.com/mailman/listinfo/general
>
>
>
> ------------------------------
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>
> End of General Digest, Vol 63, Issue 14
> ***************************************
>



-- 
Eric Bloch
 616 Virginia Avenue, San Mateo, CA 94402
 Email: [email protected]
 Web page: http://www.virginia-avenue.com:8000/
 Phone: 650-458-8929
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to