insert into acs_data_links (rel_id, object_id_one, object_id_two) values (:forward_rel_id, :this_object_id, :target_object_id) insert into acs_data_links (rel_id, object_id_one, object_id_two) values (:backward_rel_id, :target_object_id, :this_object_id) select rel_id from acs_data_links where (object_id_one = :object_id or object_id_two = :object_id) delete from acs_data_links where rel_id = :rel_id select object_id_two from acs_data_links where object_id_one = :object_id order by object_id_two select o.object_id from acs_data_links r, acs_objects o where r.object_id_one = :from_object_id and r.object_id_two = o.object_id and o.object_type = :to_object_type order by r.object_id_two select i.item_id from acs_data_links r, cr_items i where r.object_id_one = :from_object_id and r.object_id_two = i.item_id and i.content_type = :to_content_type order by r.object_id_two