The necessity of guard preconditions
32
Copyright © 2014 Open Geospatial Consortium
inv: self.runway-notEmpty is currently translated into
[concat,gml:id=currentagoas:runwayxlink:href This picks those elements from the GML instance document, each of which carries a
gml:id attribute, the value of which, when prefixed by happens to be identical to the xlink:href attribute on at least one of the property agoas:runway instances on the current
feature. If the nodeset of elements picked this way is not empty, then the XPath expression is finally converted to the Boolean true, which means that the assertion holds.
This translation reflects the semantics of OCL. The expression self.runway in OCL means the set of objects referenced by the runway property and this is just, what the
corresponding […] expression in XPath finds.
The translation is under the assumption that xlink:href references prefix the id with a . The implementation permits to configure other prefixes and postfixes if required.
The open problem is that the GML document to be checked also requires the referenced objects to be contained.
There are two possible solutions to deal with this: 1. For the notEmpty operator less than the above could be checked. We could for
example check whether the property is there, or perhaps the property together with xlink:href is there. In this case we would simply translate to
agoas:runwayxlink:href However, this is not a general solution, because it must be restricted to special
operators. notEmpty, isEmpty, size might work this way, because they need nothing but the number of items. Definitely self.runway-selectt|someexpressiont
or any use of the exists or forAll iterators does not work, because it requires access to the contents of the objects.
2. It might also be possible to extend the test into external documents. For this the XPath 1.0 function document might be employed, which, if supplied
with a set of URLs of XML documents delivers a nodeset of root nodes of the documents addressed by these URLs.
The problem to solve here is how to extract the URL of an referenced GML instance document presumably created on the fly by some service invocation from an
xlink:href value. Supposed this could be done by some magic hrefToURL function, then the notation would be straightforward as follows:
documenthrefToURLagoas:runwayxlink [concat,gml:id=currentagoas:runwayxlink:href