Reasoning on data streams: An approach to adaptation in pervasive systems