Thank you! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kelly Stirman Sent: Tuesday, June 16, 2009 3:36 PM To: [email protected] Subject: [MarkLogic Dev General] RE: Frequency of co-occurrences using cts:element-attribute-value-co-occurrences
Hi Tim, The co-occurrence built ins return xml nodes that look like the following: <cts:co-occurrence xmlns:cts="http://marklogic.com/cts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <cts:value xsi:type="xs:string">Foo</cts:value> <cts:value xsi:type="xs:string">Bar</cts:value> </cts:co-occurrence> (The value entries correspond to the order of the QNames passed into the built in.) You can simply call each node with cts:frequency to get the frequency of the co-occurrence, which means the number of fragments in which the two values occur. for $i in cts:element-value-co-occurrences(xs:QName("location"),xs:QName("author")) let $c := cts:frequency($i) return <result c="{$c}">{$i}</result> Kelly -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Friday, June 12, 2009 3:00 PM To: [email protected] Subject: General Digest, Vol 60, Issue 22 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. Frequency of co-occurrences using cts:element-attribute-value-co-occurrences() (Tim Meagher) ---------------------------------------------------------------------- Message: 1 Date: Fri, 12 Jun 2009 11:18:21 -0400 From: "Tim Meagher" <[email protected]> Subject: [MarkLogic Dev General] Frequency of co-occurrences using cts:element-attribute-value-co-occurrences() To: "'General Mark Logic Developer Discussion'" <[email protected]> Message-ID: <003601c9eb71$0718fe00$0601a...@grace> Content-Type: text/plain; charset="us-ascii" Hi Folks, I am familiar with using cts:frequency to get the number of occurrences of a unique element value in a lexicon using cts:element-values(), but I'm wondering how to find the number of co-occurrences between an element and attribute using cts:element-attribute-value-co-occurrences(). Is there a distinct result for each element/attribute pair found in a fragment, and if so, how would one obtain the number of co-occurrences for a unique element/attribute value pair? I'm under the impression that performing a cts:frequency on the value of an element returned by the cts:element-attribute-value-co-occurrences will return the number of occurrences of that value in its corresponding lexicon, not in the results of the call to cts:element-attribute-value-co-occurrences(). Thanks for the help, Tim Meagher - AAOM Consulting -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xqzone.marklogic.com/pipermail/general/attachments/20090612/8d6d378b/ attachment-0001.html ------------------------------ _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general End of General Digest, Vol 60, Issue 22 *************************************** _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
