Skip to main content
. 2015 Jun 16;15(6):14180–14206. doi: 10.3390/s150614180
Listing 4: Subscription filter used by the healthcare application
1 function evaluate(XMLdocument) {
2  importPackage(javax.xml.xpath);
3  var XPath = XPathFactory.newInstance().newXPath();
4 if((XPath.evaluate(“⫽observable[uri=‘/location’ and unit=‘title’]”,
5    XMLdocument, XPathConstants.NODESET).length == 0) &&
6   (XPath.evaluate(“⫽observation[uri=‘/pollution-level’ and unit=‘AQI’]”,
7    XMLdocument, XPathConstants.NODESET).length == 0)) {
8   return false;
9  }
10 if((XPath.evaluate(“⫽QoCIndicator[@id=‘17’ and
11    QoCCriterion[@id=‘[17.1]’]/QoCMetricDefinition[@id=‘17.1’] and QoCMetricValue[@name=‘High’]]”,
12    XMLdocument, XPathConstants.NODESET).length == 0) ) {
13   return false;
14  }
15 return true;
16 }