Skip to main content
. 2015 Jun 16;15(6):14180–14206. doi: 10.3390/s150614180
Listing 2: Subscription filter used by the context processing entity
1 function evaluate(XMLdocument) {
2  importPackage(javax.xml.xpath);
3  var XPath = XPathFactory.newInstance().newXPath();
4 if((XPath.evaluate(“⫽observable[uri=‘/location’ and unit=‘WGS84’]”,
5    and value=‘48,52 .* N, 2,18 .* E’
6    XMLdocument, XPathConstants.NODESET).length == 0) &&
7   (XPath.evaluate(“⫽observation[uri=‘/pollution/carbon-monoxide’ and unit=‘ppm’]”,
8    XMLdocument, XPathConstants.NODESET).length == 0)) {
9   return false;
10  }
11 if((XPath.evaluate(“⫽QoCIndicator[@id=‘10’ and
12    QoCCriterion[@id=‘[10.1]’]/QoCMetricDefinition[@id=‘10.1’]]”,
13    XMLdocument, XPathConstants.NODESET).length == 0) &&
14   (XPath.evaluate(“⫽QoCIndicator[@id=‘7’ and
15    QoCCriterion[@id=‘[7.1]’]/QoCMetricDefinition[@id=‘7.1’]]”,
16    XMLdocument, XPathConstants.NODESET).length == 0) &&
17   ( (XPath.evaluate(“⫽QoCIndicator[@id=‘15’ and
18    QoCCriterion[@id=‘[15.1]’]/QoCMetricDefinition[@id=‘15.1’]]”,
19    XMLdocument, XPathConstants.NODESET).length == 0) ‖
20   (XPath.evaluate(“⫽QoCIndicator[@id=‘18’ and
21    QoCCriterion[@id=‘[18.1]’]/QoCMetricDefinition[@id=‘18.1’]]”,
22    XMLdocument, XPathConstants.NODESET).length == 0) ) {
23   return false;
24  }
25 return true;
26 }