Added algorithm to construct logical triple ordering.