# Gaining Insights into Conceptual Models: A Graph-Theoretic Querying Approach
## 6 OPM Query Implementation
### Neighborhood Queries
#### 6.2.1 Neighborhood UI Implementation  
Once the user enters the \"Neighborhood Queries\" section in the \"OPM Insights\" feature of OPCloud, the dialog window shown in Figure 18 pops up, requesting the user to choose between a \"Non-directional\" or a \"Directional\" query type. Each query type selection generates a list of query properties required for the query execution.  
The \"Direction\" property is presented only when the \"Directional\" OPM Query type is selected. The possible options for this query are \"Outgoing\" and \"Incoming\", representing a link direction from or to the root node, respectively. The \"Max Depth\" property indicates the number of hops from the root node that the graph search query considers. For example, if the selected \"Max Depth\" value is \"1', the subgraph that the query will return will be the root node and all its neighbors that are directly connected with arcs leading to them. \"Only Procedural\" is a Boolean property that enables the user to filter the vertices by specifying the OPM procedural links connecting them, which can be one of three kinds [3]:  
1. Transforming link, which connects a transformee (an object that the process transforms) or one of its states, with a process to model object transformation, namely generation, consumption, or state change of that object as a result of the process performance;  
Figure 18: Directional query dialog window.  
2. Enabling link, which connects an enabler, i.e., an agent or an instrument, or one of their states, with a process to model an enabling presence for that process; and  
3. Control link, which is a transforming or an enabling link with an event or condition control modifier, marked next to the link end by the letter e or c, respectively, that adds semantics of an execution control mechanism to model an event that initiates the linked process or a condition for performing the linked process.  
The \"Root\" property identifies the root (starting) node of the subgraph. The values for this property are generated dynamically, based on the existing OPM model entities, i.e., process, object, or state.  
The main process in the OPM model in Figure 19 is **Piano Music Playing**. It is handled by the agent **Piano Player** and results in **Piano Music**. **Piano Music** is connected to the **Music Listening** process, handled by the agent **Audience**. The semantics of the condition link, denoted by the letter c next to the consumption link from **Music Listening**, is that if **Piano Music** exists, it is consumed by **Music Listening**. **Piano Music Playing** requires the instrument **Piano**, which consists of **Keyboard**, **Hammer Set**, **Damper Set**, and **String Set**. The aggregation-participation (whole-part, or \"consists-of\") relationship is an OPM fundamental structural link, while the other relationships in the OPM model are procedural--they connect an object and a process.  
Executing a non-directional query starting from the **Piano Music Playing** process with a maximal depth of 3, while filtering for procedural links only, generates the result presented in Figure 20. Due to the procedural links filter, the parts of **Piano** are not included in the result. Since the maximal depth is 3, **Audience** is included in the query result as part of the sub-path [**Piano Music Playing** [HOP1], **Piano Music** [HOP2], **Music Listening** [HOP3], **Audience**]. The root node is highlighted in both the diagram and the OPL sentences.  
Figure 19: **Piano Music Playing** OPM model.