Written by Charles Eddy from the Dell | EMC InfoArchive team. This function calls the doc URI when running an XQuery in the Baptist InfoArchive xDB.
declare function local:getPath($name as xs:string){
let $doc := doc('/data')[xhive:metadata(. ,'metadata.ia.emc.com/name/parent') = $name][1]
let $uri := base-uri($doc)
let $docPath := substring-before($uri, tokenize($uri, '/')[last()])
return $docPath
};