class WorkingMemory:
    def __init__(self):
        self.knowledge_base = {}  # A dictionary to store various types of knowledge
        self.current_context = []  # List to track current context or focus
        self.active_elements = set()  # Set of active elements in the memory

    def add_element(self, element_id, data):
        """Add an element to the working memory with associated data."""
        if not isinstance(element_id, str) or not isinstance(data, dict):
            raise ValueError("Invalid input: element_id must be a string and data must be a dictionary.")
        
        self.knowledge_base[element_id] = data
        self.active_elements.add(element_id)
    
    def update_element(self, element_id, new_data):
        """Update the existing element in the working memory."""
        if element_id not in self.knowledge_base:
            raise KeyError("Element ID does not exist in the knowledge base.")
        
        if not isinstance(new_data, dict):
            raise ValueError("New data must be a dictionary.")
        
        self.knowledge_base[element_id].update(new_data)
    
    def remove_element(self, element_id):
        """Remove an element from the working memory."""
        if element_id not in self.knowledge_base:
            raise KeyError("Element ID does not exist in the knowledge base.")
        
        del self.knowledge_base[element_id]
        self.active_elements.discard(element_id)
    
    def get_element(self, element_id):
        """Retrieve the data of a specific element from working memory."""
        if element_id not in self.knowledge_base:
            raise KeyError("Element ID does not exist in the knowledge base.")
        
        return self.knowledge_base[element_id]
    
    def set_context(self, context_list):
        """Set the current context or focus for processing elements."""
        self.current_context = list(context_list)
    
    def get_context(self):
        """Get the current context of processing."""
        return self.current_context
    
    def clear_context(self):
        """Clear the current context."""
        self.current_context.clear()
    
    def activate_element(self, element_id):
        """Activate an element in the working memory for current processing."""
        if element_id not in self.knowledge_base:
            raise KeyError("Element ID does not exist in the knowledge base.")
        
        self.active_elements.add(element_id)
    
    def deactivate_element(self, element_id):
        """Deactivate an element from active state."""
        if element_id not in self.knowledge_base or element_id not in self.active_elements:
            return
        
        self.active_elements.discard(element_id)
    
    def activate_context(self):
        """Activate elements based on current context for processing."""
        for element_id in self.current_context:
            self.activate_element(element_id)

# Example usage
wm = WorkingMemory()
wm.add_element("001", {"data": "Example data 1"})
wm.add_element("002", {"data": "Example data 2"})

wm.set_context(["001", "003"])
try:
    wm.activate_context()  # This will try to activate '003', which is not in the knowledge base
except KeyError as e:
    print(e)

print(wm.get_element("001"))  # {'data': 'Example data 1'}
wm.update_element("001", {"data": "Updated example data 1"})
print(wm.get_element("001"))  # {'data': 'Updated example data 1'}

wm.deactivate_element("001")
if "001" in wm.active_elements:
    print("Element 001 is still active.")
else:
    print("Element 001 has been deactivated.")

wm.remove_element("002")
try:
    print(wm.get_element("002"))
except KeyError as e:
    print(e)  # This will raise a KeyError