Representation and reasoning about temporal patterns of activities in smart environments