-- set up template to be used for locality
/*
set @a1 = attribute_CreateText(
                            null,
                            'geoattribute',
                            'Номер будинку',
                            null,   -- sorter
                            null,   -- can_search
                            null,   -- display_in_object
                            null,   -- display_in_object_list
                            null,   -- factor
                            'y',    -- enabled
                            null,   -- code
                            'y',    -- required
                            'n',    -- sortable
                            '',     -- uofm_pre
                            '',     -- uofm_post
                            'n');   -- text_is_long
*/
-- set @1 = attribute_UpdateLocal(attribute_UpdateLocal(@a1, 'rus', 'Номер дома', null, null), 'eng', 'House Number', null, null);

set @s1 = tag_CreateDef(null, 'street', '-');

select node.id into @a1
from nodeLinkT link
join nodeT node on link.dstNodeId = node.id
where link.srcNodeId = @s1
    and link.metric = 1
    and node.nodeTypeId = 17; -- geo attribute

set @2 = template_Create(null, 'locality', @s1);
set @2 = template_Create(null, 'locality', @a1);

set @3 = nodeLink_UpdateStart();
set @4 = nodeLink_Relink(null, @s1, @a1);
set @5 = nodeLink_UpdateEnd();
