Title: A distributed knowledge-based approach to flexible automation