# Metrics-Based Comparison of OWL and XML for Representing and Querying Cognitive Radio Capabilities
## 4 Problem Formulation
### Problem Formalization
#### 4.1.2 Examples  
To illustrate the relations between devices/queries and their representations in the two approaches with the presented notations, we provide two examples. One is a device with its configuration and its representations in the two approaches. The other is a query example in natural language as well as its representations in the respective query languages of the two approaches.  
**A Device Description Example**: An example of the device \(D_{i}\in D\) named _device_instance_ is described in Table 3. The rows show the parameters of this device.  
Listing 1 (\(D^{xml}_{i}\in D^{xml}\)) and Listing 2 (\(D^{owl}_{i}\in D^{owl}\)) show this device represented in XML and OWL, respectively. In this example, the device name \"device_instance\" is mapped as an XML attribute in XML, whereas an OWL individual is mapped in OWL.  
\begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{1}{c}{**Specifications**} & \multicolumn{1}{c}{**Parameters**} \\ \hline Device Name & device\_instance \\ Series & USRP\_N200 \\ \hline \multirow{4}{*}{Spectrum Sensing} & Bandwidth & 200 kHz \\ \cline{2-3}  & Frequency Range & 80–120 MHz \\ \cline{2-3}  & Sensing Time & 1 s \\ \hline Transmitting & Max Output Power & 0.01 W \\ \hline \hline \end{tabular}
\end{table}
Table 3: A device example.  
```
<SupportsSpectrumSensing> <Bandwidthunits=\"kHz\">200<Bandwidth> <FrequencyRange> <Minunits=\"MHz\">80</Min> <Maxunits=\"MHz\">120</Max> </FrequencyRange> <SensingTimeunits=\"Second\">1.0</SensingTime> </SupportsSpectrumSensing> <SupportsTransmitting> <MaxOutputPowerunits=\"Watt\">0.01</MaxOutputPower> </SupportsTransmitting> </USRP_N200>
```  
Listing 1: Device description example in XML.  
```
<SupportsSpectrumSensing> <Bandwidthunits=\"kHz\">200<Bandwidth> <FrequencyRange> <Minunits=\"MHz\">80</Min> <Maxunits=\"MHz\">120</Max> </FrequencyRange> <SensingTimeunits=\"Second\">1.0</SensingTime> </SupportsSpectrumSensing> <SuperportsTransmitting> <MaxOutputPower units=\"Watt\">0.01</MaxOutputPower> </SupportsTransmitting> </USRP_N200>
```  
Listing 2: OWL device description example in Turtle syntax.  
```
device_instanceaUSRP_N200; hasCapabilityspectrumSensing,transmitting. spectrumSensing,aSpectrumSensing,hasBandwidth[hasValue[hasDataValue200;hasLoMkHz]]; hasFrequencyRange  hsMin[hasValue[hasDataValue80;hasLoMMHz]]; hasMax[hasValue[hasDataValue120;hasLoMMHz]]]; hasSensingTime[hasValue[hasDataValue1.0;hasLoMSecond]]. transmittinghasMaxOutputPower[ hasValue[hasDataValue0.01;hasLoMWatt]].
```  
Listing 3: An example of request representation in XQuery.  
```
for$deviceintoc(\"devices.xml\")/USRP_Nxxx where$device/SupportsTransmitting/@units=\"Watt\" and$device/SupportsTransmitting[MaxOutputPower<=1.0] returndata($device/@name)
```  
Listing 4: An example of request representation in XQuery.  
An OWL Inference Example: The device example presented in Listings 1 and 2 does not match the query example shown in Listings 3 and 4. The issue here is that the device is described as USRP_N200, while the query is asking for USRP_Nxxx. While a human might know that USRP_N200 is a subtype of USRP_Nxxx, a query processor would not be able to match this request with the USRP_N200 device. However, if background knowledge \(B_{i}\in B\) includes triple (_USRP_N200 rds:subClassOf USRP_Nxxx_), an inference engine that supports OWL 2 RL will be able to infer that (_device_instance a USRP_Nxxx_). The net result is then that a query engine that has support from an OWL reasoner will return a match. While this is a very simple example of the usability of OWL reasoning in the process of matching descriptions versus queries, the ontology may have many axioms about the specific types of devices, and thus the number of inferences can be quite large.