AppleScript Scripting Dictionary:

Many queries and functions are available via AppleScripting XTdb.