Extending Datalog for Ordered Multidimensional Databases