Database support for line clustering