An approach for context-based reasoning in ambient intelligence