# Autonomic Semantic-Based Context-Aware Platform for Mobile Applications in Pervasive Environments
## 4 Ontology and Rules-Based Context Model
### Context Provisioning  
In order to be successful, a context-aware multimodal mobile application must have a full visibility of the person's context, including what, when and how to monitor, collect and analyze context data. In the case of changes according to the user context (e.g., less available memory, less processor power, change of user location), or the environment context (e.g., less bandwidth), or the user preferences, the ASSACR component will be provisioned by a set of contexts metadata in order to dynamically:  
* Provision the next substituted service of the list of services offering the same service functionalities, which require less available resources and sorting the QoS of available services.
* Add new services into the list of found services. The new service is matched from the new provisioned changes in the profile constraint (e.g., the user context).  
We consider each sub-context profile and its constraints. Solving a single user constraint in a low service space (local, neighbors) is easier and less time consuming. Therefore, we can start services discovering the optimum cost and good provisioning services chain by a combination of reconfiguration operations: create/update/migrate/remove from some context attributes changes with a single performance and approach the global optimum service reconfiguration chain.  
Our approach divides the all of user context changes into several phases (Algorithm 2). One more preference (expressed as an _Event-Condition-Action rule_) is considered in each phase until the global reconfiguration chain is provisioned and generated. First, a set of services is discovered and matched with a certain concerned context conditions on some changing context adaptively, called _Single-Increment-Context-Evolution_. Secondly, we investigate the better quality services obtained from Step 1, and services from provisioning context attributes changes (low bandwidth, battery life time, etc.) are joined together in Step 2 to form an initial configuration, for which there are multi-concerned context constraints.  
For an efficient and better provisioning and good management of the self-management adaptation process, we have used the \"Poisson event-based\" simulation model to predict context changes (i.e., mobility of users, usage resources), then we have provided the global system's behavior that requires adaptation and overcoming the rising complexity of the context-aware system.  
Our process predicts minimum adaptive cost in low adaptation time, to result in the best configuration, such that the system quality is maximized subject to device resource constraints and user preference constraints. Firstly, the platform will be able to restrict the scope of the search into the range of configurations, which differ from the current configuration only by the service at the origin ofthe reconfiguration event. However, when this approach does not give any solution, we look for a new configuration to use, starting by switching from a new relay or by moving a service to a suitable device at run-time. The ASSACR generates a provisioned configuration model. When the reconfiguration is triggered, we start-up the provisioned saved reconfiguration.  
```
Input: Predict user context changes Output: Generates provisioned Services reconfiguration file 1. Set \(p=1\); where \(p\) is the phase number; find a provisioned quality services list with regard to the first concerned context attribute change. 2. Set \(p=p+1\). The next phase starts. 3. Generate a fittest quality services list with regard to the \(p\)-th concerned context attribute change and joined with the \(p-1^{th}\) concerned context attributes. 4. If remained context attributes changes, go to 2. 5. Generation of provisioned reconfiguration file.
```  
**Algorithm 2**Incremental Context Changes Prediction