select rel_id from acs_rels where rel_type = 'application_data_link' and (object_id_one = :object_id or object_id_two = :object_id) select object_id_two from acs_rels where object_id_one = :package_id and rel_type = 'application_data_link' select o.object_id from acs_rels 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 and r.rel_type = 'application_data_link'