Opened 14 years ago

#17 new enhancement

Support saved functions

Reported by: ebmoore Owned by: detwiler
Priority: minor Milestone:
Component: xbrain Version:
Keywords: Cc:


XBrain should support saved XQuery functions. This would make writing queries by hand and reading them much easier as we could build on previous functions without using copy/paste. This will likely require Ticket #16 to be addressed.

The functions should be bound to namespace sig. Additionally it would be nice if the system only included the functions that were used in the shipped query (by scanning for sig:'function_name' and only including hits. This would require recursively scanning all included functions as well)

Possible functions would be:

  • sig:printStimsite($site as node()*)as node() (:for printing default sites:)
  • sig:printTrial($trial as node()*) as node() (:for printing default trials with sites:)
  • sig:printPatientData($patient as node()) as node() (:for printing pnum, sex, viq, age, whatever else we want to always appear)
  • sig:getTrialUnderSite($patient as node()*) as node() (:for getting a structure with trials under sites:)
  • many more

Example: if we just had a function: sig:printTrial then the template query's size is reduced by about half:

 let $code := '2'
 for $p in $pv/patient
 let $csm:=$p/surgery/csmstudy 
 where $csm/trial[stimulated='Y']/trialcode/term[type='CSM error code']/abbrev/text()=$code
    for $t in $csm/trial 
    where $t[stimulated='Y']/trialcode/term[type='CSM error code']/abbrev/text()=$code 
    return sig:printTrial($t)

Change History (0)

Note: See TracTickets for help on using tickets.