prototype of match depth

Calulates the depth of a query match in a mathematical
object.
xquery is used