Re: [MarkLogic Dev General] A couple of questions about the Alerting capabilities in ML 4.0

2008-12-16 Thread Darin McBeath
Thanks for the clarification Wayne.  One last question. I'm not sure the fragmentation is that much of a 'special' case.  Couldn't one encounter an issue whenever the first paramter to cts:search (used to scope the search) was something other than the root of the document?  I guess what I'm try

[MarkLogic Dev General] XMP and 4.0-x

2008-12-16 Thread Michael Blakeley
I noticed that Matt Turner and Kelly's trick with XMP (http://xquery.typepad.com/xquery/2006/09/the_xmp_trick.html) needed some work in 4.0-x and 1.0-ml. The problem seems to be that string functions no longer ignore invalid UTF-8 codepoints, so the substring-*(xdmp:quote($binary)) idiom now fa

Re: [MarkLogic Dev General] A couple of questions about the Alerting capabilities in ML 4.0

2008-12-16 Thread Wayne Feick
Hi Darin, Agreed that there should be something more in the developer guide as well. Re: fragmentation, that's a special case, and not the common usage. However, the alerting API was designed to allow you to do these sorts of things, but you would need to create your own trigger, or CPF pipeline

Re: [MarkLogic Dev General] A couple of questions about the Alerting capabilities in ML 4.0

2008-12-16 Thread Darin McBeath
Thanks Wayne. I guess that I overlooked the external variable bit in the detailed summary section of the 'make action' function. Since I was primarily looking at the developer guide (chapter 25.0) I might suggest that you add this bit of information here when discussing actions that are invoke

Re: [MarkLogic Dev General] MarkLogic function for calculating Levenshtein distance between strings?

2008-12-16 Thread David Sewell
Should be useful for our purposes as well. We want to process a long list of names to find variants of the same name, such as Sewell, David Sewall, David Bernstein, Leonard Bernstien, Leonard for normalization. This function will do a good job of returning probable cases of "same per

Re: [MarkLogic Dev General] A couple of questions about the Alerting capabilities in ML 4.0

2008-12-16 Thread Wayne Feick
Hi Darin, You are correct about the external variables. Here they are: declare namespace alert = "http://marklogic.com/xdmp/alert";; declare variable $alert:config-uri as xs:string external; declare variable $alert:doc as node() external; declare variable

Re: [MarkLogic Dev General] MarkLogic function for calculating Levenshtein distance between strings?

2008-12-16 Thread Mike Sokolov
Note: it's not *exactly* Levenshtein distance because it counts a letter "swap" as only a single step rather than two, but we think this is better than traditional Lev. dist. for suggesting spell correction errors at least since people often make that mistake when typing -Mike David Sewell wr

Re: [MarkLogic Dev General] MarkLogic function for calculating Levenshtein distance between strings?

2008-12-16 Thread David Sewell
Excellent, thanks much! On Tue, 16 Dec 2008, Mike Sokolov wrote: > Here ya go: > > define function spell:levenshtein-distance ($a as xs:string, $b as xs:string) > { > let $la := string-length ($a) > let $lb := string-length ($b) > return >if ($la = 0) then > $lb >else if ($lb = 0)

[MarkLogic Dev General] A couple of questions about the Alerting capabilities in ML 4.0

2008-12-16 Thread McBeath, Darin W (ELS-STL)
I have been playing around with the new alerting functionality and have a couple of questions. 1. When an alert action is spawned/invoked how can I tell what 'rule' actually caused the event? When reviewing the API, I can't seem to find a function that will perform this task. Perhaps, I'm si

Re: [MarkLogic Dev General] MarkLogic function for calculating Levenshtein distance between strings?

2008-12-16 Thread Mike Sokolov
Here ya go: define function spell:levenshtein-distance ($a as xs:string, $b as xs:string) { let $la := string-length ($a) let $lb := string-length ($b) return if ($la = 0) then $lb else if ($lb = 0) then $la else if (substring($a,1,1)=substring($b,1,1)) then spell:lev

[MarkLogic Dev General] MarkLogic function for calculating Levenshtein distance between strings?

2008-12-16 Thread David Sewell
Is there a MarkLogic function to calculate the similarity of two strings using Levenshtein distance (or any other appropriate algorithm)? A Web search turns up one XQuery-1.0 function that isn't very accurate, and Jenni Tennison has created one in XSLT 2.0 that could be adapted as an XQuery functi