In osm. I can map building with tag building = residential also can map Residential way with tag landuse = residential but how to map The building belongs to residential? I thought of a way map the building with operator = 'xxxx'. But it does not seem right
Firstly, I would expand your buildings tags to include not just 'residential' but also other appropriate tags like 'apartments', 'house', 'detached' etc (see OSM documentation) as these are also indicators of a building being residential.
To link buildings to roads and areas, you could do a spatial join of buildings to residential areas (landuse=residential) or residential roads (e.g. highway='residential' don't forget the other residential-type tags for roads like 'living_street'). There is also another tag that might prove useful and that is 'abutters'. This specifically describes the buildings beside the road. However, I am not sure how widespread the use of this tag is so a little investigation in your area of interest would be advisable.
In any of these options, if your purpose is just a visual map, then an appropriate solution may be as simple as applying a distinctive style to the residential areas or roads and then a user of your map can infer that the buildings there are residential (in this scenario you would not need to even do the spatial join). In this scenario, you may want to mark specifically non-residential buildings (commercial, place_of_worship etc).