for $mot in collection("sortie-up-3210.xml")//item (:pour extraire une autre relation: remplacer 'obj' par le nom de la relation:) where contains($mot/a[8]/text(),'obj') let $dep:=$mot/a[2]/text() let $dep_id:= $mot/a[1]/text() let $head_id:= $mot/a[7]/text() let $head:= if ($head_id > $dep_id) then ($mot/following-sibling::item[number(a[1])=$head_id]/a[2]/text()) else ($mot/preceding-sibling::item[number(a[1])=$head_id]/a[2]/text()) let $obj:=concat($head, " --> ", $dep) return $obj