Route block
This is an approach that might be used for tagging turn restrictions in our current database structure. Essentially the crux of the idea is that a node within a way is unique and can only be deleted by removing the connecting roads as well. The fact that you have then removed the actual junction between the two ways means you have removed all the bits that relate to the turn restriction and therefore node ID's that are no longer part of the way can be ignored when analysing. So rather than enforce referential integrity the integrity is no longer required and therefore can be ignored.
Segments are not referred to here since at some point they may be dropped from the OSM data structure.
Here's the tag format:
route_block=nodeID>from_angle>to_angle>transport_type
and here is an example of how it looks with real data
route_block=1234567>250>120>car
Lets break it down.
Firstly this is a key/value pair that is created on a way. Each way is made up of any number of nodes which each have a unique ID and therefore these can be referred to and relied upon with respect to a way (node ID's do not change once they are part of a way because of referential integrity on the database).
The node ID is a numerical value and represents the junction where the turn or other routing restriction exists. The ">" separator provides a separation from the following numeric value which is first the angle of the direction of travel along the way at the junction and then the angle of the adjoining street for which a restriction applies. The angle is the whole circle angle in whole degrees. The final ">" separator permits the mode of transport type which is restricted or "blocked" from the route.
Of course we may have more than one node with turn restrictions on a way, more than one turn restriction at each node and we may also have more than one restricted transport mode. These can all be considered by using a unity separator "|" between like information within the value or a ";" between unlike information. For example:
route_block=1234567>320>120|320>180>car|bus
and
route_block=1234567>320>120|320>180>car|bus;7654321>170>250>hgv
If a node is no longer part of a way then the information for that node ID remaining in the tags can simply be ignored.
Drawbacks
The main drawback is that if the junction is remodelled and the angles of the streets connecting at a node change significantly then the information in the way tags may break. However this is probably a small risk and the angle is deliberately a whole number so that routing algorithms will have to use the angle as a guide rather than a precise position.
Even with 8 roads joining at a node say, since they have a physical geometry that precludes very shallow angles it should still work. 360/8 is still 45 degrees of separation if evenly spaced so a wide degree of angle error should still work.
The magnetic angle you might be able to obtain using a compass might be good enough in some locations but its worldwide variance means that a calculated whole circle angle would be more reliable.
Further needs
JOSM needs a tool to be able to tell you the Mercator projected angles (or add it magically to the tag) where you don't have the magnetic compass bearing from the node in question.
A concise list of transportation types (including generic types)