Re: Can XQuery handle hierarchical data?

From: Neo <neo55592_at_hotmail.com>
Date: 13 Jan 2005 20:59:46 -0800
Message-ID: <1105678786.016159.115440_at_z14g2000cwz.googlegroups.com>


Script below models the hierarchy with an experimental db (not XQuery) and walks the tree recursively.

// Create persons
(CREATE *person.item ~in = dir)
(CREATE *allen.cls = person)
(CREATE *smith.cls = person)
(CREATE *miller.cls = person)
(CREATE *adam.cls = person)

// Create salaries
(CREATE *salary.item ~in = dir)
(CREATE allen.salary=+2000)
(CREATE smith.salary=+1500)
(CREATE miller.salary=+1800)
(CREATE adam.salary=+1000)

// Create verbs for heirarchy
(CREATE *boss.cls = verb)
(CREATE boss.vbType = kr)
(CREATE *employee.cls = verb)
(CREATE employee.vbType = cr)
(CREATE boss.opposite = employee)

// Create hierarchy
(CREATE allen.employee = smith)
(CREATE allen.employee = miller)
(CREATE miller.employee = adam)

// Selects allen's empolyees recursively // Selects smith, miller, adam
(SELECTR allen.employee)
Received on Fri Jan 14 2005 - 05:59:46 CET

Original text of this message